Difference between revisions of "NSolveODE Command"

From GeoGebra Manual
Jump to: navigation, search
(Created page with "<noinclude>{{Manual Page|version=4.2}}</noinclude> {{command|function}} ;NSolveODE[ <List of Derivatives>, <Initial x-coordinate>, <List of Initial y-coordinates>, <Final x-co...")
 
Line 27: Line 27:
 
:<code>y2'(t, y1, y2) = (-g) / l sin(y1) </code>
 
:<code>y2'(t, y1, y2) = (-g) / l sin(y1) </code>
 
:<code>NSolveODE[{y1', y2'}, 0, {a, b}, 20] </code>
 
:<code>NSolveODE[{y1', y2'}, 0, {a, b}, 20] </code>
:<code>len = Length[numericalIntegral1_1] </code>
+
:<code>len = Length[numericalIntegral1] </code>
 
:<code>c = Slider[0, 1, 1 / len, 1, 100, false, true, true, false] </code>
 
:<code>c = Slider[0, 1, 1 / len, 1, 100, false, true, true, false] </code>
:<code>x1 = l sin(y(Point[numericalIntegral1_1, c])) </code>
+
:<code>x1 = l sin(y(Point[numericalIntegral1, c])) </code>
:<code>y1 = -l cos(y(Point[numericalIntegral1_1, c])) </code>
+
:<code>y1 = -l cos(y(Point[numericalIntegral1, c])) </code>
 
:<code>A = (x1, y1) </code>
 
:<code>A = (x1, y1) </code>
 
:<code>Segment[(0, 0), A]</code>
 
:<code>Segment[(0, 0), A]</code>

Revision as of 10:24, 31 October 2014



NSolveODE[ <List of Derivatives>, <Initial x-coordinate>, <List of Initial y-coordinates>, <Final x-coordinate> ]
Solves (numerically) the system of differential equations
Example:
f'(t, f, g, h) = g
g'(t, f, g, h) = h
h'(t, f, g, h) = -t h + 3t g + 2f + t
NSolveODE[{f', g', h'}, 0, {1,2,-2}, 10]
NSolveODE[{f', g', h'}, 0, {1,2,-2}, -5] (solves the system backwards in time).
Example:
x1'(t, x1, x2, x3, x4) = x2
x2'(t, x1, x2, x3, x4) = x3
x3'(t, x1, x2, x3, x4) = x4
x4'(t, x1, x2, x3, x4) = -8x1 + sin(t) x2 - 3x3 + t^2
x10 = -0.4
x20 = -0.3
x30 = 1.8
x40 = -1.5
NSolveODE[{x1', x2', x3', x4'}, 0, {x10, x20, x30, x40}, 20]
Example:
Pendulum:
g = 9.8
l = 2
a = 5 (starting location)
b = 3 (starting force)
y1'(t, y1, y2) = y2
y2'(t, y1, y2) = (-g) / l sin(y1)
NSolveODE[{y1', y2'}, 0, {a, b}, 20]
len = Length[numericalIntegral1]
c = Slider[0, 1, 1 / len, 1, 100, false, true, true, false]
x1 = l sin(y(Point[numericalIntegral1, c]))
y1 = -l cos(y(Point[numericalIntegral1, c]))
A = (x1, y1)
Segment[(0, 0), A]
StartAnimation[]


© 2024 International GeoGebra Institute