Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Module[{g, d, \[Eta], m = 4, order = 3},
\[Eta] = u s/h;
(*d[x_]:=0;*)
(*d[x_]:=(f[0,x+h/2]-f[0,x-h/2])/h;*)
d[x_] := (2 - \[Eta])/3*(f[0, x + h/2] - f[0, x - h/2])/h + (1 + \[Eta])/3*(f[0, x - h/2] - f[0, x - 3 h/2])/h;
g[x_] := f[0, x - h/2] + 1/2 (1 - \[Eta]) h d[x];
Series[
(f[s, h/2] - f[0, h/2])/s + u (g[h] - g[0])/h
, {s, 0, m}, {h, 0, m}] // Normal // Expand
// ReplaceRepeated[#, {
Derivative[j_, k_][f][0, 0] :> Subscript[\[Alpha], j, k],
Subscript[\[Alpha], 0, k_] :> Subscript[\[Alpha], k],
Subscript[\[Alpha], j_,
k_] :> -u Subscript[\[Alpha], j - 1, k + 1]
}] &
]
Collect[% /. s -> h \[Eta]/u, h, Simplify]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment