Message Boards Message Boards

GROUPS:

How to manipulate the initial values (initial conditios) in a ODE system?

Posted 6 years ago
3572 Views
|
2 Replies
|
1 Total Likes
|

Hi Everybody, I have a construction with manipulate, is an Ordinary Diffrenetial Equations System, and I would like to manipulate the initial values like I did with the parameters, but really I do not Know how. I mean, actually I have this:

Yb[0] == 0.1, Su[0] == 15, Pro[0] == 0.01, Eta[0] == 0.36, 
Cox[0] == 0.007

but I want to chance dinamically this values like:

Yb[0] == Yb0, Su[0] == Su0, Pro[0] == Pro0, Eta[0] == Eta0, 
Cox[0] == Cox0

Somebody that can give me an idea?

Thankyou.

Best regards. Ricardo Sánchez

Attachments:
POSTED BY: Ricardo Sánchez
2 Replies

The way you have writen Gompetz, it does not get updated when you change the initial data. One way to solve the problem is to use With inside Manipulate, as in

Manipulate[
 With[{sol = 
    NDSolveValue[{x'[t] == x[t], x[0] == x0}, x, {t, 0, 1}]},
  Plot[sol[t], {t, 0, 1}, PlotRange -> {-E, E}]],
 {x0, -1, 1}]

Alternatively, you can indicate explicitly the parameters when you define the solution, as in

sol[x1_] := 
  sol[x1] = NDSolveValue[{x'[t] == x[t], x[0] == x1}, x, {t, 0, 1}];
Manipulate[
 Plot[sol[x0][t], {t, 0, 1}, PlotRange -> {-E, E}],
 {x0, -1, 1}]

so that sol[x1] does get updated when you change x1.

POSTED BY: Gianluca Gorni

Hi, thank you for yor answer, I will try it, and i will tell you what happened. best Regards!

POSTED BY: Ricardo Sánchez
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract