Difference between revisions of "SolveODE Command"

From GeoGebra Manual
Jump to: navigation, search
m (fixed spacing and added some code tagging)
Line 3: Line 3:
 
;SolveODE[ <f(x,y)>, <Start x>, <Start y>, <End x>, <Step> ]
 
;SolveODE[ <f(x,y)>, <Start x>, <Start y>, <End x>, <Step> ]
 
:Solves first order ordinary differential equations (ODE) <math>\frac{dy}{dx}=f(x,y)</math> numerically given start point and end & step for ''x''.
 
:Solves first order ordinary differential equations (ODE) <math>\frac{dy}{dx}=f(x,y)</math> numerically given start point and end & step for ''x''.
: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]
+
:{{example|1=<div><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.</div>}}
:{{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]].}}
+
:{{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 <code>First[loc1, Length[loc1]]</code>.}}
:{{note| 1=To find the "reverse" solution, just enter a negative value for ''End x'', eg SolveODE[-x*y, x(A), y(A), -5, 0.1]}}
+
:{{note| 1=To find the "reverse" solution, just enter a negative value for ''End x'', e.g. <code>SolveODE[-x*y, x(A), y(A), -5, 0.1]</code>}}
 
;SolveODE[ <f(x,y)>, <g(x,y)>, <Start x>, <Start y>, <End t>, <Step> ]
 
;SolveODE[ <f(x,y)>, <g(x,y)>, <Start x>, <Start y>, <End t>, <Step> ]
: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.
+
: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 e.g. when the solution curve has vertical points.
: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].
+
:{{example|1=<div><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.</div>}}
:{{note| 1=To find the "reverse" solution, just enter a negative value for ''End t'', eg  SolveODE[-x, y, x(A), y(A), -5, 0.1]}}
+
:{{note| 1=To find the "reverse" solution, just enter a negative value for ''End t'', e.g. <code>SolveODE[-x, y, x(A), y(A), -5, 0.1]</code>.}}
 
