# Overflowing during computation in Improved Euler’s method

At my master with have an assignment and we study the Dynamic analysis and control of a new hyperchaotic finance system. For this reason we use Improved Euler's Method with the following code.

In general we know that we can use the code for the Improved Euler’s Method for a system with two differential equations


Q[a_, b_, h_, N_] := (u = a; v = 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}])



I tried to solve the following problem by the recursive method using the following code of the improved Euler's method, but it returns me a message ''Overflow occurred in computation''

\[Alpha] = 0.9;
\[Beta] = 0.2;
\[Gamma] = 1.2;
f[x_, y_, z_] := z + (y - \[Alpha])*x
g[x_, y_, z_] := 1 - \[Beta]*y - x^2
p[x_, y_, z_] := -x - \[Gamma]*z
Q[a_, b_, c_, h_, N_] := (u = a; v = b; w = c;
Q[a_,b_,c_,h_,N_]:=(u=a;v=b;w=c;

Do[{u[n+1]=u[n]+h*f[u[n]+h/2*f[u[n],v[n],w[n]],v[n]+h/2*g[u[n],v[n],w[n]],w[n]+h/2*p[u[n],v[n],w[n]]],

v[n+1]=v[n]+h*g[u[n]+h/2*f[u[n],v[n],w[n]],v[n]+h/2*g[u[n],v[n],w[n]],w[n]+h/2*p[u[n],v[n],w[n]]],

w[n+1]=w[n]+h*p[u[n]+h/2*f[u[n],v[n],w[n]],v[n]+h/2*g[u[n],v[n],w[n]] ,w[n]+h/2*p[u[n],v[n],w[n]]]},{n,0,N}]);

X = Interpolation[Table[{n, u[n]}, {n, 0, 1000}]]
Y = Interpolation[Table[{n, v[n]}, {n, 0, 1000}]]
Z = Interpolation[Table[{n, w[n]}, {n, 0, 1000}]]
ParametricPlot3D[{X[t], Y[t], Z[t]}, {t, 0, 1000}]
$$$$

• My advice would be: If you want to solve a complicated problem, use NDSolve. If you want to play with the algorithm on a toy problem, play with a simpler one. Overflow is usually a symptom of a singularity or numerical instability, each of which I would consider a "feature," either of the problem or of the algorithm. I don't have time to explore which right now, but you could use NDSolve`, which has step control and better default methods, to determine whether there is a singularity. Jan 27 at 12:50