Difference between revisions of "SolveODE Command"
From GeoGebra Manual
(add sensible example for 2nd order particular case) |
|||
Line 1: | Line 1: | ||
<noinclude>{{Manual Page|version=4.2}}</noinclude> | <noinclude>{{Manual Page|version=4.2}}</noinclude> | ||
{{command|cas=true|function}} | {{command|cas=true|function}} | ||
− | ;SolveODE[ <f(x,y)>, <Start x>, <Start y>, <End x>, <Step> ] | + | ;SolveODE[ <f'(x, y)> ] |
− | :Solves first order | + | :Attempts to find the exact solution of the first order ordinary differential equation (ODE) <math>\frac{dy}{dx}(x)=f(x, y(x))</math>. |
+ | :{{example| 1=<div><code><nowiki>SolveODE[2x / y]</nowiki></code> yields ''-2x<sup>2</sup> + y<sup>2</sup> = 0''.</div>}} | ||
+ | ;SolveODE[ <f'(x, y)>, <Point 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 the given point. | ||
+ | :{{example| 1=<div><code><nowiki>SolveODE[y / x, (1, 2)]</nowiki></code> yields ''y = 2x''.</div>}} | ||
+ | ;SolveODE[ <f'(x, y)>, <Start x>, <Start y>, <End x>, <Step> ] | ||
+ | :Solves first order ODE <math>\frac{dy}{dx}=f(x, y)</math> numerically with given start point, end and 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= | :{{note| 1= | ||
− | :* [[Length Command|Length]][ <Locus> ] allows you to find out how many points are in the computed locus | + | :*[[Length Command|Length]][ <Locus> ] allows you to find out how many points are in the computed locus. |
− | :* To find the "reverse" solution, just enter a negative value for ''End x'', | + | :*[[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[ <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 e.g. 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. |
:{{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>}} | :{{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'', e.g. <code>SolveODE[-x, y, x(A), y(A), -5, 0.1]</code>.}} | :{{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[ <b(x)>, <c(x)>, <f(x)>, <Start x>, <Start y>, <Start y'>, <End x>, <Step> ] | |
− | ;SolveODE[ <b(x)>, | + | :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>. | + | :{{example|1=<div><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.</div>}} |
:{{note| 1=Always returns the result as locus. The algorithms are currently based on Runge-Kutta numeric methods.}} | :{{note| 1=Always returns the result as locus. The algorithms are currently based on Runge-Kutta numeric methods.}} | ||
− | |||
+ | {{Note|1= See also [[SlopeField Command|SlopeField command]].}} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==CAS Syntax== | ==CAS Syntax== | ||
− | + | ;SolveODE[ <Equation> ] | |
− | ;SolveODE[ < | ||
: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 or second order ODE. For first and second derivative of ''y'' you can use ''<nowiki>y'</nowiki>'' and ''<nowiki>y''</nowiki>'' respectively. | ||
− | :{{example| 1=<div><code><nowiki>SolveODE[y'=y / x]</nowiki></code> yields ''f(x) = c<sub>1</sub> | + | :{{example| 1=<div><code><nowiki>SolveODE[y' = y / x]</nowiki></code> yields ''f(x) = x c<sub>1</sub>''.</div>}} |
− | + | ;SolveODE[ <Equation>, <Point(s) on f> ] | |
− | ;SolveODE[ < | + | :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 given first or second order ODE which goes through | + | :{{example| 1=<div><code><nowiki>SolveODE[y' = y / x, (1, 2)]</nowiki></code> yields ''y = 2x''.</div>}} |
− | :{{example| 1=<div><code><nowiki>SolveODE[y'=y / x, (1,2)]</nowiki></code> yields ''y = | + | ;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' ''. | |
− | ;SolveODE[ | + | :{{example| 1=<div><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 + 138 e^3 + 32 e^{3 x} - 32 e^6 + 138 e^3}{54 e^3} </math> .</div>}} |
− | :Attempts to find the exact solution of the given first or second order ODE and goes through '' | + | ;SolveODE[ <Equation>, <Dependent Variable>, <Independent Variable>, <Point(s) on f> ] |
− | :{{example| 1=<div><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 + 138 e^3 + 32 e^{3 x} - 32 e^6}{54 e^3} </math> .</div>}} | + | :Attempts to find the exact solution of the given first or second order ODE which goes through the given point(s). |
− | + | :{{example| 1=<div><code><nowiki>SolveODE[v' = v / w, v, w, (1, 2)]</nowiki></code> yields ''v = 2w''.</div>}} | |
− | ;SolveODE[ < | + | ;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. | + | :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=<div><code><nowiki>SolveODE[v'=v / w, v, w]</nowiki></code> yields ''v = | + | :{{example| 1=<div><code><nowiki>SolveODE[v' = v / w, v, w, (1, 2), (0, 2)]</nowiki></code> yields ''v = 2w''.</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>''.}} | |
− | ;SolveODE[ < | ||
− | : | ||
− | |||
− | |||
− | |||
− | |||
− | :{{example| 1=<div><code><nowiki>SolveODE[v'=v / w, v, w, (1,2), (0,2)]</nowiki></code> yields ''v = | ||
− | |||
− | {{Note|1=For compatibility with input bar, if the |
Revision as of 16:08, 27 August 2013
- 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 -2x2 + y2 = 0.
- 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.
- 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).
- 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 f(x) = x c1.
- 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 + 138 e^3 + 32 e^{3 x} - 32 e^6 + 138 e^3}{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'.