1
$\begingroup$

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

UPDATED

I am trying to solve this problem with the NDSolve command

\[Alpha] = 0.9;
\[Beta] = 0.2;
\[Gamma] = 1.2;
deq1 = x'[t] == z[t] + (y[t] - \[Alpha])*x[t]
deq2 = y'[t] == 1 - \[Beta]*y[t] - x[t]^2
deq3 = z'[t] == -x[t] - \[Gamma]*z[t]
soln = NDSolve[{deq1, deq2, deq3, x[0] == 1, y[0] == 3, 
   z[0] == 2}, {x[t], y[t], z[t]}, {t, 0, 1000}]
soln1 = NDSolveValue[{deq1, deq2, deq3, x[0] == 1, y[0] == 3, 
      z[0] == 2}, {x, y, z}, {t, 0, 1000}]
ParametricPlot3D[{soln[[1]][t], soln[[2]][t], soln[[3]][t]}, {t, 0, 
   1000}, AxesLabel -> {"x(t)", "y(t)", "z(t)"}, BaseStyle -> 14, 
  PlotRange -> All]

Any suggestions? Thank you in advance!!!

$\endgroup$
1
  • 2
    $\begingroup$ 1. You've defined soln1, why not use it? 2. Please don't ask distinctly different questions in one post. 3. You're making the same mistake as in your previous question. 4. Implementing Euler method for 3 equations is essentially the same as for 2 equations, please read the answer you've obtained carefully and make some effort to understand it. $\endgroup$
    – xzczd
    Jan 26 at 11:50

1 Answer 1

5
$\begingroup$
  • should be y'[t] == 1 - β*y[t] - x[t]^2;
Clear["Global`*"];
α = 0.9;
β = 0.2;
γ = 1.2;
deq1 = x'[t] == z[t] + (y[t] - α)*x[t];
deq2 = y'[t] == 1 - β*y[t] - x[t]^2;
deq3 = z'[t] == -x[t] - γ*z[t];
soln = NDSolve[{deq1, deq2, deq3, x[0] == 1, y[0] == 3, 
    z[0] == 2}, {x[t], y[t], z[t]}, {t, 0, 1000}];
ParametricPlot3D[{x[t], y[t], z[t]} /. soln, {t, 0, 1000}, 
 PlotPoints -> 200, MaxRecursion -> 8]
  • If we using NDSolveValue,then Through@soln1@t work.
soln1 = NDSolveValue[{deq1, deq2, deq3, x[0] == 1, y[0] == 3, 
   z[0] == 2}, {x, y, z}, {t, 0, 1000}]
ParametricPlot3D[Through@soln1@t, {t, 0, 1000}, 
 AxesLabel -> {"x(t)", "y(t)", "z(t)"}, BaseStyle -> 14, 
 PlotRange -> All, PlotPoints -> 200, MaxRecursion -> 8]

enter image description here

$\endgroup$
3
  • $\begingroup$ Yes, the second function is $Y'=1-\beta Y-X^2$ as you mentioned $\endgroup$ Jan 26 at 11:30
  • $\begingroup$ Thank you so much!! I updated my post. Any suggestions for Improved Euler Method? $\endgroup$ Jan 26 at 11:44
  • $\begingroup$ @AthanasiosParaskevopoulos We can post a new question about the Euler Method since it is hard to the original question. $\endgroup$
    – cvgmt
    Jan 26 at 11:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.