Derivative and series expansion in Mathematica
I am reading this paper^{1} for understanding of modified equation and numerical viscosity. In the first section of this paper it has many calculations involving with finite differencing, derivative, and series expansion. I am trying to use Mathematica to aid the symbolic computation. Here are some notes.
The Series
function is used for series expansion.
And the Normal
function converts the series data into a polynomial.
For single variable function we can use following to get an second order series expansion at \( x0 \):
This answer from Mathematica.StackExchange shows how to find the expansion of a multivariable function \( u \) at \( (x0, t0) \):
Now we can substitute the expanded function into the differencing scheme. Let us take the secondorder LaxWendroff scheme as an example (the equation 1.3 in the paper):
where , , and are substituted by
Be aware that Superscript
function should be used explicitly
to denote a superscript.
Otherwise terms such as \( u_j^n \) would be recognized as exponents
if they were input in the Ctrl ^
way.
The final result(the equation 1.5 in the paper) is
This result is rendered by a tool called pdConv
which is introduced
by Mathematica Q&A Series.
References

Warming, R. F., and B. J. Hyett. “The modified equation approach to the stability and accuracy analysis of finitedifference methods.” Journal of computational physics 14.2 (1974): 159179. ↩