Differential Equations

(directly go to documentation on : OdeSolve, OdeTest, OdeOrder. )

# 15. Differential Equations

In this chapter, some facilities for solving differential equations are described. Currently only simple equations without auxiliary conditions are supported.

OdeSolve | general ODE solver
OdeTest | test the solution of an ODE
OdeOrder | return order of an ODE

###

OdeSolve -- general ODE solver

##### Standard library

##### Calling format:

    OdeSolve(expr1==expr2)

##### Parameters:

`expr1,expr2` -- expressions containing a function to solve for

##### Description:

This function currently can solve second order homogeneous linear real constant coefficient equations. The solution is returned with unique constants generated by `UniqueConstant`. The roots of the auxiliary equation are used as the arguments of exponentials. If the roots are complex conjugate pairs, then the solution returned is in the form of exponentials, sines and cosines.

First and second derivatives are entered as `y',y''`. Higher order derivatives may be entered as `y(n)`, where `n` is any integer.

##### Examples:

    In> OdeSolve( y'' + y == 0 )
    Out> C42*Sin(x)+C43*Cos(x);
    In> OdeSolve( 2*y'' + 3*y' + 5*y == 0 )
    Out> Exp(((-3)*x)/4)*(C78*Sin(Sqrt(31/16)*x)+C79*Cos(Sqrt(31/16)*x));
    In> OdeSolve( y'' - 4*y == 0 )
    Out> C132*Exp((-2)*x)+C136*Exp(2*x);
    In> OdeSolve( y'' +2*y' + y == 0 )
    Out> (C183+C184*x)*Exp(-x);

##### See also:

Solve , RootsWithMultiples .

###

OdeTest -- test the solution of an ODE

##### Standard library

##### Calling format:

    OdeTest(eqn,testsol)

##### Parameters:

`eqn` -- equation to test

`testsol` -- test solution

##### Description:

This function automates the verification of the solution of an ODE. It can also be used to quickly see how a particular equation operates on a function.

##### Examples:

    In> OdeTest(y''+y,Sin(x)+Cos(x))
    Out> 0;
    In> OdeTest(y''+2*y,Sin(x)+Cos(x))
    Out> Sin(x)+Cos(x);

##### See also:

OdeSolve .

###

OdeOrder -- return order of an ODE

##### Standard library

##### Calling format:

    OdeOrder(eqn)

##### Parameters:

`eqn` -- equation

##### Description:

This function returns the order of the differential equation, which is order of the highest derivative. If no derivatives appear, zero is returned.

##### Examples:

    In> OdeOrder(y'' + 2*y' == 0)
    Out> 2;
    In> OdeOrder(Sin(x)*y(5) + 2*y' == 0)
    Out> 5;
    In> OdeOrder(2*y + Sin(y) == 0)
    Out> 0;

##### See also:

OdeSolve .