unit04.mws

ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL

Unit 4 -- First-Order Linear Equations

Prof. Douglas B. Meade

Industrial Mathematics Institute

Department of Mathematics

University of South Carolina

Columbia, SC 29208

URL: http://www.math.sc.edu/~meade/

E-mail: meade@math.sc.edu

Copyright © 2001 by Douglas B. Meade

All rights reserved

-------------------------------------------------------------------

>

Outline of Unit 4

4.A Structure of Solutiosn to Linear ODEs

4.B Integrating Factor for a First-Order Linear ODE

>

Initialization

> restart;

> with( DEtools );

[DEnormal, DEplot, DEplot3d, DEplot_polygon, DFacto...
[DEnormal, DEplot, DEplot3d, DEplot_polygon, DFacto...
[DEnormal, DEplot, DEplot3d, DEplot_polygon, DFacto...
[DEnormal, DEplot, DEplot3d, DEplot_polygon, DFacto...
[DEnormal, DEplot, DEplot3d, DEplot_polygon, DFacto...
[DEnormal, DEplot, DEplot3d, DEplot_polygon, DFacto...
[DEnormal, DEplot, DEplot3d, DEplot_polygon, DFacto...
[DEnormal, DEplot, DEplot3d, DEplot_polygon, DFacto...
[DEnormal, DEplot, DEplot3d, DEplot_polygon, DFacto...

> with( plots );

Warning, the name changecoords has been redefined

[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...
[animate, animate3d, animatecurve, changecoords, co...

> with( linalg );

Warning, the name adjoint has been redefined

Warning, the protected names norm and trace have been redefined and unprotected

[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...

>

4.A Structure of Solutions to Linear ODEs

The general first-order linear ODE is

> lin_ode := diff( x(t), t ) + p(t) * x(t) = f(t);

lin_ode := diff(x(t),t)+p(t)*x(t) = f(t)

>

Note that, in general, this is not a separable ODE.

> odeadvisor( lin_ode, [separable] );

[NONE]

>

If p(t) and f(t) are both constants, then the ODE is separable. In this case, the solution can be found as in Unit 3. The solution that is found is

> lin_ode_const := subs( p(t)=a, f(t)=b, lin_ode );

lin_ode_const := diff(x(t),t)+a*x(t) = b

> odeadvisor( lin_ode_const, [separable] );

[_separable]

>

> infolevel[dsolve] := 3:

> lin_ode_const_soln := dsolve( lin_ode_const, x(t) );

> infolevel[dsolve] := 0:

Methods for first order ODEs:

Trying to isolate the derivative dx/dt...

Successful isolation of dx/dt

-> Trying classification methods

trying a quadrature

trying 1st order linear

1st order linear successful

lin_ode_const_soln := x(t) = b/a+exp(-a*t)*_C1

>

The structure of this solution is important. The term involving the constant of integration

> soln_h := x(t) = coeff(rhs(lin_ode_const_soln),_C1);

soln_h := x(t) = exp(-a*t)

>

is a solution of the homogenous ODE (i.e., b = 0 )

> odetest( soln_h, subs( b=0, lin_ode_const ) );

0

>

The constant term

> soln_p := x(t) = subs( _C1=0, rhs(lin_ode_const_soln) );

soln_p := x(t) = b/a

>

is a solution to the non-homogeneous ODE

> odetest( soln_p, lin_ode_const );

0

>

Any solution that satisfies the full ODE is called a particular solution. It is a general property of linear equations that the general solution can be written as the sum of the general solution to the homogeneous equation and any solution to the non-homogeneous equation. This structure will appear again when higher-order ODEs and systems of ODEs are studied.

>

4.B Integrating Factor for a First-Order Linear ODE

Knowledge of the structure of solutions to linear ODEs is important, but does not provide too much information about finding solutions to the general first-order linear ODE.

> lin_ode;

diff(x(t),t)+p(t)*x(t) = f(t)

>

The general procedure for solving a first-order linear ODE is to find an integrating factor, mu(t) , for the ODE. That is, find a function mu(t) such that when the ODE is multiplied by mu(t) the left-hand side of the resulting equation can be written as the derivative of the product mu(t)*x(t) . The general formula for the integrating factor for this ODE is

mu(t) = exp(int(p(t),t)) .

The advantage that this presents is that the differential equation now has the form

diff(X(t),t) = F(t) ,

where X(t) = mu(t)*x(t) and F(t) = mu(t)*f(t) . The explicit general solution of this equation can be found by direct integration to be

X(t) = Int(diff(X(t),t),t) = Int(F(t),t)+C .

To conclude, the solution to the original ODE is found using x(t) = X(t)/mu(t) . Instead of writing the general formula, implement this approach for a specific problem.

Consider the ODE

> lin_ode1 := diff( x(t), t ) + x(t)/(t+1) = ln(t)/(t+1);

lin_ode1 := diff(x(t),t)+x(t)/(t+1) = ln(t)/(t+1)

>

In this problem, p(t) = 1/(t+1) and f(t) = ln(t)/(t+1) . Thus, the integrating factor is

> int_fact := mu(t) = exp( Int( 1/(t+1), t ) );

int_fact := mu(t) = exp(Int(1/(t+1),t))

> int_fact1 := value( int_fact );

int_fact1 := mu(t) = t+1

>

The DEtools package contains intfactor , a procedure that will find an integrating factor for problems of this type.

> intfactor( lin_ode1 );

t+1

>

> ode2 := subs( int_fact1, mu(t)*lin_ode1 );

ode2 := (t+1)*(diff(x(t),t)+x(t)/(t+1)) = ln(t)

>

While this equation is rather complicated, the definition of the integrating factor allows us to replace the left-hand side with a single derivative

> ode3 := subs( int_fact1, Diff( mu(t)*x(t), t ) ) = rhs(ode2);

ode3 := Diff((t+1)*x(t),t) = ln(t)

>

This differential equation can be solved by direct integration

> int_ode3 := map(Int, ode3, t );

int_ode3 := Int(Diff((t+1)*x(t),t),t) = Int(ln(t),t...

>

The left-hand side is trivial to evaluate, Maple does a fine job with the right-hand side. The result, after adding the constant of integration, is

> q1 := subs( int_fact1, mu(t)*x(t) ) = int( rhs(ode3), t ) + C;

q1 := (t+1)*x(t) = t*ln(t)-t+C

>

The explicit general solution to this first-order linear ODE is

> expl_soln := op(solve( q1, {x(t)} ));

expl_soln := x(t) = (t*ln(t)-t+C)/(t+1)

>

That this solution satisfies the original differential equation is confirmed with

> odetest( expl_soln, lin_ode1 );

0

>

To emphasize the structure of this solution, the homogeneous and particular solutions are

> soln_h := x(t) = coeff( rhs(expl_soln), C );

soln_h := x(t) = 1/(t+1)

> soln_p := x(t) = subs( C=0, rhs(expl_soln));

soln_p := x(t) = (t*ln(t)-t)/(t+1)

>

as confirmed by

> odetest( soln_h, lhs(lin_ode1)=0 );

0

> odetest( soln_p, lin_ode1 );

0

>

[Back to ODE Powertool Table of Contents]

>