       NDSolve with a constraint : how ?

• To: mathgroup at smc.vnet.net
• Subject: [mg72477] NDSolve with a constraint : how ?
• From: Cham <martin465 at sympatico.ca>
• Date: Sun, 31 Dec 2006 05:19:03 -0500 (EST)

```I need to find a proper way to solve an equation with the NDSolve operation.  I'm looking for a solution { x[ t ], y[ t ], z[ t ] } which should obey some constraint (the initial conditions { x, y, z } are not well known and I only have some very approximate values).  How should I do this ?

More specifically, I'm using a simple code like this :

NDSolve[
{
x'[t] == Fx[ x[t], y[t], z[t] ],
y'[t] == Fy[ x[t], y[t], z[t] ],
z'[t] == Fz[ x[t], y[t], z[t] ],

x == x0,
y == y0,
z == z0
},

{x, y, z}, {t, 0, 100}
]

Mathematica then finds easily a solution.  But the solution I'm looking for must obey a constraint, and the inital conditions {x0, y0, z0} aren't well known.  I need to find the initial values {x0, y0, z0} for which the horizontal distance is the closest to some constant, for an unknown "t" :

rho = Sqrt[x[t]^2 + y[t]^2] = cste,   for some unknown "t".

How can I program Mathematica so it could find the right set of numbers {x0, y0, z0} ?

For the moment, all I can do is find a solution from some approximate values {x0, y0, z0}, then check by trial and errors if there's a "t" which gives rho = ctse (approximately).  If not, I have to use the NDSolve again, and again (changing a bit the inital values after each trial), until it works.  This can be very long, especially since I don't know what value of "t" will satisfy the constraint.

Any better idea ?

```

• Prev by Date: Re: programming problem about elements taken
• Next by Date: Re: regularize a function (proof function)
• Previous by thread: Troubleshooting Mathematic's Help
• Next by thread: Minimization with constraint expresses as CDF[] >=