Re: Discrete Event handling in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg68065] Re: Discrete Event handling in Mathematica
- From: "Raj" <rajanikanth at gmail.com>
- Date: Fri, 21 Jul 2006 17:36:01 -0400 (EDT)
- References: <e9nl3f$a0k$1@smc.vnet.net><e9q8qh$7g2$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thanks for your reply. The code which you wrote figures out the first event and doesnt detect the other events...could you tell me if there is a way to print tl and \[Theta]l "everytime" the event condition is satisfied. In the "EventAction" part, can I actually change the values of tl and \[Theta]l so that the "updated" values are used to detect the "Event" condition? Thanks, Raj Jens-Peer Kuska wrote: > Hi, > > do you mean > > Clear[\[Theta], \[Theta]l, tl] > \[Theta]l = Sin[0.5] > tl = 0; > Reap[NDSolve[{\[Theta]'[t] == Sin[\[Theta][t]], > \[Theta][0] == > 0.5}, \[Theta], {t, 0, 100}, > Method -> {EventLocator, "Event" -> \[Theta]l (t - > tl) - 0.01, > "EventAction" :> (Print["t1= ", t, " > Sin[\[Theta]]= ", > Sin[\[Theta][t]]]Sow[{t1 = t, \[Theta]1 = > Sin[\[Theta][t]]}])}]] > > ?? > > Regards > > Jens > > "Raj" <rajanikanth at gmail.com> schrieb im > Newsbeitrag news:e9nl3f$a0k$1 at smc.vnet.net... > | Hi! > | > | Could somebody tell me if Mathematica can handle > discrete events in > | Ordinary Differential Equations. > | > | For example in the following code > | > | Clear[\[Theta], \[Theta]l, tl] > | \[Theta]l = Sin[0.5] > | tl = 0; > | Reap[NDSolve[{\[Theta]'[t] == Sin[\[Theta][t]], > \[Theta][0] == > | 0.5}, \[Theta], {t, 0, 100}, > | Method -> {EventLocator, "Event" -> \[Theta]l > (t - tl) - 0.01, > | "EventAction" :> Sow[{tl = t, \[Theta]l = > Sin[\[Theta][t]]}]}]] > | > | I want Mathematica to print out tl and \[Theta]l > everytime the "Event" > | condition is met. > | > | Thanks, > | > | Raj > |