[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

22. Differential Equations


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

22.1 Definitions for Differential Equations

Function: bc2 (solution, xval1, yval1, xval2, yval2)

Solves boundary value problem for second order differential equation. Here: solution is a general solution to the equation, as found by ode2, xval1 is an equation for the independent variable in the form x = x0, and yval1 is an equation for the dependent variable in the form y = y0. The xval2 and yval2 are equations for these variables at another point. See ode2 for example of usage.

Function: desolve (eqn, x)
Function: desolve ([eqn_1, ..., eqn_n], [x_1, ..., x_n])

The function dsolve solves systems of linear ordinary differential equations using Laplace transform. Here the eqn's are differential equations in the dependent variables x_1, ..., x_n. The functional relationships must be explicitly indicated in both the equations and the variables. For example

 
'diff(f,x,2)=sin(x)+'diff(g,x);
'diff(f,x)+x^2-f=2*'diff(g,x,2);

is not the proper format. The correct way is:

 
'diff(f(x),x,2)=sin(x)+'diff(g(x),x);
'diff(f(x),x)+x^2-f=2*'diff(g(x),x,2);

The call is then desolve([%o3,%o4],[f(x),g(x)]); .

If initial conditions at 0 are known, they should be supplied before calling desolve by using atvalue.

 
(%i1) 'diff(f(x),x)='diff(g(x),x)+sin(x);
                 d           d
(%o1)            -- (f(x)) = -- (g(x)) + sin(x)
                 dx          dx
(%i2) 'diff(g(x),x,2)='diff(f(x),x)-cos(x);
                  2
                 d            d
(%o2)            --- (g(x)) = -- (f(x)) - cos(x)
                   2          dx
                 dx
(%i3) atvalue('diff(g(x),x),x=0,a);
(%o3)                           a
(%i4) atvalue(f(x),x=0,1);
(%o4)                           1
(%i5) desolve([%o1,%o2],[f(x),g(x)]);
                  x
(%o5) [f(x) = a %e  - a + 1, g(x) = 

                                                x
                                   cos(x) + a %e  - a + g(0) - 1]
(%i6) [%o1,%o2],%o5,diff;
             x       x      x                x
(%o6)   [a %e  = a %e , a %e  - cos(x) = a %e  - cos(x)]

If desolve cannot obtain a solution, it returns false.

Function: ic1 (solution, xval, yval)

Solves initial value problem for first order differential equation. Here: solution is a general solution to the equation, as found by ode2, xval is an equation for the independent variable in the form x = x0, and yval is an equation for the dependent variable in the form y = y0. See ode2 for example of usage.

Function: ic2 (solution, xval, yval, dval)

Solves initial value problem for second order differential equation. Here: solution is a general solution to the equation, as found by ode2, xval is an equation for the independent variable in the form x = x0, yval is an equation for the dependent variable in the form y = y0, and dval is an equation for the derivative of the dependent variable with respect to independent variable evaluated at the point xval. See ode2 for example of usage.

Function: ode2 (eqn, dvar, ivar)

The function ode2 solves ordinary differential equations of first or second order. It takes three arguments: an ODE eqn, the dependent variable dvar, and the independent variable ivar. When successful, it returns either an explicit or implicit solution for the dependent variable. %c is used to represent the constant in the case of first order equations, and %k1 and %k2 the constants for second order equations. If ode2 cannot obtain a solution for whatever reason, it returns false, after perhaps printing out an error message. The methods implemented for first order equations in the order in which they are tested are: linear, separable, exact - perhaps requiring an integrating factor, homogeneous, Bernoulli's equation, and a generalized homogeneous method. For second order: constant coefficient, exact, linear homogeneous with non-constant coefficients which can be transformed to constant coefficient, the Euler or equidimensional equation, the method of variation of parameters, and equations which are free of either the independent or of the dependent variable so that they can be reduced to two first order linear equations to be solved sequentially. In the course of solving ODEs, several variables are set purely for informational purposes: method denotes the method of solution used e.g. linear, intfactor denotes any integrating factor used, odeindex denotes the index for Bernoulli's method or for the generalized homogeneous method, and yp denotes the particular solution for the variation of parameters technique.

In order to solve initial value problems (IVPs) and boundary value problems (BVPs), the routine ic1 is available for first order equations, and ic2 and bc2 for second order IVPs and BVPs, respectively.

Example:

 
(%i1) x^2*'diff(y,x) + 3*y*x = sin(x)/x;
                      2 dy           sin(x)
(%o1)                x  -- + 3 x y = ------
                        dx             x
(%i2) ode2(%,y,x);
                             %c - cos(x)
(%o2)                    y = -----------
                                  3
                                 x
(%i3) ic1(%o2,x=%pi,y=0);
                              cos(x) + 1
(%o3)                   y = - ----------
                                   3
                                  x
(%i4) 'diff(y,x,2) + y*'diff(y,x)^3 = 0;
                         2
                        d y      dy 3
(%o4)                   --- + y (--)  = 0
                          2      dx
                        dx
(%i5) ode2(%,y,x);
                      3
                     y  + 6 %k1 y
(%o5)                ------------ = x + %k2
                          6
(%i6) ratsimp(ic2(%o5,x=0,y=0,'diff(y,x)=2));
                             3
                          2 y  - 3 y
(%o6)                   - ---------- = x
                              6
(%i7) bc2(%o5,x=0,y=1,x=1,y=3);
                         3
                        y  - 10 y       3
(%o7)                   --------- = x - -
                            6           2


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated on March, 19 2006 using texi2html 1.76.