# Is there a sign error in the FDFormula in the Mathematica tutorial?

Posted 10 years ago
1955 Views
|
|
2 Total Likes
|
 Looking at http://reference.wolfram.com/mathematica/tutorial/NDSolvePDE.html there is a formula called FDFormula there. (near the top)I think the error term given by that formula above has the wrong sign. According to its documentation, it saysHere m is the order of the derivative,n is the number of grid intervals enclosed in the stencil, and s is the number of grid intervals between the point at which the derivative is approximated and the leftmost edge of the stencil.FDFormula[m_, n_, s_]Therefore , to obtain a forward difference for first derivative, m=1, n=1 and now s=0, since that is the distance between the left-most edge and the point of expansion.  The call becomes FDFormula[1, 1, 0]but this gives an error term as (h*f''/2), where it should be (-h*f''/2)and to obtain the backward difference, s=1, since now the distance is one to the left edge.FDFormula[1, 1, 1]and now it gives the error term as (-h*f''/2) instead of (h*f''/2).Also for centered difference, it does give the wrong signFDFormula[1, 2, 1]The eror term given is  1/6 *h^2*f''', when it should be a minus that.Could someone please double check this? May be I am not reading the API correctly.  I do not know how to enter Latex here, else will show the derivation, but it is only 2-3 lines and any one can verify this by hand. thanks,--Nasser