24 Reputation

6 Badges

15 years, 111 days

MaplePrimes Activity

These are answers submitted by griffgruff

Thank you gentlemen - problem solved.
Thanks Alex, I tried this but do not see the values. I should have mentioned that I am using Maple version 8. Regards
I am trying to write a script that generates the truncation error of a discretization. For example, a 4-point (equaly spaced), finite difference formula for the second derivative of y(x) is y''(x) = (2*y1-5*y2+4*y3-y4)/(h^2) (1) My approach has been to expand y(x) as a Taylor series and substitute into (1) evaluated at y1=y(x=0), y2=y(x=h) and y3=y(x=2h). However, whilst I obtain the correct Taylor series expansions, I cannot simplify to get the truncation error. The code I am attempting to use is as folows: > restart;dy :=taylor(y(x),x=0,5): > y1:=subs(x=0,dy): > y2:=subs(x=h, dy): > y3:=subs(x=2*h, dy): > y4:=subs(x=3*h, dy): > dy1:=simplify((2*y1-5*y2+4*y3-y4)/(h^2)); This produces the correct output but it is not simplified. I would like to be able to simplify it to get the truncation error. Any help appreciated. Graham
Page 1 of 1