       Using "EventLocator" with NDSolve

• To: mathgroup at smc.vnet.net
• Subject: [mg126008] Using "EventLocator" with NDSolve
• From: Jason <jasonhsteffen at gmail.com>
• Date: Fri, 13 Apr 2012 04:43:40 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```I'm trying to use "EventLocator" to find the zeros of an ODE.  Prior
to doing so I generate the equations in the form

y[t] == rhs
y[t] == rhs
etc.

This format is suggested in the mathematica documentation
(Generalizations & Extensions http://reference.wolfram.com/mathematica/ref/NDSolve.html)

Unfortunately, for some reason I can't get the eventlocator method to
work when the equations are written in this format.  Below are three
examples, the first two work, and the third (the above format) does
not.  I get the error message "The value of the event function at t =
0.0002... was not a real number. ..."

NDSolve[{y''[t] + Sin[y[t]] == 0, y' == 0, y == 1},  y, {t, 0,
10}, Method -> {"EventLocator", "Event" -> y[t],  "EventAction" :>
Print[t]}];

NDSolve[{Subscript[y, 1]''[t] + Sin[Subscript[y, 1][t]] == 0,
Subscript[y, 1]' == 0, Subscript[y, 1] == 1}, Subscript[y, 1],
{t, 0, 10}, Method -> {"EventLocator", "Event" -> Subscript[y, 1][t],
"EventAction" :> Print[t]}];

NDSolve[{y''[t] + Sin[y[t]] == 0, y' == 0, y == 1},
y, {t, 0, 10}, Method -> {"EventLocator", "Event" -> y[t],
"EventAction" :> Print[t]}];

Any suggestions?

```

• Prev by Date: Re: troublesome integral
• Next by Date: Re: Frameless Window in Manipulate
• Previous by thread: Re: What characters are allowed in mathematica variable names? i.e. how
• Next by thread: Re: Deleting expressions containing a certain head, and a plea for Esc-fn-Esc