Documentation Center |
Domain of ordinary differential equations
This functionality does not run in MATLAB.
ode(eq, y(x)) ode({eq, <inits>}, y(x)) ode({eq1, eq2, , …, <inits>}, {y1(x), y2(x), …})
ode(eq, y(x)) represents an ordinary differential equation (ODE) for the function y(x).
ode({eq1, eq2, ...}, {y1(x), y2(x), ...}) represents a system of ODEs for the functions y1(x), y2(x) etc.
In the equations eq, eq1 etc., the unknown functions must be represented by y(x), y1(x) etc. Derivatives may be represented either by the diff function or by the differential operator D. Note that the token ' provides a handy shortcut: y'(x) = D(y)(x) means the same as diff(y(x), x).
The unknown functions must be univariate in the independent variable x. Multivariate expressions such as y(x, t) are not accepted.
The ode function does not accept piecewise input.
Initial and boundary conditions are defined by sequences of equations involving the unknown functions or their derivatives on the left hand side. The corresponding values must be specified on the right hand side of the equations. In particular, the differential operator D (or the token ') must be used to specify values of derivatives at some point. E.g.,
is a valid sequence of boundary conditions for inits.
Boundary conditions of the first and second kind are allowed. Mixed conditions are not accepted.
The initial/boundary points and the corresponding initial/boundary values may be symbolic expressions.
For scalar initial value or boundary value problems, use ode({eq, inits}, y(x)) to specify the conditions.
For systems of ODEs, there must be as many equations as unknown functions.
The main purpose of the ode domain is to provide an environment for overloading the function solve.
In the case of one single equation (possibly together with initial or boundary conditions), solve returns a set of explicit solutions or an implicit solution. Each element of the set represents a solution branch.
In the case of a system of equations, solve returns a set of lists of equations for the unknown functions. Each list represents a solution branch.
An symbolic solve call is returned if no solution is found.
In the following, we show how to create and solve a scalar ODE. First, we define the ODE . We use the quote token ' to represent derivatives:
eq := ode(x^2*y'(x) + 3*x*y(x) = sin(x)/x, y(x))
We get an element of the domain ode which we can now solve:
solve(eq)
delete eq:
An initial value problem is defined as a set consisting of the ODE and the initial conditions:
ivp := ode({f''(t) + 4*f(t) = sin(2*t), f(0) = a, f'(0) = b}, f(t))
solve(ivp)
delete ivp:
With some restrictions, it is also possible to solve systems of ODEs. First, define a system:
sys := {x'(t) - x(t) + y(t) = 0, y'(t) - x(t) - y(t) = 0}
A call to solve yields the general solution with arbitrary parameters:
solution := solve(ode(sys, {x(t), y(t)}))
To verify the result, substitute it back into the system sys. However, for the substitution, you must rewrite the system into a notation using the diff function:
eval(subs(rewrite(sys, diff), op(solution)))
delete sys, solution:
If you have a system of differential equations in a matrix form, extract the components of the matrix to a set of differential equations:
Y:= matrix([x(t), y(t)]): A:= matrix([[1, 2], [-1, 6]]): s := ode({op(diff(Y, t) - A*Y)}, {x(t), y(t)})
Now, use the solve function to solve the system:
solve(s)
In this example, we point out the various return formats of ode's solve facility. First, we solve an ODE with an initial condition. The solution involves a symbolic integral:
solve(ode({y'(x) + x*y(x) = cos(x), y(0) = 3}, y(x)))
For the next equation, we get an implicit solution:
solve(ode((x*y'(x) - y(x))^4*exp(x*y'(x) - y(x)) - ln(x*y'(x) - y(x)), y(x)))
This is an algebraic equation for y. Its solution defines y as a function of x and an arbitrary parameter C followed by a number automatically generated by MuPAD^{®} (constant of integration). However, the algebraic equation does not have a solution in closed form.
delete sys, solution:
It may happen that MuPAD cannot solve a given equation. In such a case, a symbolic solve command is returned:
solve(ode(x*diff(y(x),x)-y(x)*(x*ln(x^3/y(x))+2), y(x)))
The MuPAD ODE solver contains algebraic algorithms for computing Liouvillian and non-Liouvillian solutions of linear ordinary differential equations. These algorithms are based on differential Galois theory and on additional methods for finding solutions of linear ordinary differential equations given in terms of special functions. For the famous Kovacic's example
,
the solution can be found as:
solve(ode(y''(x) + (3/(16*x^2) + 2/(9*(x - 1)^2) - 3/(16*x*(x - 1)))*y(x), y(x)))
MuPAD may find Liouvillian and non-Liouvillian solutions for higher order equations as well. However, in case of Liouvillian solutions, there is no guarantee that all of them are found.
MuPAD also finds non-Liouvillian solutions in terms of the Bessel, Airy, and Whittaker functions:
eq := y'(x) + y(x)^2 + b + a*x
solve(ode(eq, y(x)))
We check this solution:
simplify(eval(subs(rewrite(eq, diff), y(x) = op(%))))
It is also possible to compute the series solutions of an ordinary differential equation (cf. ode::series for further details):
series(ode(y''(x) + 4*y(x) = sin(w*x), y(x)), x = 0, 8)
eq, eq1, eq2, … |
Equations or arithmetical expressions in the unknown functions and their derivatives with respect to x. An arithmetical expression is regarded as an equation with vanishing right hand side. |
y, y1, y2, … |
The unknown functions: identifiers |
x |
The independent variable: an identifier |
inits |
The initial or boundary conditions: a sequence of equations |
[1] E. Kamke. "Differentialgleichungen: Lösungmethoden und Lösungen". B.G. Teubner, Stuttgart, 1997.
[2] G.M. Murphy. "Ordinary differential equations and their solutions". Van Nostrand, Princeton, 1960.
[3] D. Zwillinger. "Handbook of differential equations". San Diego: Academic Press, 1992.
[4] W. Fakler. Algebraische Algorithmen zur Lösung von linearen Differentialgleichungen. Stuttgart, Leipzig: Teubner, Reihe MuPAD Reports, 1999.
[5] M. van der Put and M.F. Singer. "Galois theory of linear differential equations". Grundlehren der Mathematischen Wissenschaften, 328, Springer-Verlag, Berlin, 2003.
[6] F. Ulmer and M.F. Singer. Liouvillian and algebraic solutions of second and third order linear differential equations. "J. Symb. Comp.", 16:37-74, 1993.