Question: Adams -Moulton Method

February 26 2014 sarra 195

0

Dear all,

here, I propose two methods for Adams Moulton Methos, but which one can I used.

The n-step Adams Moulton method to solve y'(x)=F(x,y(x)) is defined by the stencil

y(x+h)=y(x)+h *sum_{j=-1}^{n-1} beta_j F( x-j*h, y(x-j*h) ) + O(h^{n+2})

I want a procedure with single argument ''n'' that calculates and return the ''beta_i'' coefficients

I get two Methods. Which one correspond to my question please, and I don't understand the procedure proposed.

For me; the first give the iterative schemae used, but don't return the vector coefficients ( beta_i) and this methode method an interpolation of the function.

The second method, there is a function f, how this function is maded, and the same for the matrux A and the vector b...

the First Method:

> Adamsmoulton := proc (k::posint)

local P, t, f, y, n;

P := interp([t[n]+h, seq(t[n]-j*h, j = 0 .. k-2)], [f[n+1], seq(f[n-j], j = 0 .. k-2)], x);

y[n+1] = y[n]+simplify(int(P, x = t[n] .. t[n]+h))

end proc;

 

Second Method:

f:=proc(x,y) if x =0 and y=0 then 1 else x**y fi end;

n:=3; A:=matrix(n,n,(i,j)->f(1-j,1-i));

b:=vector(n, i->1/i);

linsolve(A,b);

 

Please Wait...