3
$\begingroup$

I am new to Mathematica. Trying to solve the below coupled-ODEs (eqnA, eqnB, eqnC). However, getting error NDSolve::ndsz: At x == 0.8849324488967629`, step size is effectively zero; singularity or stiff system suspected. Referring to other related posts, tried solutions like changing the method to StiffnessSwitching, and other options like WorkingPrecision, etc, but nothing is working.

g  = 5/3;
eqnA = (y2[x]-x)x y1'[x] + (x y2'[x]+ y2[x])y1[x] == 0;
eqnB= -3/2  y1[x]y2[x]  + (y2[x] - x)y1[x]y2'[x] + y3'[x] == 0;
eqnC = -3 y1[x] y3[x] + (y2[x] - x)(y1[x]y3'[x] - g y3[x] y1'[x] )== 0;
sol=NDSolve[{eqnA,eqnB, eqnC,y1[1]== (g+1)/(g-1),y2[1]== 2/(g+1), y3[1] == 2/(g+1)},{y1,y2,y3},{x,0,1}];
Plot[Evaluate[{y1[x],y2[x],y3[x]}/.sol[[1]]],{x,0,1}]

Expecting a plot somewhat like this.

enter image description here

$\endgroup$
14
  • $\begingroup$ Solving for the derivatives shows that they become singular when 2 x (3 x^2 y1[x] - 6 x y1[x] y2[x] + 3 y1[x] y2[x]^2 - 5 y3[x]) vanishes. Check whether this is the cause of the integration stopping. $\endgroup$
    – bbgodfrey
    Nov 19, 2021 at 21:06
  • 1
    $\begingroup$ I just checked, and that is exactly what is happening. This is a math issue, not a Mathematica issue. $\endgroup$
    – bbgodfrey
    Nov 19, 2021 at 21:15
  • $\begingroup$ @bbgodfrey Ok! But how we can solve this problem? $\endgroup$ Nov 20, 2021 at 4:39
  • $\begingroup$ @twilight Is there exact solution you shown? $\endgroup$ Nov 20, 2021 at 6:30
  • 1
    $\begingroup$ The coefficients of the ODEs weren't right. When I solved them again, I got the right coefficients and the desired plot using them. Your comments have been more than helpful. Thank you very much. $\endgroup$
    – twilight
    Dec 1, 2021 at 20:05

0

Browse other questions tagged or ask your own question.