Lesson08.mw
ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL
Lesson 8 -- Exact 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 8
8.A Basic Theory
8.A-1 Example 1
8.B Integrating Factors
8.B-1 Example 2
Initialization
Warning, the name changecoords has been redefined
8.A Basic Theory
The general form for a first-order exact differential equation is
> |
gen_exact_ode := P(x,y(x)) + Q(x,y(x))*diff(y(x),x) = 0; |
where the functions
and
satisfy the conditions
for some function
. At any point
where
, the equation
, where
is a constant, implicitly defines the function
. Such curves are called level curves, and are the curves in the
-plane above which the surface
maintains the constant height
.
If the function
is so defined implicitly by the equation
, then implicit differentiation gives
=
where subscripts denote partial derivatives. Now this equation is clearly equivalent to the differential equation, namely,
Thus, solving this exact differential equation amounts to finding the exact "antiderivative," the function
whose exact (or total) derivative is just the ODE itself. The level curves
defined implicitly by
are the solutions of the exact differential equation.
To find a condition that guarantees the equation
is exact, consider an arbitrary function
whose level curves are defined by the equation
> |
level_curve := F(x,y(x)) = C; |
for some constant
. If the function
satisfies the the ODE, then the difference of the total derivative of
and the ODE itself should be zero. Thus, the condition for the equation to be exact is
> |
condition_to_be_exact := collect( diff( lhs(level_curve), x ) - lhs( gen_exact_ode ) = 0, diff(y(x),x) ); |
Careful consideration of this equation shows that it is satisfied when
> |
condition1 := isolate( eval( condition_to_be_exact, diff(y(x),x)=0 ), F ); |
> |
condition2 := isolate( coeff( lhs(condition_to_be_exact), diff(y(x),x) ) = 0, F ); |
That is, when
and
.
For arbitrary pairs of functions P and Q, this condition will not be satisfied. However, assuming the function F has continuous second derivatives and the functions P and Q have continuous first derivatives, the equivalence of the mixed second derivatives of F, namely,
> |
equiv_of_mixed_deriv := D[1](D[2](F)(x,y(x))) = D[2](D[1](F)(x,y(x))); |
combines with the previous argument
> |
q1 := D[2](condition1); |
> |
q2 := D[1](condition2); |
to provide necessary and sufficient conditions for an exact equation. This condition is
> |
eval( equiv_of_mixed_deriv, [ D[2](condition1), D[1](condition2) ] ); |
that is,
> |
nec_and_suff_condition := (P,Q) -> diff( Q(x,y), x ) = diff( P(x,y), y ): |
> |
nec_and_suff_condition(P,Q); |
8.A-1 Example 1
Consider the differential equation
> |
ode := exp(y(x)) + (x*exp(y(x))+cos(y(x))) * diff(y(x),x) = 0; |
To check if this ODE is exact, identify the coefficients for the general form
> |
P := unapply( eval( lhs(ode), [diff(y(x),x)=0, y(x)=y] ), (x,y) ): |
> |
Q := unapply( eval( coeff(lhs(ode),diff(y(x),x)), y(x)=y ), (x,y) ):
'P'(x,y) = P(x,y);
'Q'(x,y) = Q(x,y); |
and check the necessary and sufficient condition for exactness:
> |
nec_and_suff_condition(P,Q); |
Since this is an exact equation, we construct the solution in the form
where
and
The first of these is satisfied when
> |
q1 := F(x,y) = int( P(x,y), x ) + g(y); |
To satisfy the second condition requires
> |
q2 := diff( rhs(q1), y ) - Q(x,y) = 0; |
Thus, integrating both sides and isolating
gives
> |
q3 := isolate( map( int, q2, y ), g(y) ); |
and so the function
is
> |
soln_F := eval( rhs(q1), q3 ); |
and the implicit solution of the differential equation is
A quick pause to check that this solution does satisfy the differential equation reveals
> |
odetest( eval(soln,y=y(x)), ode ); |
The function F is also called a first integral of the ODE. The Maple command
firint
, from the
DEtools
package, can be used to express the solution of an exact ODE in terms of its first integral. For example,
Note that essentially the same solution is returned with either of the following single commands
> |
dsolve( ode, y(x), [exact] ); |
The even simpler command
> |
infolevel[dsolve] := 3: |
> |
infolevel[dsolve] := 0: |
`Methods for first order ODEs:`
`--- Trying classification methods ---`
`trying a quadrature`
`trying 1st order linear`
`trying Bernoulli`
`trying separable`
`trying inverse linear`
`<- 1st order linear successful`
`<- inverse linear successful`
returns an equivalent, but different, solution. This is because Maple is able to find several classifications for this example
and uses a different solution method.
8.B Integrating Factors
Most first-order ODEs are not exact. Some of these ODEs can be made exact by multiplying the ODE by an appropriate function so that the new ODE is exact. The integrating factor,
, must be chosen so that the necessary and sufficient condition is satisfied by the coefficients of the ODE after multiplication by
:
Applying the necessary and sufficient condition for exactness to the ODE
leads to
> |
unassign('P','Q','mu'); |
> |
nec_and_suff_condition( mu*P, mu*Q ); |
This is a partial differential equation, but there are numerous cases where the determination of the integrating factor can be completed under the assumption that
is a function of either
or
, but not both. If at least one of
and
is zero, an integrating factor for the original ODE can be found by a process illustrated in the following example.
8.B-1 Example 2
As an example, consider the following ODE,
> |
ode2 := P(x,y(x)) + Q(x,y(x)) * diff( y(x), x ) = 0; |
for which the coefficients
and
are
> |
Q := (x,y) -> x^2-x*y:
'P'(x,y) = P(x,y);
'Q'(x,y) = Q(x,y); |
That this equation is not exact can be seen from
> |
nec_and_suff_condition( P,Q ); |
or from
> |
odeadvisor( ode2, [exact] ); |
An integrating factor, if one exists, must satisfy the partial differential equation
> |
mu_pde := nec_and_suff_condition( mu*P, mu*Q ); |
With a little inspection, it can be seen that this PDE simplifies to a linear ODE when the integrating factor is assumed to be independent of
. The result of this assumption is
> |
mu_ode := eval( mu_pde, mu(x,y)=mu(x) ); |
or better still,
> |
mu_ode2 := simplify( isolate( mu_ode, diff(mu(x),x) ) ); |
The general solution to this separable (and linear) ODE is found to be
> |
mu_sol := dsolve( mu_ode2, mu(x) ); |
Since any (non-trivial) solution can be used as an integrating factor, choose _C1=1 and define
> |
mu := unapply( eval( rhs(mu_sol), _C1=1 ), x ); |
To confirm that this function is an integrating factor for the ODE, apply the necessary and sufficient condition for exactness, obtaining
> |
simplify( nec_and_suff_condition( mu*P, mu*Q ) ); |
or use
> |
odeadvisor( mu(x)*ode2, [exact] ); |
The Maple command
mutest
, in the
DEtools
package, provides an alternate method for checking the validity of an integrating factor for a differential equation:
The
intfactor
command, also from the
DEtools
package, can be used as a black box to find an integrating factor. An integrating factor for this ODE is
The solution to the exact form of the original ODE is
> |
dsolve( mu(x)*ode2, y(x), [exact], implicit ); |
Note that without the optional argument implicit Maple returns the pair of solutions
> |
dsolve( mu(x)*ode2, y(x), [exact] ); |
The specific solution obtained depends upon the specific initial condition.
The same solutions are also obtained from either of
> |
dsolve( ode2, y(x), [exact] ); |
In terms of first integrals, the original ODE is not exact so does not have a first integral
Error, (in ODEtools/firint) the given ODE is not exact
But, when multiplied by the integrating factor, it has the first integral
> |
q := firint( mu(x)*ode2 ); |
which simplifies to the implicit solution found above.
[Back to ODE Powertool Table of Contents]