According to what I have read, the first formula is the classical Euler method and the second is the improved Euler method for second-order equations.
- Method A: accuracy of order h
S[a_, b_, h_, N_] := (u[0] = a; u[1] = a + h*b;
Do[u[n + 1] =
2 u[n] - u[n - 1] + h*h*f[n*h, u[n], (u[n] - u[n - 1])/h], {n, 1,
N}])
- Method B: accuracy of order h^2
Q[a_, b_, h_, N_] := (u[0] = a; v[0] = b;
Do[{u[n + 1] =
u[n] + h*
F[u[n] + (h/2)*F[u[n], v[n]],
v[n] + (h/2)*
G[u[n], v[
n]]], \
v[n + 1] =
v[n] + h*
G[u[n] + (h/2)*F[u[n], v[n]], v[n] + (h/2)*G[u[n], v[n]]]}, {n,
0, N}])
All the examples I have seen both in the book I have and in YouTube videos deal with two function systems and initial values. My question is this if we are given more than two functions how should we work? I can't find an example guide to figure out how. Any example would be appreciated. Thank you in advance
For example
It is given the following problem: $$X'=Z+(Y-\alpha)X$$ $$Y'=1-\beta Y-X^2$$ $$Z'=-X-\gamma Z$$ with initial conditions $(X(0),Y(0),Z(0)=(1,2,3)$.
Where
X: interest rate
Υ:investment demand
Z: price index
$\alpha$: savings, $\beta$: cost per investment, $\gamma$: the absolute value of the elasticity of demand
And we want the results with the Improved Eulers method. It is obvious that I have to use Method B: accuracy of order h^2. But I do not know how to define the new function on Mathematica
Sin[{Pi/3, Pi/6}]
and think about how you can make use of this feature of Mathematica. 4. Please first make some effort to understand Euler's method itself, the wiki page isn't a bad source: en.wikipedia.org/wiki/Euler_method $\endgroup$