MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NDSolve and DAEs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124613] Re: NDSolve and DAEs
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Thu, 26 Jan 2012 03:30:58 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201201251204.HAA05991@smc.vnet.net>

eqns = {
   x1'[t] == x2[t],
   x2'[t] == -x3[t] - x2[t],
   x3'[t] == x2[t] x4[t],
   x4'[t] == -x3[t] x2[t]};

ics = {x1[0] == 0.5, x2[0] == 0,
   x3[0] == Sin[0.5], x4[0] == Cos[0.5]};

sol = NDSolve[Join[eqns, ics], {x1, x2, x3, x4}, {t, 0, 16}][[1]];

x3[0] x3[0] + x4[0] x4[0] == 1 /. sol

True

Plot[Evaluate[{
    Tooltip[x1[t], "x1"],
    Tooltip[x2[t], "x2"],
    Tooltip[x3[t], "x3"],
    Tooltip[x4[t], "x4"]} /. sol],
 {t, 0, 16}]


Bob Hanlon


2012/1/25 J. Jes=FAs Rico Melgoza <jerico at umich.mx>:
> Hi everybody!
>
> I have the following DAE system:
>
> eqns = {x1'[t] == x2[t], x2'[t] == -x3[t] - x2[t],
>                                     
 x3'[t] == x2[t] x4[t],
>                                     
 x4'[t] == -x3[t] x2[t]}
> with initial conditions
>
> ics = {x1[0] == 0.5, x2[0] == 0, x3[0] == Sin[0.5],
>                                     
   x4[0] == Cos[0.5]}
> that must satisfy the following constraint
>
> x3[0]x3[0]+x4[0]x4[0]=1
> The interval of time is {t,0,16}.
>
> I do not know how to do it with NDSolve.
> Can this be done? in some part of the documentation there is an example
> where the enqs are linear but the same procedure applied to my problem
> (nonlinear) wouldn't work.
>
> I will appreciate any help.
> Thanks in advance.
>
> Best regards
> Jesus Rico-Melgoza
>



  • Prev by Date: Re: calculating with vectors of variable length
  • Next by Date: Re: Mathematica 8 + OS X + McAfee = trouble; help?
  • Previous by thread: NDSolve and DAEs
  • Next by thread: Re: NDSolve and DAEs