Application Center - Maplesoft

App Preview:

Lesson 10: Substitution and Change of Variables

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

Learn about Maple
Download Application


 

Lesson10.mw

ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL

Lesson 10 -- Substitution and Change of Variables

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 10

10.A Example 1: Homogeneous Equations

10.B Example 2: Bernoulli Equations

10.C Example 3: Reduction to Separation of Variables

10.D Example 4: Riccati Equations

>

Initialization

> restart;

> with( DEtools ):

> with( plots ):

> with( PDEtools ):

Warning, the name changecoords has been redefined

>

10.A Example 1: Homogeneous Equations

A function f(x, y) is said to be homogeneous of degree k if f(t*x, t*y) = t^k*f(x, y) .  Thus, if the variables x and y are replaced by t*x and t*y , respectively, a factor of t^k can be extracted, and the remaining factor is just f(x, y) .

A homogeneous differential equation has the general form

> ode1 := M(x,y(x)) + N(x,y(x)) * diff( y(x),x ) = 0;

ode1 := M(x, y(x))+N(x, y(x))*(diff(y(x), x)) = 0

>

where the functions M and N are both homogeneous of the same degree.  Thus, there exists a constant alpha such that

M(t*x, t*y) = t^alpha*M(x, y)

and

N(t*x, t*y) = t^alpha*N(x, y)

For example, consider the functions

> M := (x,y) -> x^2+y^2:
N := (x,y) -> x^2-x*y:

'M'(x,y) = M(x,y);

'N'(x,y) = N(x,y);

M(x, y) = x^2+y^2

N(x, y) = x^2-y*x

>

which produce the differential equation

> ode1;

x^2+y(x)^2+(x^2-y(x)*x)*(diff(y(x), x)) = 0

>

To check that this is a homogeneous ODE, observe that

> 'M'(tx,ty) = simplify( M(t*x,t*y) / M(x,y) ) * 'M'(x,y);

> 'N'(tx,ty) = simplify( N(t*x,t*y) / N(x,y) ) * 'N'(x,y);

M(tx, ty) = t^2*M(x, y)

N(tx, ty) = t^2*N(x, y)

>

To find the general solution to this ODE, introduce the change of variables

> ch_of_var := y(x) = x * u(x);

ch_of_var := y(x) = x*u(x)

>

The ODE becomes

> q1 := dchange( ch_of_var, ode1, [u(x)] );

q1 := x^2+x^2*u(x)^2+(x^2-x^2*u(x))*(u(x)+x*(diff(u(x), x))) = 0

>

This simplifies to

> sep_ode1 := simplify( isolate( q1, diff(u(x),x) ) );

sep_ode1 := diff(u(x), x) = (1+u(x))/(x*(-1+u(x)))

>

which is easily seen to be a separable equation

> odeadvisor( sep_ode1 );

[_separable]

>

The (implicit) solution to this equation is

> sol_u := dsolve( sep_ode1, u(x), [separable], implicit );

sol_u := ln(x)-u(x)+2*ln(1+u(x))+_C1 = 0

>

Reversing the change of variables, the solution to the original ODE is

> sol_y := dchange( isolate(ch_of_var,u(x)), sol_u, [y(x)] );

sol_y := ln(x)-y(x)/x+2*ln(1+y(x)/x)+_C1 = 0

>

That this equation defines a solution is confirmed with

> odetest( sol_y, ode1 );

0

>

Note that Maple's built-in commands can be used, first to classify this ODE as homogeneous:

> odeadvisor( ode1 );

[[_homogeneous, `class A`], _rational, [_Abel, `2nd type`, `class B`]]

>

then to find the general solution in the explicit form

> expl_sol := genhomosol( ode1 );

expl_sol := {y(x) = -x+x*exp(-LambertW(-1/2*exp((-1)/2)*exp(-1/2*_C1)/x^(1/2))-1/2-1/2*_C1-1/2*ln(x))}

>

However, people are not familiar with the Lambert W function. To obtain the solution of this homogeneous ODE in an implicit form, use

> dsolve( ode1, y(x), [homogeneous], implicit );

