MAPLE: Solving Differential Equations

MAPLE: Solving Differential Equations

Includes Laplace Transforms


BEFORE TRYING TO SOLVE DIFFERENTIAL EQUATIONS, YOU SHOULD FIRST STUDY
Help Sheet 3: Derivatives & Integrals.

  1. Derivatives of functions. Recall that if f is a known function of x, then

    > diff( f, x ) ; gives f '(x)

    > diff( f, x$2 ) ; gives f ''(x)

    > diff( f, x$3 ) ; gives f (3)(x), etc.

  2. Defining an ordinary differential equation, for example

    y'' + 4 y' + 13 y = cos 3x

    > de := diff(y(x),x$2) + 4*diff(y(x),x) + 13*y(x)
    > =cos(3*x);

    Note: When defining a differential equation, include the independent variable; for example, enter diff( y(x), x$2 ), not diff( y, x$2 ).

  3. Solving the ordinary differential equation for y(x)

    > Y := rhs( dsolve(de, y(x)) );

    The solution is called Y.

  4. Solving the ordinary differential equation subject to initial conditions. For example, solve the initial value problem

    y'' + 4y' + 13y = cos 3x

    y(0) = 1, y'(0) = 0

    > de := diff(y(x),x$2) + 4*diff(y(x),x) + 13*y(x)
    > = cos(3*x) ;

    > Y := rhs( dsolve( { de, y(0) = 1, D(y)(0) = 0 }, y(x) ) ) ;
    The solution is called Y.

    > plot( Y, x = 0..5 ) ;
    plots the solution Y from x = 0 to 5

  5. Another example. Solve the initial value problem

    y(4) + 10y''' + 38y'' + 66y' + 45y = 4

    y(0) = 1, y'(0) = 0, y''(0) = -1, y'''(0) = 2

    > de := diff(y(x),x$4) + 10*diff(y(x),x$3) +
    > 38*diff(y(x),x$2) + 66*diff(y(x),x) +
    > 45*y(x) = 4 ;

    > Y := rhs( dsolve( { de, y(0) = 1, D(y)(0) = 0,
    > D(D(y))(0) = -1, D(D(D(y)))(0) = 2 }, y(x) ) ) ;
    The solution is called Y.

    > plot( Y, x = 0..5 ) ;
    plots the solution Y from x = 0 to 5

  6. Another example. Solve the initial value problem

    y'' + w2 y = cos x

    y(0) = 1, y'(0) = -2

    where w is a constant parameter.

    > de := diff(y(x),x$2) + w^2*y(x) = cos(x) ;

    > Y := rhs( dsolve( { de, y(0) = 1, D(y)(0) = -2 }, y(x) ) ) ;
    The solution is called Y.

    > plot( Y, x = 0..5 ) ;
    produces an error since you did not specify a value for w

    > plot( subs( w = 3, Y ), x = 0..5 ) ;
    plots the solution Y from x = 0 to 5 with w set to 3

  7. Other maple tools for solving and plotting solutions of differential equations are found in the DEtools package.

    > with( DEtools ) :

    > ?DEtools for a list of commands in the DEtools package

    Of course, not every conceivable differential equation can be solved, which is why we still need to know Numerical Methods!


  8. Laplace Transforms. To determine the Laplace transform of a function, say

    f(t) = cos t

    > with( inttrans ) : load the integral transform package

    > f := cos(t) ; defines f as an expression

    > F := laplace( f, t, s ) ; stores the Laplace transform of f in F

    > F := s/(s^2-25) ; defines F as an expression

    > f := invlaplace( F, s, t ) ; stores the inverse Laplace transform of F in f

    > G := s/(s^2-9) ; defines G as an expression

    > g := invlaplace( G, s, t ) ; stores the inverse Laplace transform of G in g

    > f := Heaviside(t-4) ; defines f as the unit step function about t=4

    Note: The unit step function is not U(t-4).

    > F := laplace( f, t, s ) ; stores the Laplace transform of f in F

    > f := t^2 * Heaviside(t-4) ;

    > F := laplace( f, t, s ) ; stores the Laplace transform of f in F

    > ?inttrans for a list of commands in the inttrans package


Go to the Maple Help Sheet Index

Written and Maintained by

Prof. Kevin G. TeBeest
Applied Mathematics
Kettering University

Last modified: 07/23/07

Maple® is a registered trademark of Waterloo Maple Software.

Copyright © 1997-2008 Kevin G. TeBeest. All rights reserved.