Differential Equations - Examples

On this page we display several examples to illustrate the concepts and theorems discussed in the Differential Equations theme.

Separable equation

Problem
A projectile is fired horizontaly. The initial velocity is \(v_0\) and the mass is \(m\). Find an expression for the velocity \(v(t)\) in the horisontal direction in terms of the time \(t\).

Solution
We assume that there is no wind, the air density is constant, and that there are no other forces except wind resistence acting on the projectile (gravity only works in the vertical direction). Let the direction of movement be the positive direction. Wind resistence is proportional to \(v^2\), and is then given by \(-kv(t)^2\), where \(k>0\) is a constant depending on the air density and the shape of the projectile. Since acceleration is velocity differentiated, we have by Newtons second law that

\[-kv(t)^2=m v'(t).\]

This is a seperable equation, and we gather \(t\) terms on the same side:

\[\frac{dv}{v^2}=-\frac{k}{m}dt.\]

We integrate this equation on both sides and find

\[v(t)^{-1}=\frac{k}{m}t +C \,\, \Longrightarrow \,\, v(t)=\frac{m}{kt+C'}.\]

Using our initial condition, we find \(v(0)=m/C'=v_0\) which implies \(C'=m/v_0\). The velocity is then given by

\[v(t)=\frac{v_0m}{v_0kt+m}.\]

First-order linear equation

Problem
Solve the linear equation \[\frac{dy}{dx}+\frac{2y}{x}=\frac{1}{x^2}.\]

Solution
This is is first-order nonhomogenous equation with \(p(x)=2/x\). We will therefore solve the equation by using an integrating factor. We easily see that \(2\ln(x)\) is an antiderivative to \(2/x\). An integrating factor is then \(\mathrm{e}^{2\ln(x)}=x^2\). We calculate

\[\frac{d}{dx}\left(x^2y(x)\right)=x^2\frac{dy}{dx}+2xy(x)=x^2\left(\frac{dy}{dx}+\frac{2y}{x}\right)=1 .\] Integrating the first and last expressions, we find

\[x^2y(x)=\int 1\,dx=x+c\] Thus \[y(x)=\frac{1}{x}+\frac{c}{x^2}.\]

Exact and numerical solutions

Problem
Consider again the equation from the previous example, now with an initial value condition:

\[\frac{dy}{dx}+\frac{2y}{x}=\frac{1}{x^2} \qquad y_0=y(1)=1.\]

Find the an approximate value for \(y(2)\) using Euler's method with step size \(1/4\). Compare the results with the exact solution.

Solution
We have \(x_0=1\), \(x_1=1.25\), \(x_2=1.5\), \(x_3=1.75\) and \(x_4=2\). The initial condition is that \(y_0=1\). Using the iteration formula \(y_{n+1}=y_n+hf(x_n,y_n)\), where \(f(x_n,y_n)=1/x_n^2-2y_n/x_n\), we calculate

\[y_1=1-0.25=0.75, \quad y_2=0.75-0.14=0.61, \quad y_3=0.61-\frac{83}{900}=\frac{233}{450}, \quad y_4=\frac{233}{450}-\frac{731}{11025}=\frac{1991}{4410}.\] In the previous example we found the exact formula \(y=1/x+c/x^2\), and with the initial value \(y(1)=1\) we find that \(c=0\). Thus \(y=1/x\), and \(y(2)=0.5\). The error in the approximation is then \(\approx 0.05\) and the approximated value is less than the real value.

2013-10-31, nikolau