Application Center - Maplesoft

App Preview:

Lesson 2: Separable Equations

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

Learn about Maple
Download Application


Lesson 2 -- Separable Equations

Prof. Douglas B. Meade

Industrial Mathematics Institute

Department of Mathematics

University of South Carolina

Columbia, SC 29208



Copyright  2001  by Douglas B. Meade

All rights reserved



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)



> 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

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

or equivalently, in one of the forms

F(y(x))*`y'`(x) = G(x)


F(y)*dy = G(x)*dx

For example, consider the equation

> 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 Lesson 1 (Section E) , the odeadvisor command can be used to check the classification of an ODE.  It yields

> odeadvisor(ode,[separable]);



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

> 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.  The usual notation for this calculation involves the differential, the product of a derivative such as `y'` = dy/dx and an increment such as dx .  By definition, the differential dy is `y'`*dx , so multiplication of the form

F(y(x))*`y'`(x) = G(x)

by the increment dx yields the form

F(y)*dy = G(x)*dx

which yields to antidifferentiation of both sides via the notation

int(F(y), y) = int(G(x), x)

Since Maple does not have a true implementation of differentials, the differentials dy and dx 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 );

int_sep_var := Int(y(x)^2*(diff(y(x), x)), x) = Int(exp(x)*x, 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);

gen_impl_soln := 1/3*y(x)^3 = (-1+x)*exp(x)+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" 0 = C .)

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

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

all_expl_soln := {y(x) = (-3*exp(x)+3*exp(x)*x+3*C)^(1/3)}, {y(x) = -1/2*(-3*exp(x)+3*exp(x)*x+3*C)^(1/3)+1/2*I*3^(1/2)*(-3*exp(x)+3*exp(x)*x+3*C)^(1/3)}, {y(x) = -1/2*(-3*exp(x)+3*exp(x)*x+3*C)^(1/3)...


only one is real-valued, namely,

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

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


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

If an initial condition

> ic := y(1) = 2;

ic := y(1) = 2


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

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

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


then solve for C to obtain

> 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)+3*exp(x)*x+8)^(1/3)


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;

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


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

Int(y(alpha)^2*(diff(y(alpha), alpha)), alpha = 1 .. x) = Int(exp(alpha)*alpha, alpha = 1 .. x)

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

def_int_sep_var2 := -1/3*y(1)^3+1/3*y(_x)^3 = (_x-1)*exp(_x)


Substitution of the initial condition

> ic;

y(1) = 2


leads to

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

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


Solving explicitly for the real branch of y(x) is implemented with

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

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


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

int(F(y), y) = int(G(x), x)


int(F(alpha), alpha = 2 .. y) = int(g(alpha), alpha = 1 .. x)

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

new_form := Int(alpha^2, alpha = 2 .. y(x)) = Int(exp(alpha)*alpha, alpha = 1 .. x)


Evaluation leads to

> eval_new_form := value(new_form);

eval_new_form := -8/3+1/3*y(x)^3 = (-1+x)*exp(x)


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

y(x) = (-3*exp(x)+3*exp(x)*x+8)^(1/3)


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;

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


leads to

> separablesol( ode );

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


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 a quadrature`

`trying 1st order linear`

`trying Bernoulli`

`<- Bernoulli successful`

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


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`

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


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


[Back to ODE Powertool Table of Contents]