Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #12661 > unrolled thread
| Started by | hazem.abdelhafiz@gmail.com |
|---|---|
| First post | 2012-12-06 09:56 +0000 |
| Last post | 2012-12-07 06:37 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
System of differential equations hazem.abdelhafiz@gmail.com - 2012-12-06 09:56 +0000
Re: System of differential equations "Nasser M. Abbasi" <nma@12000.org> - 2012-12-07 06:37 +0000
Re: System of differential equations stephen.p.luttrell@gmail.com - 2012-12-07 06:37 +0000
| From | hazem.abdelhafiz@gmail.com |
|---|---|
| Date | 2012-12-06 09:56 +0000 |
| Subject | System of differential equations |
| Message-ID | <k9pq4e$hnp$1@smc.vnet.net> |
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}
]
thanks in advance,
[toc] | [next] | [standalone]
| From | "Nasser M. Abbasi" <nma@12000.org> |
|---|---|
| Date | 2012-12-07 06:37 +0000 |
| Message-ID | <k9s2r0$mom$1@smc.vnet.net> |
| In reply to | #12661 |
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.
see NDSolve documentation for more information on this.
--Nasser
[toc] | [prev] | [next] | [standalone]
| From | stephen.p.luttrell@gmail.com |
|---|---|
| Date | 2012-12-07 06:37 +0000 |
| Message-ID | <k9s2rb$mou$1@smc.vnet.net> |
| In reply to | #12661 |
I found that converting your input cell to TraditionalForm and then back again to StandardForm - thus causing the terms in the differential equations to be reorganised - made NDSolve work though you now get a "NDSolve::mxst: Maximum number of 10000 steps reached ..." warning message.
Stephen Luttrell
West Malvern, UK
On Thursday, 6 December 2012 09:56:30 UTC, hazem.ab...@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}
>
> ]
>
>
>
> thanks in advance,
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web