comment Interval Solvers endcomment .. *** Interval EULER polygon method *** function idgl (fff,x,y0) ## Compute the solution of y'=fff(t,y0;...) at points t with ## y(t[1])=y0. ## The result is an interval vector of values. ## Additional arguments are passed to fff. ## fff may be an expression in x and y. n=length(x); y=~zeros(1,n)~; y[1]=y0; loop 1 to n-1; if isfunction(fff); m=fff(x[#],y[#],args()); else m=expreval(fff,x[#],y=y[#]); endif; i=~x[#],x[#+1]~; d=diameter(i); repeat J=y[#]+m*~0,d~; if isfunction(fff) m=expand(fff(i,J,args()),6/5); else m=expand(expreval(fff,i,y=J),6/5); endif; y2=y[#]+m*d; if (y2 <<= J); break; endif; end; y[#+1]=y2; end; return y; endfunction .. *** Interval LGS solver *** function ilgs (A,b) ## Solve A.x=b for x. ## Computes an interval inclusion of the solution. ## If the inclusion fails, you have to stop execution with the ESCAPE key. ## A and b may be of interval type. ## You may supply a pseudo inverse to A as an additional argument. n=cols(A); count=1; if argn()==2; A1=middle(A); R=inv(A1'); repeat; M=residuum(A1',R,id(n)); rho=max(sum(abs(M))'); if rho<1; break; endif; R=R-A1'\M; count=count+1; if (count>10); error("Could not find a pseudo invers."); endif; end; R=R'; else; R=arg3; endif; M=~-residuum(R,A,id(n))~; rho=right(max(sum(abs(M))')); if (rho>=1); error("Pseudo inverse not good enough."); endif; f=~-residuum(R,b,0)~; if argn()==2; x=middle(A)\middle(b); else; x=residuum(R,b,0); endif; xn=residuum(M,~x,x~,f); x=expand(x,max((right(max(abs(xn-x)'))/(1-rho))')); repeat; xn=residuum(M,x,f)&&x; if !(xn<