Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the second course APMA0340
Return to the main page for the course APMA0330
Return to the main page for the course APMA0340
Return to Part II of the course APMA0330
Sometimes it is convenient to interchange dependent and independent variables. There are cases when the given
differential equation \( \frac{{\text d}y}{{\text d}x} = f(x,y) \) is very hard or
impossible to solve while the inverse equation
\( \frac{{\text d}x}{{\text d}y} = \frac{1}{f(x,y)} \) can be relatively easily handled.
In this case, we consider x = x(y) as a function of y.
So Mathematica provides a solution expressed through a special function. Therefore, we try another approach
based on the inverse problem when x is considered to be a dependent variable:
where F(v) is a given continuous function of a variable v,
and a,b,c are some constants. This equation is reduced to a
separable one by substitution \( v=ax+by +c . \)
Example: Consider the differential equation
\[
y' = 2x+3y+5 ,
\]
Using substitution v = 2x+3y+5, we find its derivative to be
v' = 2 +3 y' = 2 + 3 v, which is a separable one. Separating variables and integrating,
we obtain
Let r be a real number. A function of two variables g(x,y) is called
homogeneous of degreer if
\( g( \lambda x, \lambda y ) = \lambda^r g(x,y) \) for any nonzero constant λ.
Usually homogeneous functions of zero degree are referred to as homogeneous or homogeneous-polar (because the ratio
y/x in polar coordinates is the tangent of the angle). Obviously, a
function of the ratio y/x is a homogeneous-polar function.
Our next class includes differential equations with homogeneous coefficients when the slope function is a
function depending on the ratio y/x:
with some arbitrary constant C. The value of the integral over v depends on whether the roots of
quadratic equation \( Bv^2 + (A-b) \,v - a =0 \) are distinct real, complex conjugate, or
one double root.
Example:
We consider the differential equation with homogeneous slope function
Integrating both sides, we get the general solution in implicit form:
\[
\frac{4}{v+3} + \ln x \left( v+3 \right) = C \qquad\Longrightarrow \qquad \frac{4x}{3x+y} +
\ln \left\vert y + 3x \right\vert = C ,
\]
which is the general solution. Of course, we have to exclude the singular solution y = -3x
from the implicit formula. Finally, we plot the direction fields using VectorPlot command:
Upon returning to the original variable y = xv, we get the general solution in implicit form:
\[
|y-2x|^5 = C\,(y+x)^2 \qquad (C \mbox{ is a constant}).
\]
Initially, we excluded two solutions y = 2x and y = -x from our
derivation because they appeared under the logarithm sign. Now we see that they could be obtained from the general solution
and, therefore, are not singular solutions.
We plot direction fields with StreamPlot command. First, we just use the regular approach by identifying points and then
apply the main command:
Example: We demonstrate reduction of the equation with homogeneous slope function,
y' =-(x^2 + y^2)/(5xy), to a separable equation. Of course,
Mathematica is an appropriate tool for such reduction. We start with defining the differential equation with differentials.
ode[x_, y_] = -(x^2 + y^2)*dx == 5*x*y*dy
Out[8] = dx (-x^2 - y^2) == 5 dy x y
The first step is to replace the differential dy with the sum
dy=xdv + vdx according to the product rule.
ode[x, v*x] /. {dy -> x*dv + v*dx}
Out[9] = dx (-x^2 - v^2 x^2) == 5 v x^2 (dx v + dv x)
Then we substitute instead of y the product y=xv:
Map[Cancel, Map[Function[q, q/x^2], %]]
Out[10] = -dx (1 + v^2) == 5 v (dx v + dv x)
Finally, we simplify the output by collecting similar terms.
Map[Function[u, Collect[u, {dx, dv}]], %]
Out[11] = -dx (1 + v^2) == 5 dx v^2 + 5 dv v x
■
Example: : Consider the initial value problem
y' = 1/(x-y+2), y(0) =1 .
We find its solution and plot it using the following Mathematica commands:
Example: : Suppose that an airplane is positioned at point B(2000,0) to fly to another airport O(0,0) that is 2000 km directly west of its position B. Assume that the airplane aims towards O at all times. If the wind goes from south to north at a constant speed w, and the airplane's speed in still air is v (which is greater than w), determine the airplane's path.
Observe that the derivative \( {\text d}y/{\text d}x \) describes the airplane's velocity in the x direction:
First, we plot direction field using VectorPlot command and then StreamPlot. Since the slope function is defined only for y ≥ x, we see that the former does not provide an adequate qualitative information.
Since x = 0 is a singular point, we exclude it from our consideration. Also the slope function is defined only for y ≥ x, we have to solve the given differential equation in the domain
where C is a not negative constant. The differential equation for v has two singular solutions v = ±1. Correspondingly, the given differential equation has the general solution
and two singular solutions that are marked in red in the figure above.
■
Return to Mathematica page)
Return to the main page (APMA0330)
Return to the Part 1 (Plotting)
Return to the Part 2 (First Order ODEs)
Return to the Part 3 (Numerical Methods)
Return to the Part 4 (Second and Higher Order ODEs)
Return to the Part 5 (Series and Recurrences)
Return to the Part 6 (Laplace Transform)
Return to the Part 7 (Boundary Value Problems)