This topic is a copy of that one on Mathematica.StackExchange. The question is about automatical derivation of coefficients of numerical scheme on a variable stencil. So, lets consider linear 1d transport equation
To discretize (1), let’s consider the following stencil:
Then, let’s consider the following approximation of (1) on (2):
where a_1,\,a_2 to be determined by Taylor series expansion. My first step seems to be as follows:
eqn = D[u[x, t], t] + D[u[x, t], x] == 0
approx = Series[
u[x, t + \[Tau]], {t, 0, 2}] - (a1 Series[u[x - h, t], {x, 0, 2}] + a2 Series[u[x, t], {x, 0, 2}])
The question is how to derive differential consequence from (1) to obtain system of two equation on a_i,\,i=1,2? Means, that we hold stencil (2) and approximation (3), consequently. The question is how to obtain a_1,a_2 by unknow coefficient method with the usage of differential



