0

I want to plot solution region for the following ode for independent variable t=-7 to 0, and parameters,b=0.1 to 5,c=0.1 to 5, Br=0 to 4, Dr=20 to 40. The solution will not exist for every cases and want to see or split the region/points for solution of existance vs non-existance. Thanks in advance and any help will be appricated.

ClearAll["Global`*"];
t0=-7;
ode1=y'[t] == -Sin[x[t]]/y[t];

ode2=x'[t] == -Cos [x[t]] (6 Sin[x[t]] Cos[x[t]] + y[t] (b - c (1 + 3* y[t]^2)))/(2y[t]^3(b + c (y[t]^2 - 1)));

ode3=v'[t] == -(b + c(y[t]^2 - 1))/(4y[t]* Cos [x[t]]) + Sin [x[t]]/(2 *y[t]^2);

bc={x[t0]== 0, y[t0] == Br, v[t0] == Log[Dr], v[0] == 0, y[0] == 1};

sol = ParametricNDSolveValue[{ode1,ode2,ode3,bc}, {x, y, v},{t,t0, 0}, {b, c, Br, Dr}]

Michael E2
  • 235,386
  • 17
  • 334
  • 747
Dibbo123
  • 99
  • 5
  • Welcome to the Mathematica Stack Exchange. Please run a spell-checker. – Syed Sep 17 '22 at 02:26
  • You wrote independent variable t=-7 to 0 but in code you have tstar=7 Should not this be tstar=-7. Also your have first order ode in $v$ and $y$ but you specified two initial conditions for $v$ and $y$ ? And why do you have to write everything in one line to make it hard to read? Why not write each ode on one line and the ic on one line then use them in the call? Like this Mathematica graphics so you can see your own code more clearly and adjust it more easily also. – Nasser Sep 17 '22 at 02:53
  • Yes, it tsatr=-7. It's a typo. thanks for the suggestion. – Dibbo123 Sep 17 '22 at 03:28
  • You want to "d[i]vide the region" -- but what region? The four-dimensional box represented by the ranges of the parameters {b, c, Br, Dr}? Something like this, but divided up? – Michael E2 Sep 17 '22 at 20:01
  • Solutions will not exist for all cases, only very few combination of b,c,Br, Dr, and t. So it will be extriemly helpful if I could draw a region or pints where solution will exist vs non-exist. It is also possible to fix , say Dr=20 or Br=3 , then try to see soltion of existance vs non-existance. – Dibbo123 Sep 17 '22 at 20:44

1 Answers1

1

want to see or devide the region for solution of existance vs non-existance.

You could use ParametricPlot3D to see the solution as you change the parameters?

But as I mentioned above, you can not use more than one initial condition for 1st order ode. So I removed the extra ones you had.You also had v[0] == 0, y[0] == 1 but had x[t0] == 0 for some reason. But I kept these the same. I would have expected all to have same initial conditions t0 point. It is little strange to have time start from negative value to zero. Normally time starts at 0. But you can change all this.

ClearAll["Global`*"];
t0 = -7;
ode1 = y'[t] == -Sin[x[t]]/y[t];
ode2 = x'[t] == -Cos[x[t]] (6 Sin[x[t]] Cos[x[t]] + y[t] (b - c (1 + 3*y[t]^2)))/(2*y[t]^3*(b + c (y[t]^2 - 1)))
ode3 = v'[t] == -(b + c*(y[t]^2 - 1))/(4*y[t]*Cos[x[t]]) +Sin[x[t]]/(2*y[t]^2);
ic = {x[t0] == 0, v[0] == 0, y[0] == 1}

sol = ParametricNDSolveValue[{ode1, ode2, ode3, ic}, {x, y, v}, {t, t0, 0}, {b, c, Br, Dr}]

Mathematica graphics

And now do

Manipulate[
 Module[{xSol, ySol, vSol},
  xSol = sol[b0, c0, Br0, Dr0][[1]];
  ySol = sol[b0, c0, Br0, Dr0][[2]];
  vSol = sol[b0, c0, Br0, Dr0][[3]];
  ParametricPlot3D[{xSol[t], ySol[t], vSol[t]}, {t, from, 0}, 
   AxesLabel -> {"x", "y", "v"}]
  ],
 {{b0, 0.1, "b"}, 0, 5, .1, Appearance -> "Labeled"},
 {{c0, 0.1, "c"}, 0, 5, .1, Appearance -> "Labeled"},
 {{Br0, 1, "Br"}, 0, 4, .1, Appearance -> "Labeled"},
 {{Dr0, 20, "Dr"}, 20, 40, .1, Appearance -> "Labeled"},
 {{from, -7, "time?"}, -7, -0.1, .1, Appearance -> "Labeled"},
 SynchronousUpdating -> False,
 ContinuousAction->False,
 TrackedSymbols :> {b0, c0, Br0, Dr0, from}
 ]

I set SynchronousUpdating -> False so it does not Abort, as it will take few seconds for it to initialize the solution each time you change a parameter. So when you change a slider (other than time slider), you will have to wait few seconds for it to update. But not when changing the time slider. This is because Mathematica has to update the numerical solution each time when parameter changes.

enter image description here

Nasser
  • 143,286
  • 11
  • 154
  • 359
  • Thank you so much @Nasser. I really appreciate your help. Actually, I wanted to see existance of solution vs non-existance. Also, I have two more boundary conditions that needs to satify. – Dibbo123 Sep 17 '22 at 18:57