unit02.mws

ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL

Unit 2 -- Separable 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 for Unit 2

>

Initialization

> restart;

> with( DEtools ):

> with( plots ):

> with( linalg ):

Warning, the name changecoords has been redefined

Warning, the name adjoint has been redefined

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

>

2.A General Solution Method for Separable ODEs

A separable differential equation is a differential equation that can be written in the form

diff(y(x),x) = f(y(x))/g(x) .

> ode := y(x)/x*diff( y(x), x ) = exp(x)/y(x);

ode := y(x)*diff(y(x),x)/x = exp(x)/y(x)

>

As discussed in Unit 1 (Section E), the odeadvisor command can be used to check the classification of an ODE.

> odeadvisor(ode,[separable]);

[_separable]

>

In this case, it is easily seen that the variables are separated in this ODE when it is multiplied by y(x)*x :

> sep_var := ode * y(x)*x ;

sep_var := y(x)^2*diff(y(x),x) = exp(x)*x

>

Once in separated form, the solution is obtained by integration of the separated equation with respect to the independent variable:

> int_sep_var := map( Int, sep_var, x );

int_sep_var := Int(y(x)^2*diff(y(x),x),x) = Int(exp...

>

Evaluating these indefinite integrals, and adding a constant of integration to one side of the equation, leads to an implicit form of the general solution:

> gen_impl_soln := value( int_sep_var ) + (0=C);

gen_impl_soln := 1/3*y(x)^3 = exp(x)*x-exp(x)+C

>

Of the three explicit expressions for y(x) that are obtained from this implicit solution

> all_expl_soln := solve( gen_impl_soln, {y(x)} );

all_expl_soln := {y(x) = (3*exp(x)*x-3*exp(x)+3*C)^...
all_expl_soln := {y(x) = (3*exp(x)*x-3*exp(x)+3*C)^...

>

only one is real-valued:

> real_expl_soln := op(op(remove( has, {all_expl_soln}, I )));

real_expl_soln := y(x) = (3*exp(x)*x-3*exp(x)+3*C)^...

>

Of course, the constant 3*C could be replaced by a new constant, but this is not an essential step.

>

If an initial condition is provided,

> ic := y(1)=2;

ic := y(1) = 2

>

it can be used to determine a specific value for the constant in the solution:

> eqn_for_C := subs(x=1,ic,real_expl_soln);

eqn_for_C := 2 = 3^(1/3)*C^(1/3)

> soln_C := solve( eqn_for_C, {C} );

soln_C := {C = 8/3}

>

The resulting (explicit) particular solution to the IVP is

> real_part_soln := subs( soln_C, real_expl_soln );

real_part_soln := y(x) = (3*exp(x)*x-3*exp(x)+8)^(1...

>

A plot of this solution could be obtained with

> plot( rhs(real_part_soln), x=-1..3 );

[Maple Plot]

>

The initial condition can be applied earlier in the problem, at the time of the integration. This would require the following modification of the previous solution procedure:

> int_sep_var2 := map( Int, sep_var, x=1.._x );

int_sep_var2 := Int(y(x)^2*diff(y(x),x),x = 1 .. _x...

> part_impl_soln2 := subs( _x=x, ic, value( int_sep_var2 ) );

part_impl_soln2 := 1/3*y(x)^3-8/3 = exp(x)*x-exp(x)...

>

In the above two commands, note i) the use of the dummy name, _x, as the upper limit of integration and ii) that it was not necessary to introduce an integration constant. The real-valued solution to this equation is, as before,

>

> real_part_soln2 := op(op( remove( has, {solve( part_impl_soln2, {y(x)} )}, I ) ));

real_part_soln2 := y(x) = (3*exp(x)*x-3*exp(x)+8)^(...

>

2.B Cross-Check of Solutions

Observe that all solutions, implicit or explicit, satisfy the original ODE:

> odetest( gen_impl_soln, ode );

0

> odetest( real_part_soln, ode );

0

> odetest( part_impl_soln2, ode );

0

> odetest( real_part_soln2, ode );

0

>

2.C Closing Remarks

The DEtools package contains separablesol , a procedure designed specifically for the solution of separable ODEs.

> separablesol( ode );

{y(x) = -1/2*(3*exp(x)*x-3*exp(x)+3*_C1)^(1/3)+1/2*...
{y(x) = -1/2*(3*exp(x)*x-3*exp(x)+3*_C1)^(1/3)+1/2*...

>

The dsolve command returns the same result, but might not have used the same method.

> infolevel[dsolve] := 3:

> dsolve( ode, y(x) );

Methods for first order ODEs:

Trying to isolate the derivative dy/dx...

Successful isolation of dy/dx

-> Trying classification methods

trying a quadrature

trying 1st order linear

trying Bernoulli

Bernoulli successful

y(x) = (3*exp(x)*x-3*exp(x)+_C1)^(1/3), y(x) = -1/2...
y(x) = (3*exp(x)*x-3*exp(x)+_C1)^(1/3), y(x) = -1/2...

>

To force dsolve to use a specific method, an optional argument can be specified:

> dsolve( ode, y(x), [separable] );

> infolevel[dsolve] := 0:

Classification methods on request

Methods to be used are:   [separable]

Trying to isolate the derivative dy/dx...

Successful isolation of dy/dx

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

* Tackling ODE using method:   separable

   -> Trying classification methods

   trying separable

   separable successful

y(x) = (3*exp(x)*x-3*exp(x)+3*_C1)^(1/3), y(x) = -1...
y(x) = (3*exp(x)*x-3*exp(x)+3*_C1)^(1/3), y(x) = -1...

>

For additional information about this syntax, please consult the help topic dsolve,education .

>

[Back to ODE Powertool Table of Contents]

>