Application Center - Maplesoft

# Lesson 2: Separable Equations

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

Lesson02.mw

ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL

Lesson 2 -- Separable Equations

Columbia, SC 29208

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

 >

Outline for Lesson 2

2.A General Solution Method for Separable ODEs

2.B Cross-Check of Solutions

2.C Closing Comment (separablesol and dsolve)

 >

Initialization

 > restart;

 > with( DEtools ):

 > with( plots ):

Warning, the name changecoords has been redefined

 >

2.A General Solution Method for Separable ODEs

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

.

or equivalently, in one of the forms

or

For example, consider the equation

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

 >

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

 >

In this case, it is easily seen that the variables are separated in this ODE when it is multiplied by , resulting in

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

 >

Once in separated form, the solution is obtained by integration of the separated equation with respect to the independent variable.  The usual notation for this calculation involves the differential, the product of a derivative such as and an increment such as .  By definition, the differential is , so multiplication of the form

by the increment yields the form

which yields to antidifferentiation of both sides via the notation

Since Maple does not have a true implementation of differentials, the differentials and are supplied my Maple's Int command, the inert form of the int command.  Integration is mapped, or placed, on each side of the equation by the map command, yielding

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

 >

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);

 >

(Maple will add equations, so the constant of integration can be "added" to the right side of the implicit solution by the dodge of adding the "equation" .)

Of the three explicit expressions for that are obtained from this implicit solution via

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

 >

only one is real-valued, namely,

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

 >

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

If an initial condition

 > ic := y(1) = 2;

 >

is provided, it can be used to determine a specific value for the constant in the general solution.  First, substitute into the general solution to get

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

 >

then solve for to obtain

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

 >

The resulting (explicit) particular solution to the IVP is

 > real_part_soln := subs( soln_C, real_expl_soln );

 >

A plot of this solution could be obtained with

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

 >

The initial condition can be applied earlier in the problem, at the time of the integration. This would require the following modification of the integration process, using definite instead of indefinite integrals.

In Maple, integrating both sides of the equation

 > sep_var;

 >

with respect to the independent variable is simplest.  The requisite calculation is

where is the variable of integration.

The evaluated form of this equation is obtained in Maple via

 > def_int_sep_var2 := map(int, sep_var, x=1.._x, continuous);

 >

Substitution of the initial condition

 > ic;

 >

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

 >

Solving explicitly for the real branch of is implemented with

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

 >

Alternatively, the dependent variable can be used as the integration variable on the left, and the independent variable, on the right.  Using as the variable of integration on both sides, the equation

becomes

The simplest way to obtain this version of the integration is to rebuild the integrals via the tedious

 > temp := eval(sep_var,{diff(y(x),x)=1,y(x)=alpha, x=alpha}): new_form := Int(lhs(temp),alpha=rhs(ic)..y(x)) = Int(rhs(temp),alpha=op(lhs(ic))..x);

 >

 > eval_new_form := value(new_form);

 >

and isolating the dependent variable leads to the same real-valued solution as found earlier.

 > op(op( remove( has, {solve( eval_new_form, {y(x)} )}, I ) ));

 >

2.B Cross-Check of Solutions

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

 > odetest( gen_impl_soln, ode ); odetest( real_part_soln, ode ); odetest( part_impl_soln2, ode ); odetest( real_part_soln2, ode );

 >

2.C Closing Remarks

The DEtools package contains separablesol , a procedure designed specifically for the solution of separable ODEs.  Applying it to the differential equation

 > ode;

 >

 > separablesol( ode );

 >

The dsolve command returns the same result, but might not have used the same method, as we can see from

 > infolevel[dsolve] := 3:

 > dsolve( ode, y(x) );

`Methods for first order ODEs:`
`--- Trying classification methods ---`

`trying 1st order linear`

`trying Bernoulli`

`<- Bernoulli successful`

 >

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

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

 > infolevel[dsolve] := 0:

`Classification methods on request`
`Methods to be used are: [separable]`

`----------------------------`

`* Tackling ODE using method: separable`

`--- Trying classification methods ---`

`trying separable`

`<- separable successful`

 >