;SolveODE[ &lt;b(x)>, &lt;c(x)>, &lt;f(x)>, &lt;Start x>, &lt;Start y>, &lt;Start y'>, &lt;End x>, &lt;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 second order ODE <math>y''+b(x)y'+c(x)y=f(x)</math>.
 
:Solves second order ODE <math>y''+b(x)y'+c(x)y=f(x)</math>.
Line 18: Line 18:
 
:{{example| 1=<div><code><nowiki>SolveODE[y / x]</nowiki></code> yields ''f(x) = c<sub>1</sub> x''.</div>}}
 
:{{example| 1=<div><code><nowiki>SolveODE[y / x]</nowiki></code> yields ''f(x) = c<sub>1</sub> x''.</div>}}
 
;SolveODE[ <f(x, y)>, <Point A on f> ]  
 
;SolveODE[ <f(x, y)>, <Point A on f> ]  
: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 A.
+
: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 ''A''.
 
:{{example| 1=<div><code><nowiki>SolveODE[y / x,(1,2)]</nowiki></code> yields ''f(x) = 2  x''.</div>}}
 
:{{example| 1=<div><code><nowiki>SolveODE[y / x,(1,2)]</nowiki></code> yields ''f(x) = 2  x''.</div>}}
 
==CAS Syntax==
 
==CAS Syntax==
 
Following two syntaxes work only in [[CAS View]].
 
Following two syntaxes work only in [[CAS View]].
 
;SolveODE[ <Differential Equation> ]  
 
;SolveODE[ <Differential Equation> ]  
: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>.
+
: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>''.
 
:{{example| 1=<div><code><nowiki>SolveODE[y'=y / x]</nowiki></code> yields ''f(x) = c<sub>1</sub> x''.</div>}}
 
:{{example| 1=<div><code><nowiki>SolveODE[y'=y / x]</nowiki></code> yields ''f(x) = c<sub>1</sub> x''.</div>}}
  
 
;SolveODE[ <f(x, y)>, <Point(s) L on f> ]  
 
;SolveODE[ <f(x, y)>, <Point(s) L on f> ]  
:Attempts to find the exact solution of the first or second order order ODE <math>\frac{dy}{dx}(x)=f(x, y(x))</math> and goes through L (which is a point or list of points)
+
:Attempts to find the exact solution of the first or second order order ODE <math>\frac{dy}{dx}(x)=f(x, y(x))</math> and goes through ''L'' (which is a point or list of points)
 
:{{example| 1=<div><code><nowiki>SolveODE[y'=y / x,(1,2)]</nowiki></code> yields ''y = 2  x''.</div>}}
 
:{{example| 1=<div><code><nowiki>SolveODE[y'=y / x,(1,2)]</nowiki></code> yields ''y = 2  x''.</div>}}
 
;SolveODE[ <f(x, y)>, <Point(s) L on f>, <Point(s) L' on f'>  ]  
 
;SolveODE[ <f(x, y)>, <Point(s) L on f>, <Point(s) L' on f'>  ]  
:Attempts to find the exact solution of the first or second order ODE <math>\frac{dy}{dx}(x)=f(x, y(x))</math> and goes through L (which is a point or list of points) and f' goes through L' (which is a point or list of points)
+
:Attempts to find the exact solution of the first or second order ODE <math>\frac{dy}{dx}(x)=f(x, y(x))</math> and goes through ''L'' (which is a point or list of points) and ''<nowiki>f' </nowiki>'' goes through ''L' '' (which is a point or list of points)
 
:{{example| 1=<div><code><nowiki>SolveODE[y'=y / x,(1,2)]</nowiki></code> yields ''y = 2  x''.</div>}}
 
:{{example| 1=<div><code><nowiki>SolveODE[y'=y / x,(1,2)]</nowiki></code> yields ''y = 2  x''.</div>}}
 
;SolveODE[ <f(v, w)>, <Dependent Variable v>, <Independent Variable w> ]  
 
;SolveODE[ <f(v, w)>, <Dependent Variable v>, <Independent Variable w> ]  
Line 36: Line 36:
 
:{{example| 1=<div><code><nowiki>SolveODE[v'=v / w, w,  v]</nowiki></code> yields ''v = c<sub>1</sub> w''.</div>}}
 
:{{example| 1=<div><code><nowiki>SolveODE[v'=v / w, w,  v]</nowiki></code> yields ''v = c<sub>1</sub> w''.</div>}}
 
;SolveODE[ <f(v, w)>, <Dependent Variable v>, <Independent Variable w>, <Point(s) L on f> ]  
 
;SolveODE[ <f(v, w)>, <Dependent Variable v>, <Independent Variable w>, <Point(s) L on f> ]  
Combines parameters of second and fourth syntax.
+
:Combines parameters of second and fourth syntax.
 
;SolveODE[ <f(v, w)>, <Dependent Variable v>, <Independent Variable w>, <Point(s) L on f>, <Point(s) L' on f'> ]  
 
;SolveODE[ <f(v, w)>, <Dependent Variable v>, <Independent Variable w>, <Point(s) L on f>, <Point(s) L' on f'> ]  
Combines parameters of third and fourth syntax.
+
:Combines parameters of third and fourth syntax.
{{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 supposd to be right hand side of ODE with left hand side y'.}}
+
{{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 supposd to be right hand side of ODE with left hand side ''<nowiki>y'</nowiki>''.}}

Revision as of 11:49, 1 November 2012



SolveODE[ <f(x,y)>, <Start x>, <Start y>, <End x>, <Step> ]
Solves first order ordinary differential equations (ODE) \frac{dy}{dx}=f(x,y) numerically given start point and end & 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 and First[ <Locus>, <Number> ] allows you to extract the points as a list, for example First[loc1, Length[loc1]].
Note: To find the "reverse" solution, just enter a negative value for End x, e.g. SolveODE[-x*y, x(A), y(A), -5, 0.1]
SolveODE[ <f(x,y)>, <g(x,y)>, <Start x>, <Start y>, <End t>, <Step> ]
Solves first order ODE \frac{dy}{dx}=\frac{f(x,y)}{g(x,y)} 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, e.g. 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).
Note: Always returns the result as locus. The algorithms are currently based on Runge-Kutta numeric methods.
Note: See also SlopeField command
SolveODE[ <f(x, y)> ]
Attempts to find the exact solution of the first order ODE \frac{dy}{dx}(x)=f(x, y(x)).
Example:
SolveODE[y / x] yields f(x) = c1 x.
SolveODE[ <f(x, y)>, <Point A 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 A.
Example:
SolveODE[y / x,(1,2)] yields f(x) = 2 x.

CAS Syntax

Following two syntaxes work only in CAS View.

SolveODE[ <Differential 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''.
Example:
SolveODE[y'=y / x] yields f(x) = c1 x.


SolveODE[ <f(x, y)>, <Point(s) L on f> ]
Attempts to find the exact solution of the first or second order order ODE \frac{dy}{dx}(x)=f(x, y(x)) and goes through L (which is a point or list of points)
Example:
SolveODE[y'=y / x,(1,2)] yields y = 2 x.
SolveODE[ <f(x, y)>, <Point(s) L on f>, <Point(s) L' on f'> ]
Attempts to find the exact solution of the first or second order ODE \frac{dy}{dx}(x)=f(x, y(x)) and goes through L (which is a point or list of points) and f' goes through L' (which is a point or list of points)
Example:
SolveODE[y'=y / x,(1,2)] yields y = 2 x.
SolveODE[ <f(v, w)>, <Dependent Variable v>, <Independent Variable w> ]
Attempts to find the exact solution of the first order ODE \frac{dv}{dw}(w)=f(w, v(w)).
Example:
SolveODE[v'=v / w, w, v] yields v = c1 w.
SolveODE[ <f(v, w)>, <Dependent Variable v>, <Independent Variable w>, <Point(s) L on f> ]
Combines parameters of second and fourth syntax.
SolveODE[ <f(v, w)>, <Dependent Variable v>, <Independent Variable w>, <Point(s) L on f>, <Point(s) L' on f'> ]
Combines parameters of third and fourth syntax.
Note: For compatibility with input bar, if the first parameter is just an expression without y' or y'', it is supposd to be right hand side of ODE with left hand side y'.
© 2024 International GeoGebra Institute