Group Abstract Group Abstract

Message Boards Message Boards

0
|
15.3K Views
|
19 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How can I write this system of differential equations so MMA can solve it?

Posted 11 years ago

I am trying to solve a system of nonlinear differential equations, which I set up with the following code:

B = {{(Subscript[p, 0] - Subscript[q, 0])*(Subscript[v, 
       0]/(1 + Subscript[\[Beta], 0] ((Subscript[x, 2][t])^2))) - 
    Subscript[d, 0], 0, 
   0}, {(1 - Subscript[p, 0] + Subscript[q, 0])*(Subscript[v, 
      0]/(1 + Subscript[\[Beta], 
         0] ((Subscript[x, 2][t])^2))), (Subscript[p, 1] - Subscript[
       q, 1])*(Subscript[v, 
       1]/(1 + Subscript[\[Beta], 1] ((Subscript[x, 2][t])^2))) - 
    Subscript[d, 1], 
   0}, {0, (1 - Subscript[p, 1] + Subscript[q, 1])*(Subscript[v, 
      1]/(1 + Subscript[\[Beta], 
         1] ((Subscript[x, 2][t])^2))), -Subscript[d, 2]}}


    X[t_] = {Subscript[x, 0][t], Subscript[x, 1][t], Subscript[x, 2][t]};
    systemB = X'[t] == B.X[t]

solB = DSolve[
  systemB, {Subscript[x, 0], Subscript[x, 1], Subscript[x, 2]}, t]

This code returns the exact input, which from my research means that it cannot be solved or takes too long to solve. I spoke to someone who wrote a paper including this equation and he said Mathematica should be able to solve it. Am I writing it incorrectly? Even with the initial conditions

Subscript[x, 1][ 0] == 0, Subscript[x, 2][ 0] == 0

I can't seem to get it to work.

Any help would be great!

POSTED BY: c bro
19 Replies
Posted 11 years ago

Hi Otto and Pat, and thanks to both of you.

Otto; Sorry I didn't comment on (t-tau) -- you are of course quite correct -- it takes the equation into troubled waters. I skipped over it no doubt because the form CBro was using did not include the delay (another papers did not) -- but it was still a nonlinear system for which I suspected no closed form solution exists. I have to admit that I did not read the material in depth, thinking to comment only on the Mathematica aspects.

And thanks, Pat -- I have not used delays in diffeqs before. I knew generally that the capability exists, but I will look into it.

I don't know if Carolyn is still following this discussion, but I hope she rejoins it.

Best, David

POSTED BY: David Keith
Posted 11 years ago

The supplementary information from the paper, points to delay differential equations, NDSolve has this capability, although you must specify the delay explicitly (See the help section). The delays are a convenient way to capture processes that take place outside of the scope of the normal evolution process. In theory you could replace these with a full model of the delayed process, however you would have to solve your model over multiple time-scales.

POSTED BY: Pat Mac

Dave,

If it is more complicated that in the paper, then it is really complicated. I would settle for a good numerical solution.

I am not sure you understood my point: I was questioning whether the thing was a differential equation at all (linear or not). Once the behavior of your system depends on the value of some quantity some finite time ago, you lose locality in time. It may not be a differential equation even if it looks like one. For example, dx/dt = x(x(t)) is not a differential equation.

That may seem like a pedantic formality, but the reason I point it out is that if the thing is really not a differential equation, then most likely the approaches built into Mathematica do not work. Of course, there is always hope for a numerical approach.

As for Pittsburgh, what can I say, know I know two David Keiths. I am sure Vancouver is no worse...

OL

POSTED BY: Otto Linsuain
Posted 11 years ago

Hi Otto,

Carolyn and I have continued this discussion off-line. And her model is in fact even more complicated than that in the paper she referenced. Mathematica can of course solve systems of linear ODEs. And it does provide solutions to quite a few nonlinear ODEs. But in my experience, most nonlinear ODE's do not have closed form solutions, Numerical methods are required. I am not surprised to find it does not solve a nonlinear system. (That is not to say there is no closed form solution, but I am lazy enough to accept its null response for evidence of that.) As to Pittsburgh -- It must be another me -- I've been a West Coast guy all my life, currently in Vancouver WA.

