Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: System of differential equations
Replies: 2   Last Post: Dec 7, 2012 1:37 AM

 Messages: [ Previous | Next ]
 Nasser Abbasi Posts: 6,677 Registered: 2/7/05
Re: System of differential equations
Posted: Dec 7, 2012 1:37 AM

On 12/6/2012 3:56 AM, hazem.abdelhafiz@gmail.com wrote:
> Dear all,
> I want to solve this system of equations but I always get an error
>
> NDSolve::ndnum:Encountered non-numerical value for a derivative at t==0
>
> can any one help me on this
>
> s=NDSolve[{
> ph1''[t]+ph1'[t]+sin[ph1[t]]-mu[t]-mu'[t]==0.005,
> ph2''[t]+ph2'[t]+sin[ph2[t]]+mu[t]+mu'[t]==0.005,
> 0.2mu'[t]+mu[t]==ph1'[t]-ph2'[t],
> ph2[0]==0,
> ph1[0]==0,
> ph2'[0]==0,
> ph1'[0]==0,
> mu[0]==0
> },
> {ph1[t],ph2[t],mu[t]},
> {t,0,5000}
> ]
>

It is Sin[] not sin[]. Mathematica is Case Sensitive.
It is better to write things in more lines than one so
it is easier to read and modify.

--------------------------
eq1 = ph1''[t] + ph1'[t] + Sin[ph1[t]] - mu[t] - mu'[t] == 0.005;
eq2 = ph2''[t] + ph2'[t] + Sin[ph2[t]] + mu[t] + mu'[t] == 0.005;
eq3 = 0.2 mu'[t] + mu[t] == ph1'[t] - ph2'[t];
ic = {ph2[0] == 0, ph1[0] == 0, ph2'[0] == 0, ph1'[0] == 0,mu[0] == 0};
s = NDSolve[Flatten@{eq1, eq2, eq3, ic},
{ph1[t], ph2[t], mu[t]}, {t, 0.01,5000}]
--------------------------------

{{ph1[t] -> InterpolatingFunction[][t],
ph2[t] -> InterpolatingFunction[][t],
mu[t] -> InterpolatingFunction[][t]}}

From the warning messages I see, this looks like a stiff system,
you might want to look into using options to handle this.

--Nasser

Date Subject Author
12/6/12 hazem.abdelhafiz@gmail.com
12/7/12 Nasser Abbasi
12/7/12 stephen.p.luttrell@gmail.com