Qurak

Nd solve event locator limitations

Tutorial 3 steps, run in order in one session. Every step was executed against the engine and the output below is what it produced.

Step 1
Block[{n = 0}, NDSolve[{y'[t] == y[t], y[-1] == E^-1}, y, {t, 5}, Method -> {"EventLocator", "Event" -> Sin[π y[t]], "EventAction" :> n++}];n]
Output
1
Step 2
Block[{n = 0}, NDSolve[{y'[t] == y[t], y[-1] == E^-1}, y, {t, 5}, Method -> {"EventLocator", "Event" -> Sin[π y[t]], "EventAction" :> n++}, MaxStepSize -> 0.001];n]
Output
1
Step 3
Block[{n = 0}, NDSolve[{y'[t] == y[t], y[-1] == E^-1, z'[t] == D[Sin[π y[t]], t], z[-1] == Sin[π E^-1]}, {y, z}, {t, 10}, Method -> {"EventLocator", "Event" -> z[t], "EventAction" :> n++}, MaxSteps -> ∞];n]
Output
1

Functions used

Related recipes

All recipes · Function reference · Use this from an MCP client