Application Center - Maplesoft

App Preview:

Lesson 4: First-Order Linear Equations

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Lesson04.mw

ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL

Lesson 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 Lesson 4

4.A Structure of Solutiosn to Linear ODEs

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

>

Initialization

> restart;

> with( DEtools ):

> with( plots ):

Warning, the name changecoords has been redefined

>

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)

>

The dependent function x(t) and its first derivative, dx/dt , appear linearly, that is, appear as a linear combination with variable coefficients.  Note that, in general, this is not a separable ODE, as Maple shows via

> odeadvisor( lin_ode, [separable] );

[NONE]

>

If p(t) and f(t) are both constants, then the ODE is separable, in which case the solution can be found as in Lesson 3.

The constant-coefficient linear equation

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

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

>

is verified separable by Maple via

> odeadvisor( lin_ode_const, [separable] );

[_separable]

>

Maple's solution process can be seen with

> infolevel[dsolve] := 3:

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

> infolevel[dsolve] := 0:

`Methods for first order ODEs:`
`--- 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, that is, the term

> 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 ).  This is verified via

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

0

>

The constant term, namely,

> 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, as is seen via

> 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 (particular)  solution to the non-homogeneous equation. This structure will appear again when linear equations of higher-order, and linear systems of first-order 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

dx/dt+p(t)*x(t) = f(t)

A procedure for solving the first-order linear ODE consists of finding an integrating factor, mu(t) , for the ODE. An integrating factor is a function mu(t) that, upon multiplication against the left-hand side of the equation, renders the product an exact derivative.  Thus, the integrating factor mu(t) is characterized by the property that

(`x'`(t)+p(t)*x(t))*mu(t) = d/dt ``(mu(t)*x(t))

In other words, mu(t) is a factor that allows the left-hand side of the ODE to be written as the derivative of the product mu(t)*x(t) .

The general formula for the integrating factor for the first-order linear ODE is

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

Multiplication of the ODE by this factor leads to an equation of 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 .

Thus,

x(t)*mu(t) = int(f(t)*mu(t), t)+C

and the solution to the original ODE is found using

x(t) = X(t)/mu(t) = (int(f(t)*mu(t), t)+C)/mu(t) = exp(-int(p, t))*int(f(t)*exp(int(p, t)), t)+C*exp(-int(p, t))

Instead of focusing on the general formula, implement the solution process for each specific problem.

For example, consider the specific first-order linear 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))

>

which evaluates to

> 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.  It gives

> intfactor( lin_ode1 );

t+1

>

which is exactly what was obtained above.

Multiplication of the ODE by this integrating factor yields

> 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 the single derivative

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

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

>

Maple cannot make this transformation in the "forward" direction, but can verify it "in reverse."  Simply evaluate the derivative on the left to obtain

> expand(convert(ode3,diff));

x(t)+(diff(x(t), t))*t+(diff(x(t), t)) = ln(t)

>

which compares favorably with

> simplify(ode2);

x(t)+(diff(x(t), t))*t+(diff(x(t), t)) = ln(t)

>

The equation

> ode3;

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

>

can be solved by direct integration, that is, by antidifferentiation of both sides.  The result is

> 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, and Maple does a fine job with the right-hand side.  After evaluating these indefinite integrals and adding the constant of integration, the result 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 the given first-order linear ODE is therefore

> 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 respectively

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

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

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

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

>

as confirmed by

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

> odetest( soln_p, lin_ode1 );

0

0

>

[Back to ODE Powertool Table of Contents]

>