Re: StoppingTest Constraints in NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg72875] Re: StoppingTest Constraints in NDSolve
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Tue, 23 Jan 2007 05:34:29 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <ep1stq$g4a$1@smc.vnet.net>
Cham wrote:
> Hi,
>
> I'm using the NDSolve operation in Mathematica, and I need to add several constraints in the StoppingTest option. How should I do this ? More specifically, I want the iteration to stop if :
>
> (x[t] - 1)^2 + y[t]^2 + z[t]^2 < 0.5
>
> and
>
> (x[t] + 2)^2 + y[t]^2 + z[t]^2 < 0.5
>
> How to tell this in the StoppingTest option ?
>
Use RuleDelayed ( :> ) to specify the conditions and a logical and ( &&
) to link both inequalities. For example,
NDSolve[ ... , ...
,StoppingTest :> (x[t] - 1)^2 + y[t]^2 + z[t]^2 <
0.5 && (x[t] + 2)^2 + y[t]^2 + z[t]^2 < 0.5]
Regards,
Jean-Marc