Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Delphi by 123 ( 17 years ago )
function IGReinschvalue (n : Integer; f : ivector; x : interval; var st : Integer) : interval;
var i,k,m,st2                 : Integer;
    fx, du, u,a,b,p,z,pin,d : interval;
begin
  if n<0
    then st:=1
    else begin
           st:=0;
           fx:=int_read('0');
           for i:=0 to n do
             fx:=iadd(fx,f[i]);
           fx:=idiv(fx,int_read(IntToStr(n+1)));
           m:=n div 2;
           d:=idiv(int_read('2'),int_read(inttostr(n+1)));
           pin:=imul(d,int_read(floattostr(Pi)));
           for k:=1 to m do
             begin
               z:=imul(int_read(inttostr(k)),pin);
               u:=int_read('0');
               du:=int_read('0');
               if ((icos(z,st2).a>0) and (icos(z,st2).b>0))
                 then begin
                        p:=imul(int_read('-4'),isqr(isin(idiv(z,int_read('2')),st2),st2));
                        for i:=n downto 0 do
                          begin
                            u:=iadd(du,u);

                            du:=iadd(iadd(imul(p,u),du),f[i])
                          end
                      end
                 else begin
                        p:=imul(int_read('4'),isqr(icos(idiv(z,int_read('2')),st2),st2));
                        for i:=n downto 0 do
                          begin
                            u:=isub(du,u);
                            du:=iadd(isub(imul(p,u),du),f[i])
                          end
                      end;
               a:=imul(d,(isub(du,idiv(imul(p,u),int_read('2')))));
               b:=imul(imul(d,u),isin(z,st2));
               p:=imul(int_read(inttostr(k)),x);
               fx:=iadd(iadd(fx,imul(a,icos(p,st2))),imul(b,isin(p,st2)))
             end;
           if odd(n)
             then begin
                    z:=imul(int_read(inttostr(m+1)),pin);
                    u:=int_read('0');
                    du:=int_read('0');
                    if ((icos(z,st2).a>0) and (icos(z,st2).b>0))
                      then begin
                             p:=imul(int_read('-4'),isqr(isin(idiv(z,int_read('2')),st2),st2));
                             for i:=n downto 0 do
                               begin
                                 u:=iadd(du,u);
                                 du:=iadd(iadd(imul(p,u),du),f[i])
                               end
                           end
                      else begin
                             p:=imul(int_read('4'),isqr(icos(idiv(z,int_read('2')),st2),st2));
                             for i:=n downto 0 do
                               begin
                                 u:=isub(du,u);
                                 du:=iadd(isub(imul(p,u),du),f[i])
                               end
                           end;
                    a:=idiv(isub(du,idiv(imul(p,u),int_read('2'))),int_read(inttostr(n+1)));
                    fx:=iadd(fx,imul(a,icos(imul(int_read(inttostr(m+1)),x),st2)))
                  end;
           IGReinschvalue:=fx
         end
end;

 

Revise this Paste

Your Name: Code Language: