Difference between revisions of "SolveODE Command"

From GeoGebra Manual
Jump to: navigation, search
m (fixed spacing and added a bulletted list for notes)
Line 4: Line 4:
 
: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''.
 
:{{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>}}
 
:{{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 <code>First[loc1, Length[loc1]]</code>.}}
+
:{{note| 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>}}
+
:* [[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>.
 +
:* 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>}}
  
  
Line 36: Line 37:
 
;SolveODE[ <Differential Equation in x,y>, <Point(s) L on f> ]  
 
;SolveODE[ <Differential Equation in x,y>, <Point(s) L on f> ]  
 
:Attempts to find the exact solution of the given first or second order ODE which goes through ''L'' (which is a point or list of points).  
 
:Attempts to find the exact solution of the given first or second order ODE which 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[  <Differential Equation in x,y>, <Point(s) L on f>, <Point(s) L' on f'>  ]  
 
;SolveODE[  <Differential Equation in x,y>, <Point(s) L on f>, <Point(s) L' on f'>  ]  
 
:Attempts to find the exact solution of the given first or second order ODE 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)
 
:Attempts to find the exact solution of the given first or second order ODE 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),(0,2)]</nowiki></code> yields ''y = 2  x''.</div>}}
+
:{{example| 1=<div><code><nowiki>SolveODE[y'=y / x, (1,2), (0,2)]</nowiki></code> yields ''y = 2  x''.</div>}}
  
 
;SolveODE[ <Differential Equation in w,v>, <Dependent Variable v>, <Independent Variable w> ]  
 
;SolveODE[ <Differential Equation in w,v>, <Dependent Variable v>, <Independent Variable w> ]  
Line 48: Line 49:
 
;SolveODE[ <Differential Equation in w,v>, <Dependent Variable v>, <Independent Variable w>, <Point(s) L on f> ]  
 
;SolveODE[ <Differential Equation in w,v>, <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.
:{{example| 1=<div><code><nowiki>SolveODE[v'=v / w, v,  w,(1,2)]</nowiki></code> yields ''v = 2 w''.</div>}}
+
:{{example| 1=<div><code><nowiki>SolveODE[v'=v / w, v,  w, (1,2)]</nowiki></code> yields ''v = 2 w''.</div>}}
  
 
;SolveODE[ <Differential Equation in w,v>, <Dependent Variable v>, <Independent Variable w>, <Point(s) L on f>, <Point(s) L' on f'> ]  
 
;SolveODE[ <Differential Equation in w,v>, <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.
:{{example| 1=<div><code><nowiki>SolveODE[v'=v / w, v,  w,(1,2),(0,2)]</nowiki></code> yields ''v = 2 w''.</div>}}
+
:{{example| 1=<div><code><nowiki>SolveODE[v'=v / w, v,  w, (1,2), (0,2)]</nowiki></code> yields ''v = 2 w''.</div>}}
  
 
{{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>'' or ''<nowiki>w'</nowiki>''.}}
 
{{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>'' or ''<nowiki>w'</nowiki>''.}}

Revision as of 19:35, 19 December 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]].
  • 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 syntaxes work only in CAS View.

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


SolveODE[ <Differential Equation in x,y>, <Point(s) L on f> ]
Attempts to find the exact solution of the given first or second order ODE which goes through L (which is a point or list of points).
Example:
SolveODE[y'=y / x, (1,2)] yields y = 2 x.


SolveODE[ <Differential Equation in x,y>, <Point(s) L on f>, <Point(s) L' on f'> ]
Attempts to find the exact solution of the given first or second order ODE 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), (0,2)] yields y = 2 x.


SolveODE[ <Differential Equation in w,v>, <Dependent Variable v>, <Independent Variable w> ]
Attempts to find the exact solution of the given first or second order ODE.
Example:
SolveODE[v'=v / w, v, w] yields v = c1 w.


SolveODE[ <Differential Equation in w,v>, <Dependent Variable v>, <Independent Variable w>, <Point(s) L on f> ]
Combines parameters of second and fourth syntax.
Example:
SolveODE[v'=v / w, v, w, (1,2)] yields v = 2 w.


SolveODE[ <Differential Equation in w,v>, <Dependent Variable v>, <Independent Variable w>, <Point(s) L on f>, <Point(s) L' on f'> ]
Combines parameters of third and fourth syntax.
Example:
SolveODE[v'=v / w, v, w, (1,2), (0,2)] yields v = 2 w.


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' or w'.
© 2024 International GeoGebra Institute