Re: Discrete Event handling in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg68029] Re: Discrete Event handling in Mathematica
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Fri, 21 Jul 2006 05:37:14 -0400 (EDT)
- Organization: Uni Leipzig
- References: <e9nl3f$a0k$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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
|