1
$\begingroup$

Please consider the following nonlinear differential system,

D[x1[t], t] == 
  1/3 (-22 + 12 (x1[t])^3 + (x1[t])^2 (43 - 6 z1[t]) + 28 z1[t] -8 (z1[t])^2 + x1[t] (-13 + 28 z1[t] - 6 (z1[t])^2)), 
D[z1[t], t] == 
  1/3 (35 - 71 z1[t] + 40 (z1[t])^2 - 6 (z1[t])^3 + (x1[t])^2 (-35 + 12 z1[t]) + x1[t] (-85 + 58 z1[t] - 6 (z1[t])^2)), 

with initial conditions

x1[0] == 0; 
z1[0] == -1.341215; 

I want to find x1[t] and z1[t], so I can draw them in the xz-plane for t = 3. Can somone help me?

$\endgroup$
3
  • 1
    $\begingroup$ There are many examples in the documentation for NDSolve and DSolve, as well as this Q&A -- have you tried any of those methods? $\endgroup$
    – Michael E2
    Commented Apr 2, 2019 at 12:58
  • $\begingroup$ You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is useful for learning how to format your questions and answers. You may also find this meta Q&A helpful $\endgroup$
    – Michael E2
    Commented Apr 2, 2019 at 13:01
  • $\begingroup$ Yes sir I try but I think I did it badly $\endgroup$
    – Sara yaqob
    Commented Apr 2, 2019 at 13:30

1 Answer 1

3
$\begingroup$
eqns = {
   D[x1[t], t] == 
    1/3 (-22 + 12 (x1[t])^3 + (x1[t])^2 (43 - 6 z1[t]) + 28 z1[t] - 
       8 (z1[t])^2 + x1[t] (-13 + 28 z1[t] - 6 (z1[t])^2)),
   D[z1[t], t] == 
    1/3 (35 - 71 z1[t] + 40 (z1[t])^2 - 
       6 (z1[t])^3 + (x1[t])^2 (-35 + 12 z1[t]) + 
       x1[t] (-85 + 58 z1[t] - 6 (z1[t])^2)),
   x1[0] == 0, z1[0] == -1.3412147481212933`};

sol = NDSolve[eqns, {x1, z1}, {t, 0, 5}][[1]];

Plot[Evaluate[{z1[t], x1[t]} /. sol], {t, 0, 5},
 AxesLabel -> {Style["t", 12, Bold], None},
 PlotLegends -> Placed[{"z1", "x1"}, {.85, .65}],
 Epilog -> ({Dashed, Gray, Line[{{3, -2}, {3, 2}}],
     Red, AbsolutePointSize[4],
     Tooltip[Point[{3, x1[3]}], x1[3]],
     Tooltip[Point[{3, z1[3]}], z1[3]]} /. sol)]

enter image description here

ParametricPlot[{x1[t], z1[t]} /. sol, {t, 0, 5},
 Frame -> True,
 Axes -> False,
 PlotRange -> All,
 FrameLabel ->
  (Style[#, 12, Bold] & /@ {x1[t], z1[t]}),
 Epilog -> {Red, AbsolutePointSize[4],
   Tooltip[Point[{x1[3], z1[3]}],
     {x1[3], z1[3]}] /. sol},
 AspectRatio -> 1]

enter image description here

$\endgroup$
1
  • $\begingroup$ Oh my god thank you sir, thank you so much. Its what I need. $\endgroup$
    – Sara yaqob
    Commented Apr 2, 2019 at 13:28

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