0
$\begingroup$

I am trying to understand the behavior of a system of equations that is derived from:

 ClearAll[x, y, t, q, d, sol]; ode1 = 
 y'[t] == 1 - d x[t] - (3 + 2 q) y[t]; ode2 = 
 x'[t] == 1 - q y[t] - (3 + 2 d) x[t]; ic = x[0] + y[0] == 1 

 sol[t_, d_, q_, x0_, y0_] = {x[t], y[t]} /. (First@
    Simplify[DSolve[{ode1, ode2, x[0] == x0, y[0] == y0}, {x[t], y[t]}, t]])

Then sol[t, 0.1, 0.973, 0.185, 1 - 0.185] gives:

{0.0342878 E^(-5.00005 t) (0.1 (4.79594 - 1.73663 E^(1.85411 t)) - 
4.54186 (-1 + E^(1.85411 t)) + 
0.973 (5.77198 - 5.56802 E^(1.85411 t) + 1.85411 E^(5.00005 t)) + 
2.78116 (-0.445 - 0.445 E^(1.85411 t) + 
   2 E^(5.00005 t))), -0.0342878 E^(-5.00005 t) (-0.0461897 (-1 + 
   E^(1.85411 t)) + 
0.1 (2.06376 - 9.27624 E^(1.85411 t) - 1.85411 E^(5.00005 t) + 
   0.973 (-1.37665 - 3.15665 E^(1.85411 t)) + 
   2.31475 (-1 + E^(1.85411 t))) - 
3 (0.973 (2.9561 + 0.0660979 E^(1.85411 t)) - 
   1.54317 (-1 + E^(1.85411 t)) + 
   0.927054 (1.445 + 1.445 E^(1.85411 t) + 2 E^(5.00005 t))))}

But if I put into Mathematica:

ClearAll[x, y, t]
q = .973;
d = .1;
ode1 = y'[t] == 1 - d x[t] - (3 + 2 q) y[t];
ode2 = x'[t] == 1 - q y[t] - (3 + 2 d) x[t];
ic = {x[0] == .185, y[0] == 1 - .185};
DSolve[{ode1, ode2, ic}, {x[t], y[t]}, t]

I get the output:

   {{x[t] -> 
   0.110786 E^(-8.146 t) (2.90926 E^(3.14595 t) - 
      3.51923 E^(5.00005 t) + 7.82919*10^-18 E^(6.29189 t) + 
      2.27986 E^(8.146 t) + 2.50534*10^-16 E^(10.0001 t)), 
  y[t] -> 0.204954 E^(-8.146 t) (2.90926 E^(3.14595 t) + 
      0.105679 E^(5.00005 t) + 1.69279*10^-17 E^(6.29189 t) + 
      0.961567 E^(8.146 t) - 8.46397*10^-18 E^(10.0001 t))}}

What is happening here?

$\endgroup$
  • $\begingroup$ Your solX and solY are just sol[t,0.1,0.973,0.185,1-0.185], there is no need to DSolve again and make new variables. How did you find root of solY (sol[[2]])? If you simplify sol[t,0.1,0.973,0.185,1-0.185] you will see, that the second component is a sum of damped exponents with positive coefficients, it definitely can not be equal to 0. $\endgroup$ – Alx Jul 30 at 14:10
  • $\begingroup$ That's so strange. DSolve again gave {{x[t] -> 0.110786 E^(-8.146 t) (2.90926 E^(3.14595 t) - 3.51923 E^(5.00005 t) + 7.82919*10^-18 E^(6.29189 t) + 2.27986 E^(8.146 t) + 2.50534*10^-16 E^(10.0001 t)), y[t] -> 0.204954 E^(-8.146 t) (2.90926 E^(3.14595 t) + 0.105679 E^(5.00005 t) + 1.69279*10^-17 E^(6.29189 t) + 0.961567 E^(8.146 t) - 8.46397*10^-18 E^(10.0001 t))}} while the original sol[t, 0.1, 0.973, 0.185, 1 - 0.185] gave something different. I'll update my post. $\endgroup$ – EverythingEnds Jul 30 at 14:21
  • $\begingroup$ Also, it looks like there are some points outside the graph around the t= 142 for y. Is that the case, or is it just outside the graph's range, because I am getting values between .3 and 0 when I put values for t between 140 and 160 in the equation $\endgroup$ – EverythingEnds Jul 30 at 14:31
  • $\begingroup$ Try using ParametricNDSolve, see help page. It allows one to get numerical solution with additional parameters. I have no artifacts and strange behavior with numerical solutions (NDSolve and ParametricNDSolve), they a re more stable and appropriate if you working with numerical diff. equations. $\endgroup$ – Alx Jul 30 at 15:07
  • $\begingroup$ Accidentally deleted my comment. It is possible to get stable ParametricPlot inside Manipulate if one do not use Simplify on DSolve, it seems Mathematica makes wrong assumptions then. I tried Manipulate with DSolve output "as is" (and increased PlotPoints -> 1000): perfect curve, no artifacts etc. But nevertheless numerical solutions might be more robust and speedy if you deal with numerical equations. $\endgroup$ – Alx Jul 30 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.