NDSolve -- how to impose constrint on function
- To: mathgroup at smc.vnet.net
- Subject: [mg103982] NDSolve -- how to impose constrint on function
- From: Dilip <dpa1951 at gmail.com>
- Date: Wed, 14 Oct 2009 07:57:33 -0400 (EDT)
Hi!
I wish to put constraint on function x[t] while solving it using
NDSolve -- let me explain through an example:
Consider differential equation
x'[t]=2.0
with the initial condition
x[0]=0.1
If we solve this using NDSolve,
soln=NDSolve[{x'[t]==2.0,x[0]==0.1},x[t],{t,tMin,tMax}]
for some given values of tMin, tMax
then the solution x[t] grows monotonically to larger and larger
values.
However I am interested in Mod[x[t],2*Pi] values only.
One way is to solve for x[t] (letting x[t] grow) and then use Mod on x
[t] -- however sometimes x[t] grows to extremely large values that
gives numerical errors.
Question: How do I put condition in NDSolve that it solves a function x
[t] such that it uses Mod[x[t],2*Pi] values as it solves?
Thanks ...
Dr. Dilip Ahalpara