Qurak

Nd solve event locator limitations

Tutorial 3 Schritte, der Reihe nach in einer Sitzung ausgeführt. Jeder Schritt wurde gegen die Engine ausgeführt, und die Ausgabe unten ist, was er erzeugte.

Schritt 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]
Ausgabe
1
Schritt 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]
Ausgabe
1
Schritt 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]
Ausgabe
1

Verwendete Funktionen

Verwandte Rezepte

Alle Rezepte · Funktionsreferenz · Dies aus einem MCP-Client verwenden