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...")
 
(command syntax: changed [ ] into ( ))
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.2}}</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|function}}
{{command|function}}
+
;NSolveODE( <List of Derivatives>, <Initial x-coordinate>, <List of Initial y-coordinates>, <Final x-coordinate> )
;NSolveODE[ <List of Derivatives>, <Initial x-coordinate>, <List of Initial y-coordinates>, <Final x-coordinate> ]
 
 
:Solves (numerically) the system of differential equations
 
:Solves (numerically) the system of differential equations
 
{{Example|1=<div>
 
{{Example|1=<div>
Line 7: Line 6:
 
:<code>g'(t, f, g, h) = h</code>
 
:<code>g'(t, f, g, h) = h</code>
 
:<code><nowiki>h'(t, f, g, h) = -t h + 3t g + 2f + t</nowiki></code>
 
:<code><nowiki>h'(t, f, g, h) = -t h + 3t g + 2f + t</nowiki></code>
:<code><nowiki>NSolveODE[{f', g', h'}, 0, {1,2,-2}, 10]</nowiki></code>
+
:<code><nowiki>NSolveODE({f', g', h'}, 0, {1,2,-2}, 10)</nowiki></code>
:<code><nowiki>NSolveODE[{f', g', h'}, 0, {1,2,-2}, -5]</nowiki></code> (solves the system backwards in time).</div>}}
+
:<code><nowiki>NSolveODE({f', g', h'}, 0, {1,2,-2}, -5)</nowiki></code> (solves the system backwards in time).</div>}}
 
{{Example|1=<div>
 
{{Example|1=<div>
 
:<code>x1'(t, x1, x2, x3, x4) = x2</code>
 
:<code>x1'(t, x1, x2, x3, x4) = x2</code>
Line 18: Line 17:
 
:<code>x30 = 1.8</code>
 
:<code>x30 = 1.8</code>
 
:<code>x40 = -1.5</code>
 
:<code>x40 = -1.5</code>
:<code>NSolveODE[{x1', x2', x3', x4'}, 0, {x10, x20, x30, x40}, 20]</code></div>}}
+
:<code>NSolveODE({x1', x2', x3', x4'}, 0, {x10, x20, x30, x40}, 20)</code></div>}}
 
{{Example|1=<div> Pendulum:
 
{{Example|1=<div> Pendulum:
 
:<code>g = 9.8</code>
 
:<code>g = 9.8</code>
Line 26: Line 25:
 
:<code>y1'(t, y1, y2) = y2</code>
 
:<code>y1'(t, y1, y2) = y2</code>
 
:<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>
:<code>StartAnimation[]</code>
+
:<code>StartAnimation()</code>
 
</div>}}
 
</div>}}
  
  
 
{{Note|1= See also [[SlopeField Command|SlopeField command]],  [[SolveODE Command|SolveODE command]].}}
 
{{Note|1= See also [[SlopeField Command|SlopeField command]],  [[SolveODE Command|SolveODE command]].}}

Latest revision as of 09:37, 9 October 2017


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