y(x)/x-2*ln((x+y(x))/x)-ln(x)-_C1 = 0

>

which is seen to be equivalent to the previous solution.

>

10.B Example 2: Bernoulli Equations

A Bernoulli equation has the form

> diff( x(t), t ) = f(t) * x(t) + g(t) * x(t)^alpha;

diff(x(t), t) = f(t)*x(t)+g(t)*x(t)^alpha

>

for known functions f and g and a constant alpha (not equal to 0 or 1).

For example, consider the differential equation

> ode2 := diff( x(t), t ) = a * x(t) - b * x(t)^3;

ode2 := diff(x(t), t) = a*x(t)-b*x(t)^3

>

where a and b are real constants with a <> 0 . This is a Bernoulli equation with

> alpha := 3;

alpha := 3

>

To convert the Bernoulli equation into a first-order linear ODE, consider the substitution

> ch_of_var := x(t) = u(t)^(1/(1-alpha));

ch_of_var := x(t) = 1/u(t)^(1/2)

>

The ODE for the new function u(t) is

> q1 := dchange( ch_of_var, ode2, [u(t)] );

q1 := -1/2*(diff(u(t), t))/u(t)^(3/2) = a/u(t)^(1/2)-b/u(t)^(3/2)

>

which simplifies to

> lin_ode := simplify( isolate( q1, diff(u(t),t) ));

lin_ode := diff(u(t), t) = -2*a*u(t)+2*b

>

The solution to this linear ODE is

> lin_sol := dsolve( lin_ode, u(t), [linear] );

lin_sol := u(t) = b/a+exp(-2*a*t)*_C1

>

and the corresponding implicit solution for the original function x(t) is

> sol2 := dchange( isolate(ch_of_var,u(t)), lin_sol, [x(t)] );

sol2 := 1/x(t)^2 = b/a+exp(-2*a*t)*_C1

>

To verify that this is a solution of the original ODE, use

> odetest( sol2, ode2 );

0

>

The solution might be a little more useful in the form

> sol2a := map( u->simplify(1/u), sol2 );

sol2a := x(t)^2 = a/(b+exp(-2*a*t)*_C1*a)

>

Immediate access to the solution of this Bernoulli equations can be obtained with the single command

> dsolve( ode2, x(t), [Bernoulli], implicit );

1/x(t)^2-b/a-exp(-2*a*t)*_C1 = 0

>

from which either of the above implicit solutions, or the explicit solution, can be derived.

The bernoullisol command yields the two branches of the square root that are solutions.  The result is

> bernoullisol( ode2 );

{x(t) = ((b+exp(-2*a*t)*_C1*a)*a)^(1/2)/(b+exp(-2*a*t)*_C1*a), x(t) = -((b+exp(-2*a*t)*_C1*a)*a)^(1/2)/(b+exp(-2*a*t)*_C1*a)}

>

The choice of branch depends on the signs of a , b , and the initial condition.

>

10.C Example 3: Reduction to Separation of Variables

Any ODE of the form

> Diff( y, x ) = F( a*x + b*y + c );

Diff(y, x) = F(a*x+b*y+c)

>

with b <> 0 can be reduced to a separable ODE via the substitution u = a*x+b*y(x)+c .

For example, the ODE

> ode3 := diff( y(x), x ) = ( x+y(x)+2 )^2;

ode3 := diff(y(x), x) = (x+y(x)+2)^2

>

is of the appropriate form with a = 1 , b = 1 , c = 2 , and F(z) = z^2 . Thus, the substitution

> ch_of_var := u(x) = x + y(x) + 2;

ch_of_var := u(x) = x+y(x)+2

>

leads to a differential equation for u(x) .  This equation is

> u_ode := dchange( isolate(ch_of_var,y(x)), ode3, [u(x)] );

u_ode := (diff(u(x), x))-1 = u(x)^2

>

which is easily seen to be separable via the syntax

> odeadvisor( u_ode, [separable] );

[_separable]

>

The implicit general solution to this separable differential equation is

> u_sol := dsolve( u_ode, u(x), [separable], implicit );

