Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8146 > unrolled thread

NDSolve and DAEs

Started byJ. Jesús Rico Melgoza <jerico@umich.mx>
First post2012-01-25 12:07 +0000
Last post2012-01-27 11:18 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  NDSolve and DAEs J. Jesús Rico Melgoza <jerico@umich.mx> - 2012-01-25 12:07 +0000
    Re: NDSolve and DAEs danl@wolfram.com - 2012-01-26 08:32 +0000
    Re: NDSolve and DAEs "J. Jesús Rico Melgoza" <jerico@umich.mx> - 2012-01-27 11:18 +0000

#8146 — NDSolve and DAEs

FromJ. Jesús Rico Melgoza <jerico@umich.mx>
Date2012-01-25 12:07 +0000
SubjectNDSolve and DAEs
Message-ID<jforak$5v4$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#8185

Fromdanl@wolfram.com
Date2012-01-26 08:32 +0000
Message-ID<jfr323$njd$1@smc.vnet.net>
In reply to#8146
What you show is not a DAE. Even if you correctly state the invariant as x3[t]^2 + x4[t]^2, it can still be regarded as an ODE system because it is fully determined by the DEs and ICs. So you can solve it directly via

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

That said, when an invariant exists it does make sense to have NDSolve enforce it. Otherwise one can get drift off the invariant manifold. This enforcing can be done via the Projection method.

solP = NDSolve[
  Join[eqns, ics], {x1[t], x2[t], x3[t], x4[t]}, {t, 0, 16}, 
  Method -> {Projection, "Invariants" -> x3[t]^2 + x4[t]^2}]

For further detail you might check Help > DocumentationCenter >
tutorial/NDSolveIntroductoryTutorialDAEs

Daniel Lichtblau
Wolfram Research

[toc] | [prev] | [next] | [standalone]


#8215

From"J. Jesús Rico Melgoza" <jerico@umich.mx>
Date2012-01-27 11:18 +0000
Message-ID<jfu160$cc5$1@smc.vnet.net>
In reply to#8146
Thanks Daniel
In the answer of Bob I realized that I have made a mistake in the 
constraint. The invariant is indeed x3[t]^2 + x4[t]^2, I apologize for this.
The second part of your message helps a lot since in my analysis I do have to enforce some invariants!.

Thanks.

J. Rico-Melgoza

El 26/01/2012, a las 02:29, danl@wolfram.com escribi=F3:

> What you show is not a DAE. Even if you correctly state the invariant as x3[t]^2 + x4[t]^2, it can still be regarded as an ODE system because it is fully determined by the DEs and ICs. So you can solve it directly via
>
> sol = NDSolve[
>  Join[eqns, ics], {x1[t], x2[t], x3[t], x4[t]}, {t, 0, 16}]
>
> That said, when an invariant exists it does make sense to have NDSolve enforce it. Otherwise one can get drift off the invariant manifold. This enforcing can be done via the Projection method.
>
> solP = NDSolve[
>  Join[eqns, ics], {x1[t], x2[t], x3[t], x4[t]}, {t, 0, 16},
>  Method -> {Projection, "Invariants" -> x3[t]^2 + x4[t]^2}]
>
> For further detail you might check Help > DocumentationCenter >
> tutorial/NDSolveIntroductoryTutorialDAEs
>
> Daniel Lichtblau
> Wolfram Research
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web