Difference between revisions of "SolveODE Command"

From GeoGebra Manual
Jump to: navigation, search
(command syntax: changed [ ] into ( ))
 
(23 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.0}}</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|cas=true|function}}
{{command|cas=true|function}}
+
;SolveODE( <f'(x, y)> )
;SolveODE[ <f'(x,y)>, <Start x>, <Start y>, <End x>, <Step> ]
+
:Attempts to find the exact solution of the first order ordinary differential equation (ODE) <math>\frac{dy}{dx}(x)=f'(x, y(x))</math>.
:Solves first order ordinary differential equations (ODE) <math>\frac{dy}{dx}=f'(x,y)</math> numerically given start point and end & step for ''x''.
+
:{{example| 1=<code><nowiki>SolveODE(2x / y)</nowiki></code> yields ''<math>\sqrt{2}  \sqrt{-c_{1}+x^{2}}</math>'', where <math>c_{1}</math> is a constant.}}
:For example to solve <math>\frac{dy}{dx}=-xy</math>  using ''A'' as a starting point, enter SolveOde[-x*y, x(A), y(A), 5, 0.1]
+
:{{note|<math>c_{1}</math> will be created as an auxiliary object with a corresponding slider.}}
:{{note| 1=[[Length Command|Length]][ <Locus> ] allows you to find out how many points are in the computed locus and [[First Command|First]][ <Locus>, <Number> ] allows you to extract the points as a list, for example First[loc1, Length[loc1]].}}
+
;SolveODE( <f'(x, y)>, <Point on f> )
;SolveODE[ <f(x,y)>, <g(x,y)>, <Start x>, <Start y>, <End t>, <Step> ]
+
:Attempts to find the exact solution of the first order ODE <math>\frac{dy}{dx}(x)=f'(x, y(x))</math> and use the solution which goes through the given point.
:Solves first order ODE <math>\frac{dy}{dx}=\frac{f(x,y)}{g(x,y)}</math> given start point, maximal value of an internal parameter ''t'' and step for ''t''. This version of the command may work where the first one fails eg when the solution curve has vertical points.
+
:{{example| 1=<code><nowiki>SolveODE(y / x, (1, 2))</nowiki></code> yields ''y = 2x''.}}
:For example, to solve <math>\frac{dy}{dx}=- \frac{x}{y} </math> using ''A'' as a starting point, enter SolveOde[-x, y, x(A), y(A), 5, 0.1].
+
;SolveODE( <f'(x, y)>, <Start x>, <Start y>, <End x>, <Step> )
;SolveODE[ &lt;b(x)>, &lt;c(x)>, &lt;f(x)>, &lt;Start x>, &lt;Start y>, &lt;Start y'>, &lt;End x>, &lt;Step>]
+
:Solves first order ODE <math>\frac{dy}{dx}=f'(x, y)</math> numerically with given start point, end and step for ''x''.
:Solves second order ODE <math>y''+b(x)y'+c(x)y=f(x)</math>.
+
:{{example|1=<code>SolveODE(-x*y, x(A), y(A), 5, 0.1)</code> solves <math>\frac{dy}{dx}=-xy</math>  using previously defined ''A'' as a starting point.}}
:{{note| 1=Always returns the result as locus. The algorithms are currently based on Runge-Kutta numeric methods.}}
+
:{{note| 1=
 +
:*[[Length Command|Length]]( <Locus> ) allows you to find out how many points are in the computed locus.
 +
:*[[First Command|First]]( <Locus>, <Number> ) allows you to extract the points as a list.
 +
:*To find the "reverse" solution, just enter a negative value for ''End x'', for example <code>SolveODE(-x*y, x(A), y(A), -5, 0.1)</code>}}
 +
;SolveODE( <y'>, <x'>, <Start x>, <Start y>, <End t>, <Step> )
 +
:Solves first order ODE <math>\frac{dy}{dx}=\frac{f(x, y)}{g(x, y)}</math> with given start point, maximal value of an internal parameter ''t'' and step for ''t''. This version of the command may work where the first one fails e.g. when the solution curve has vertical points.
 +
:{{example|1=<code>SolveODE(-x, y, x(A), y(A), 5, 0.1)</code> solves <math>\frac{dy}{dx}=- \frac{x}{y} </math> using previously defined ''A'' as a starting point.}}
 +
:{{note| 1=To find the "reverse" solution, just enter a negative value for ''End t'', for example <code>SolveODE(-x, y, x(A), y(A), -5, 0.1)</code>.}}
 +
;SolveODE( &lt;b(x)>, <c(x)>, <f(x)>, <Start x>, <Start y>, <Start y'>, <End x>, <Step> )
 +
:Solves second order ODE <math>y'' + b(x) y' + c(x) y = f(x)</math>.
 +
:{{example|1=<code>SolveODE(x^2, 2x, 2x^2 + x, x(A), y(A), 0, 5, 0.1)</code> solves the second order ODE using previously defined ''A'' as a starting point.}}
 +
:{{note| 1=Always returns the result as locus. The algorithms are currently based on [[w:Runge-Kutta methods|Runge-Kutta numeric methods]].}}
 +
 
 +
{{Note|1= See also [[SlopeField Command|SlopeField command]].}}
 +
 
 
==CAS Syntax==
 
==CAS Syntax==
Following two syntaxes work only in [[CAS View]].
+
;SolveODE( <Equation> )
;SolveODE[ <f(x, y)> ]
+
:Attempts to find the exact solution of the first or second order ODE. For first and second derivative of ''y'' you can use ''<nowiki>y'</nowiki>'' and ''<nowiki>y''</nowiki>'' respectively.
:Attempts to find the exact solution of the first order ODE <math>\frac{dy}{dx}(x)=f(x, y(x))</math>.
+
:{{example| 1=<code><nowiki>SolveODE(y' = y / x)</nowiki></code> yields ''y = c<sub>1</sub> x''.}}
:{{example| 1=<div><code><nowiki>SolveODE[y / x]</nowiki></code> yields ''y = c<sub>1</sub> x''.</div>}}
+
;SolveODE( <Equation>, <Point(s) on f> )
;SolveODE[ <f(v, w)>, <Dependent Variable v>, <Independent Variable w> ]
+
:Attempts to find the exact solution of the given first or second order ODE which goes through the given point(s).
:Attempts to find the exact solution of the first order ODE <math>\frac{dv}{dw}(w)=f(w, v(w))</math>.
+
:{{example| 1=<code><nowiki>SolveODE(y' = y / x, (1, 2))</nowiki></code> yields ''y = 2x''.}}
:{{example| 1=<div><code><nowiki>SolveODE[y / x, yx]</nowiki></code> yields ''y = c<sub>1</sub> x''.</div>}}
+
;SolveODE( <Equation>, <Point(s) on f>, <Point(s) on f'> )
 +
:Attempts to find the exact solution of the given first or second order ODE and goes through the given ''point(s) on f'' and ''<nowiki>f' </nowiki>'' goes through the given ''point(s) on f' ''.
 +
:{{example| 1=<code><nowiki>SolveODE(y'' - 3y' + 2 = x, (2, 3), (1, 2))</nowiki></code> yields <math> y = \frac{-9  x^2  e^3 + 30  x  e^3 - 32 {(e^3)}^2 + 138  e^3 + 32  e^{3  x} }{54  e^3} </math>.}}
 +
;SolveODE( <Equation>, <Dependent Variable>, <Independent Variable>, <Point(s) on f> )
 +
:Attempts to find the exact solution of the given first or second order ODE which goes through the given point(s).
 +
:{{example| 1=<code><nowiki>SolveODE(v' = v / w, v,  w, (1, 2))</nowiki></code> yields ''v = 2w''.}}
 +
;SolveODE( <Equation>, <Dependent Variable>, <Independent Variable>, <Point(s) on f>, <Point(s) on f'> )
 +
:Attempts to find the exact solution of the given first or second order ODE which goes through the given ''point(s) on f'' and ''<nowiki>f'</nowiki>'' goes through the given ''point(s) on f' ''.
 +
:{{example| 1=<code><nowiki>SolveODE(v' = v / w, vw, (1, 2), (0, 2))</nowiki></code> yields ''v = 2w''.}}
 +
 
 +
{{Note|1=For compatibility with input bar, if the first parameter is just an expression without ''<nowiki>y'</nowiki>'' or ''<nowiki>y''</nowiki>'', it is supposed to be right hand side of ODE with left hand side ''<nowiki>y'</nowiki>''.}}

Latest revision as of 08:53, 9 October 2017


SolveODE( <f'(x, y)> )
Attempts to find the exact solution of the first order ordinary differential equation (ODE) \frac{dy}{dx}(x)=f'(x, y(x)).
Example: SolveODE(2x / y) yields \sqrt{2} \sqrt{-c_{1}+x^{2}}, where c_{1} is a constant.
Note: c_{1} will be created as an auxiliary object with a corresponding slider.
SolveODE( <f'(x, y)>, <Point on f> )
Attempts to find the exact solution of the first order ODE \frac{dy}{dx}(x)=f'(x, y(x)) and use the solution which goes through the given point.
Example: SolveODE(y / x, (1, 2)) yields y = 2x.
SolveODE( <f'(x, y)>, <Start x>, <Start y>, <End x>, <Step> )
Solves first order ODE \frac{dy}{dx}=f'(x, y) numerically with given start point, end and step for x.
Example: SolveODE(-x*y, x(A), y(A), 5, 0.1) solves \frac{dy}{dx}=-xy using previously defined A as a starting point.
Note:
  • Length( <Locus> ) allows you to find out how many points are in the computed locus.
  • First( <Locus>, <Number> ) allows you to extract the points as a list.
  • To find the "reverse" solution, just enter a negative value for End x, for example SolveODE(-x*y, x(A), y(A), -5, 0.1)
SolveODE( <y'>, <x'>, <Start x>, <Start y>, <End t>, <Step> )
Solves first order ODE \frac{dy}{dx}=\frac{f(x, y)}{g(x, y)} with given start point, maximal value of an internal parameter t and step for t. This version of the command may work where the first one fails e.g. when the solution curve has vertical points.
Example: SolveODE(-x, y, x(A), y(A), 5, 0.1) solves \frac{dy}{dx}=- \frac{x}{y} using previously defined A as a starting point.
Note: To find the "reverse" solution, just enter a negative value for End t, for example SolveODE(-x, y, x(A), y(A), -5, 0.1).
SolveODE( <b(x)>, <c(x)>, <f(x)>, <Start x>, <Start y>, <Start y'>, <End x>, <Step> )
Solves second order ODE y'' + b(x) y' + c(x) y = f(x).
Example: SolveODE(x^2, 2x, 2x^2 + x, x(A), y(A), 0, 5, 0.1) solves the second order ODE using previously defined A as a starting point.
Note: Always returns the result as locus. The algorithms are currently based on Runge-Kutta numeric methods.
Note: See also SlopeField command.

CAS Syntax

SolveODE( <Equation> )
Attempts to find the exact solution of the first or second order ODE. For first and second derivative of y you can use y' and y'' respectively.
Example: SolveODE(y' = y / x) yields y = c1 x.
SolveODE( <Equation>, <Point(s) on f> )
Attempts to find the exact solution of the given first or second order ODE which goes through the given point(s).
Example: SolveODE(y' = y / x, (1, 2)) yields y = 2x.
SolveODE( <Equation>, <Point(s) on f>, <Point(s) on f'> )
Attempts to find the exact solution of the given first or second order ODE and goes through the given point(s) on f and f' goes through the given point(s) on f' .
Example: SolveODE(y'' - 3y' + 2 = x, (2, 3), (1, 2)) yields y = \frac{-9 x^2 e^3 + 30 x e^3 - 32 {(e^3)}^2 + 138 e^3 + 32 e^{3 x} }{54 e^3} .
SolveODE( <Equation>, <Dependent Variable>, <Independent Variable>, <Point(s) on f> )
Attempts to find the exact solution of the given first or second order ODE which goes through the given point(s).
Example: SolveODE(v' = v / w, v, w, (1, 2)) yields v = 2w.
SolveODE( <Equation>, <Dependent Variable>, <Independent Variable>, <Point(s) on f>, <Point(s) on f'> )
Attempts to find the exact solution of the given first or second order ODE which goes through the given point(s) on f and f' goes through the given point(s) on f' .
Example: SolveODE(v' = v / w, v, w, (1, 2), (0, 2)) yields v = 2w.


Note: For compatibility with input bar, if the first parameter is just an expression without y' or y'', it is supposed to be right hand side of ODE with left hand side y'.
© 2024 International GeoGebra Institute