In this chapter, some facilities for solving differential equations are described. Currently only simple equations without auxiliary conditions are supported.
OdeSolve(expr1==expr2)
general ODE solver
- param expr1,expr2
expressions containing a function to solve for
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.
- Example
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);
Solve
, RootsWithMultiples
OdeTest(eqn,testsol)
test the solution of an ODE
- param eqn
equation to test
- param testsol
test solution
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.
- Example
In> OdeTest(y''+y,Sin(x)+Cos(x))
Out> 0;
In> OdeTest(y''+2*y,Sin(x)+Cos(x))
Out> Sin(x)+Cos(x);
OdeSolve
OdeOrder(eqn)
return order of an ODE
- param eqn
equation
This function returns the order of the differential equation, which is order of the highest derivative. If no derivatives appear, zero is returned.
- Example
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;
OdeSolve