u_sol := x-arctan(u(x))+_C1 = 0

>

The corresponding explicit solution is

> u_sol_expl := dsolve( u_ode, u(x), [separable] );

u_sol_expl := u(x) = tan(x+_C1)

>

Reversing the substitution to obtain the implicit general solution to the differential equation for y(x) gives

> sol3 := dchange( ch_of_var, u_sol, [y(x)] );

sol3 := x-arctan(x+y(x)+2)+_C1 = 0

>

The corresponding explicit solution can be obtained from

> sol3_expl := isolate( sol3, y(x) );

sol3_expl := y(x) = tan(x+_C1)-x-2

>

Note that simply using

> dchange( ch_of_var, u_sol_expl, [y(x)] );

x+y(x)+2 = tan(x+_C1)

>

does not produce an explicit formula for the general solution. It is still necessary to use isolate , or something similar, as is seen from

> isolate( dchange( ch_of_var, u_sol_expl, [y(x)] ), y(x) );

y(x) = tan(x+_C1)-x-2

>

That these functions are solutions to the original ODE is seen from either of

> odetest( sol3, ode3 );

> odetest( sol3_expl, ode3 );

0

0

>

Immediate access to the implicit and explicit solutions can be obtained using

> dsolve( ode3, y(x), implicit );

-arctan(x+y(x)+2)+x-_C1 = 0

>

and

> dsolve( ode3, y(x) );

y(x) = -x-2+tan(x-_C1)

>

10.D Example 4: Riccati Equations

A Riccati equation has the form

> diff( x(t), t ) = f(t) * x(t)^2 + g(t) * x(t) + h(t);

diff(x(t), t) = f(t)*x(t)^2+g(t)*x(t)+h(t)

>

for given functions f, g, and h. The solution of a Ricatti equation requires knowledge of a particular solution to the ODE.

For example, consider the equation

> ode4 := diff( x(t), t ) = -x(t)^2 + 2*t*x(t) - t^2+5;

ode4 := diff(x(t), t) = -x(t)^2+2*t*x(t)-t^2+5

>

which has as one of its solutions the function

> X := t-2;

X := t-2

>

That this is a solution is confirmed by

> odetest( x(t)=X, ode4 );

0

>

To solve a Riccati equation, define a new function u(t) such that,

> ch_of_var := u(t) = x(t) - X;

ch_of_var := u(t) = x(t)-t+2

>

This substitution translates the ODE for x(t) into one for the new function u(t) , and results in the equation

> ode_u := dchange( isolate(ch_of_var,x(t)), ode4, [u(t)] );

ode_u := (diff(u(t), t))+1 = -(u(t)+t-2)^2+2*t*(u(t)+t-2)-t^2+5

>

which simplifies to

> bern_ode := collect( isolate( ode_u, diff(u(t),t) ), u(t) );

bern_ode := diff(u(t), t) = -u(t)^2+4*u(t)-(t-2)^2-t^2+4+2*t*(t-2)

>

Upon inspection, this ODE is seen to be a Bernoulli equation via the syntax

> odeadvisor( bern_ode, [Bernoulli] );

[_Bernoulli]

>

Its solution us

> bern_sol := dsolve( bern_ode, u(t), [Bernoulli] );

bern_sol := u(t) = 4/(1+4*exp(-4*t)*_C1)

>

Reversing the substitution gives

> sol4 := dchange( ch_of_var, bern_sol, [x(t)] );

sol4 := x(t)-t+2 = 4/(1+4*exp(-4*t)*_C1)

>

To check that this is a solution to the original ODE, use

> odetest( sol4, ode4 );

0

>

Note that the original equation can be classified as a Riccati equation using

> odeadvisor( ode4, [Riccati] );

[_Riccati]

>

and solved in one step using either

> riccatisol( ode4 );

{x(t) = t+2-exp(-4*t)/(_C1+1/4*exp(-4*t))}

>

or

> dsolve( ode4, x(t), [Riccati] );

x(t) = t+2-exp(-4*t)/(_C1+1/4*exp(-4*t))

>

[Back to ODE Powertool Table of Contents]

>