Kind regards, David

POSTED BY: David Keith

Hello Carolyn and David,

This looks like a really tough problem. I just saw this today and took a look at the paper, so I have not tried to solve it yet.

I have to say that if Mathematica cannot solve a differential equation symbolically, then you would be hard pressed to find another program that could. Not trying to say that Mathematica is the best thing ever (although I do think it is quite impressive), it is just that not many programs are good at symbolic manipulations. I recall sitting through a presentation about a MAPLE tool-bench that couples to MATLAB. They were discussing symbolic solution of differential equations in the context of space probe design or the like. You may want to check that. Unfortunately I do not have references handy.

I think part of the reason your problem becomes so hard is that when you introduce the functions evaluated at a different time in the right-hand side (x2(t-tau)), then strictly speaking you probably no longer have a differential equation (not any equation with derivatives in it is a differential equation). I will try to take a look when I have a chance, but it looks like a symbolic solution would be very hard.

I agree with David on the subscripts. They are nice to display results in elegant forms. I have spent hours chasing illogical results which at the end turn out to be a mess-up with a subscripted variable.

A separate question for David, did you use to live in Pittsburgh? It just so happens that I know a David Keith...

Best,

OL.

POSTED BY: Otto Linsuain
Posted 11 years ago

Thank you!

POSTED BY: c bro
Posted 11 years ago

And here is a numerical solution for your nonlinear system, with made up parameter values. When forming systemB, I used Thread so equations would be formatted individually, so they could be joined with the initial conditions. I also attach the notebook.

In[1]:= B = {{(p0 - q0)*(v0/(1 + \[Beta]0 ((x2[t])^2))) - d0, 0, 
   0}, {(1 - p0 + 
      q0)*(v0/(1 + \[Beta]0 ((x2[t])^2))), (p1 - 
       q1)*(v1/(1 + \[Beta]1 ((x2[t])^2))) - d1, 
   0}, {0, (1 - p1 + q1)*(v1/(1 + \[Beta]1 ((x2[t])^2))), -d2}}

Out[1]= {{-d0 + ((p0 - q0) v0)/(1 + \[Beta]0 x2[t]^2), 0, 
  0}, {((1 - p0 + q0) v0)/(
  1 + \[Beta]0 x2[t]^2), -d1 + ((p1 - q1) v1)/(1 + \[Beta]1 x2[t]^2), 
  0}, {0, ((1 - p1 + q1) v1)/(1 + \[Beta]1 x2[t]^2), -d2}}

In[2]:= initB = {x0[0] == x00, x1[0] == x10, x2[0] == x20};

In[12]:= X[t_] = {x0[t], x1[t], x2[t]};

In[13]:= systemB = Thread[X'[t] == B.X[t]];

In[14]:= equations = Join[systemB, initB];

In[7]:= par = {q0 -> .5, q1 -> .5, v0 -> 1, v1 -> 1, x00 -> 100, 
   x10 -> 0, x20 -> 0, p0 -> .5, p1 -> .4, p2 -> .5, d0 -> .2, 
   d1 -> .3, d2 -> .4, \[Beta]0 -> 1, \[Beta]1 -> 1};

In[8]:= equations /. par

Out[8]= {Derivative[1][x0][t] == -0.2 x0[t], 
 Derivative[1][x1][t] == (1. x0[t])/(1 + x2[t]^2) + 
   x1[t] (-0.3 - 0.1/(1 + x2[t]^2)), 
 Derivative[1][x2][t] == -0.4 x2[t] + (1.1 x1[t])/(1 + x2[t]^2), 
 x0[0] == 100, x1[0] == 0, x2[0] == 0}

In[15]:= {fx0, fx1, fx2} = 
  NDSolveValue[equations /. par, {x0, x1, x2}, {t, 0, 100}];

In[17]:= LogPlot[{fx0[t], fx1[t], fx2[t]}, {t, 0, 100}, 
 PlotLegends -> {"x0", "x1", "x2"}, PlotTheme -> "Scientific", 
 FrameLabel -> {"Time(s)", "Concentration"}]

enter image description here

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard
Be respectful. Review our Community Guidelines to understand your role and responsibilities. Community Terms of Use