PAGE 1

Differential Equation Problem 14

\[ (9x^2 + y - 1) - (4y - x)y' = 0, \quad y(1) = 0 \]

The initial condition \( y(1) = 0 \) implies that when \( x = 1 \), \( y = 0 \).

After integration and applying the initial condition, we obtain the implicit solution:

\[ 3x^3 + xy - x - 2y^2 = C \]

Substituting \( x = 1 \) and \( y = 0 \):

\[ 3 - 1 = C \implies C = 2 \]

The specific solution is:

\[ 3x^3 + xy - x - 2y^2 = 2 \]

Solving for \( y = f(x) \)

To express \( y \) explicitly as a function of \( x \), we rearrange the equation into a quadratic form in terms of \( y \):

\[ -2y^2 + xy + (3x^3 - x - 2) = 0 \]\[ 2y^2 - xy - (3x^3 - x - 2) = 0 \]

This is a quadratic equation in \( y \) of the form \( ay^2 + by + c = 0 \).

Using the quadratic formula \( y = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \):

\[ y = \frac{x \pm \sqrt{x^2 + 4(2)(3x^3 - x - 2)}}{2(2)} \]

Checking the initial condition \( y(1) = 0 \) to determine the correct sign.

PAGE 2

Substituting \( x = 1 \) into the quadratic formula result:

\[ 0 = \frac{1 \pm \sqrt{1 + 24 - 8 - 16}}{4} = \frac{1 \pm \sqrt{1}}{4} \]

To satisfy \( y(1) = 0 \), we must choose the negative root: \( \frac{1 - 1}{4} = 0 \).

The explicit solution is:

\[ y = \frac{x - \sqrt{24x^3 + x^2 - 8x - 16}}{4} \]

Domain of Validity

The solution is valid if the expression under the square root is non-negative:

\[ 24x^3 + x^2 - 8x - 16 \geq 0 \]

This can be solved using a numerical solver (e.g., Wolfram Alpha) by finding the roots of:

\[ 24x^3 + x^2 - 8x - 16 = 0 \]
PAGE 3

18. Any Separable is Exact

\[ M(x) dx + N(y) dy = 0 \longrightarrow \int M(x) dx = \int -N(y) dy \]

no \( y \)

no \( x \)

Exactness Condition

Exact if \( M_y = N_x \)

\[ \begin{cases} \frac{\partial M(x)}{\partial y} = 0 \\ \frac{\partial N(y)}{\partial x} = 0 \end{cases} \] \( M_y = N_x \) exact
PAGE 4

F. Example: Exact Differential Equation

\[ \frac{dw}{dt} = \frac{2tw}{w^2 - t^2} \quad \text{exact} \]

Rewriting in differential form:

\[ (2tw) dt - (w^2 - t^2) dw = 0 \]

M

N

\( t : x \)

\( w : y \)

Verification of Exactness

Exact if \( M_w = N_t \)

\[ 2t = 2t \quad \text{exact.} \]

Finding the Potential Function \( \psi \)

\( \psi = C \), where \( \psi_t = M \) and \( \psi_w = N \)

\[ \psi = \int M dt = \int 2tw dt = t^2w + h(w) \]
\[ \psi_w = t^2 + h'(w) = -w^2 + t^2 \]
\[ h'(w) = -w^2 \] \[ h(w) = -\frac{1}{3}w^3 \]

Solution

\( t^2w - \frac{1}{3}w^3 = C \)

so \( -t^2w + \frac{1}{3}w^3 = C \) is also ok

PAGE 5

2.7 Numerical method: Euler's Method

A numerical method solves \( y' = f(t, y) \) by finding values of \( y(t) \) for arbitrary \( t \) without finding \( y(t) \) explicitly.

  • Find dots instead of a curve
A coordinate graph with t and y axes showing a series of discrete data points (dots) instead of a continuous curve.

Normally used when the equation can't be solved by hand (analytically) or is impractical to do so.

PAGE 6

Euler's Method

Graph showing a solution curve y(t) and a tangent line at (t0, y0) used to estimate y(t1).

Solution curve \( y(t) \) (usually not known) but we know \( y'(t) = f(t, y) \) from the Differential Equation (DE).

\( \rightarrow \) We know the slope of \( y \).

If \( h = t_1 - t_0 \) is "small", then the estimate \( y(t_1) \) is normally pretty good.

Equation of the tangent line at \( (t_0, y_0) \) is:

\( y - y_0 = y'(t_0)(t - t_0) \)

\( y = y(t_0) + y'(t_0)(t - t_0) \)
PAGE 7

Euler's Method for Numerical Solutions

\[ y_{n+1} = y_n + f(t_n, y_n) h \]

new \( y \)
old \( y \)
slope at old \( (t, y) \)
step size

\[ \frac{dy}{dt} = f(t, y) \]

\( h \): time interval (step size)

Example

Given the differential equation:

\[ y' = 0.5 - t + 2y, \quad y(0) = 1 \]

Use step size \( h = 0.1 \) to estimate \( y(0.3) \).

\( t = 0 \):

\( y_0 = 1 \) (given)

\( t = 0.1 \):

\( y_1 = y_0 + f(t_0, y_0) h \)

\( y_1 = 1 + (0.5 - 0 + 2 \cdot 1)(0.1) = 1.25 \)

\( t = 0.2 \):

\( y_2 = y_1 + f(t_1, y_1) h \)

\( y_2 = 1.25 + (0.5 - 0.1 + 2 \cdot 1.25)(0.1) = 1.54 \)

\( t = 0.3 \):

\( y_3 = 1.54 + (0.5 - 0.2 + 2 \cdot 1.54)(0.1) = 1.878 \)

PAGE 8

Analytical Comparison

Since \( y' = 0.5 - t + 2y \) is linear, we can solve it analytically:

\[ y' - 2y = 0.5 - t \]

Integrating factor:

\[ \mu = e^{\int -2 dt} = e^{-2t} \]

Given initial condition \( y(0) = 1 \), the solution is:

\[ y(t) = 0.5t + e^{2t} \]

Results Comparison

  • True value: \( y(0.3) = 1.972 \)
  • Estimated value: \( 1.878 \)

To improve the estimate, use a smaller step size \( h \) and more steps.

PAGE 9

Numerical Methods Example

Example: \( y' = 5 - 3\sqrt{y} \), \( y(0) = 2 \)

Use Matlab code eul.m

Use step sizes \( h \):

  • \( 0.1 \)
  • \( 0.01 \)
  • \( 0.001 \)
  • \( 0.0001 \)

See Numerical Methods document on:

www.math.purdue.edu/ma266

Estimate \( y(3) \)

Step Size \( h \)Estimate \( y(3) \)
\( 0.1 \)\( y(3) \approx 2.7352 \)
\( 0.01 \)\( y(3) \approx 2.7296 \)
PAGE 10

Numerical Methods and .m Files

  • In order to use MATLAB routines for the Euler, Improved Euler or Runge-Kutta Methods, you will need the files eul.m, rk2.m or rk4.m, respectively. These files are already present on all ITaP machines as standard software. (If using your own copy of MATLAB you may need to download these files from http://math.rice.edu/~dfield/). You may also access these files from MATLAB via the Software Remote:

    http://goremote.ics.purdue.edu

  • You must first create a function file in the same directory (or folder) as your MATLAB. Here is one way: After MATLAB has been opened, pull down the File menu and select New M-File. A window will pop up for you to create your function file. For example, to create a function file for the function \( f(x, y) = 6x^3 - e^{2y} + \sqrt{x}/y \), type:
    function W=fcn1(x,y)
    W=6*x^3-exp(2*y)+sqrt(x)/y;
    (Don't forget the ";" at the end.)
  • Save this file as a .m file with the same name as your function. The above example would be saved as fcn1.m. You can check if your function has been saved by typing something like the following at a MATLAB prompt: fcn1(0,3). You should get the value of \( f(0,3) \).
  • Your initial value problem should have the form:
    \[ \begin{cases} y' = f(x, y) \\ y(x_0) = y_0 \end{cases} \]
    Assuming \( f(x, y) \) was saved as the file fcn1.m, the syntax for eul (as well as rk2 and rk4, just replace eul) will be:
    eul('fcn1', [x0,xf], y0, h)
    where x0 and xf denote the initial and final values of \( x \), respectively, y0 is the initial value of \( y \), and h is the step size. (Your version of MATLAB may not utilize brackets. Type help eul to find out.) To approximate the actual solution to the IVP at xf, with given h, using eul, just type the following at a MATLAB prompt:
    [x,y]=eul('fcn1', [x0,xf], y0, h);
    The approximations \( y_0, y_1, y_2, \dots, y_n \) are stored in the matrix \( y \).
  • To print them out, type: [x, y]
  • To plot them, type: plot(x, y)