2.1 First exam

  2.1.1 crib sheet for first exam
  2.1.2 First Practice exam for first exam
  2.1.3 Second Practice exam for first exam
  2.1.4 my solution for first practice exam for first midterm

2.1.1 crib sheet for first exam

PDF

2.1.2 First Practice exam for first exam

PDF

2.1.3 Second Practice exam for first exam

PDF

2.1.4 my solution for first practice exam for first midterm

   2.1.4.1 Problem 1
   2.1.4.2 Problem 2
   2.1.4.3 Problem 3
   2.1.4.4 Problem 4
   2.1.4.5 Problem 5
PDF (letter size)
PDF (legal size)

2.1.4.1 Problem 1

\[ \frac{dP\left ( t\right ) }{dt}=-\left ( bP^{2}\left ( t\right ) -aP\left ( t\right ) +h\right ) \]

Part(a)

For \(a=6,b=1\) the ODE becomes\[ \frac{dP\left ( t\right ) }{dt}=-\left ( P^{2}\left ( t\right ) -6P\left ( t\right ) +h\right ) \] Critical points are given by \(\frac{dP\left ( t\right ) }{dt}=0\). Hence solving for \(P\) from\begin{align} P^{2}-6P+h & =0\tag{1}\\ P_{c} & =\frac{-b\pm \sqrt{b^{2}-4ac}}{2a}=\frac{6\pm \sqrt{36-4h}}{2}=3\pm \sqrt{9-h}\nonumber \end{align}

We see now how \(P_{c}\) depends on \(h\). For real valued \(P_{c}\) we want \(9-h>0\) or \[ h<9 \]

Part(b)

For \(a=6,b=1,h=7\) then \[ \frac{dP\left ( t\right ) }{dt}=-\left ( P^{2}\left ( t\right ) -6P\left ( t\right ) +7\right ) \] And the critical \(P_{c}\) values are from (1)\begin{align*} P_{c} & =3\pm \sqrt{9-7}\\ & =3\pm \sqrt{2}\\ & =\left \{ 4.4142,1.5858\right \} \end{align*}

To classify \(P_{c}\) we look at little above and little below each critical value and see what the slope is there. Depending on the sign of the slope around each critical point, we will know if it stable, not stable, or semi-stable. For \(P_{c}=4.4142\), lets look at \(P=5\) and \(P=4\)\begin{align*} \left ( -\left ( P^{2}\left ( t\right ) -6P\left ( t\right ) +7\right ) \right ) _{P=5} & =-\left ( 25-6\left ( 5\right ) +7\right ) =-2\\ \left ( -\left ( P^{2}\left ( t\right ) -6P\left ( t\right ) +7\right ) \right ) _{P=4} & =-\left ( 16-6\left ( 4\right ) +7\right ) =1 \end{align*}

Since the slope is negative to the right of \(P_{c}=4.4142\) and the slope is positive to the left of \(P_{c}=4.4142\), this means \(P_{c}=4.4142\) is stable.

For \(P_{c}=1.5858\), let look at \(P=2\) and \(P=1\)\begin{align*} \left ( -\left ( P^{2}\left ( t\right ) -6P\left ( t\right ) +7\right ) \right ) _{P=2} & =-\left ( 4-6\left ( 2\right ) +7\right ) =1\\ \left ( -\left ( P^{2}\left ( t\right ) -6P\left ( t\right ) +7\right ) \right ) _{P=1} & =-\left ( 1-6\left ( 1\right ) +7\right ) =-2 \end{align*}

Since the slope is positive to the right of \(P_{c}=1.5858\) and the slope is negative to the left of \(P_{c}=1.5858\), this means \(P_{c}=1.5858\) is unstable.

Here is the phase plot

pict

Here is sketch of the slope field diagram using the computer showing the two critical values of \(P\left ( t\right ) \) found above, confirming that one is stable, and the other is not stable.

pict

Part(c)

For \(a=6,b=1,h=7\) then

\[ \frac{dP\left ( t\right ) }{dt}=-\left ( P^{2}\left ( t\right ) -6P\left ( t\right ) +7\right ) \] Since \(P\left ( 0\right ) =3\), then we see from part(b) sketch of slope field, that the solution curve will move to the critical point \(P_{c}=3+\sqrt{2}\). Therefore for \(t\rightarrow \infty \), \(P\left ( t\right ) =3+\sqrt{2}\). Here is the slope field diagram, with the solution curve marked as red showing it is moving to the equilibrium solution.

pict
2.1.4.2 Problem 2

\[\begin{pmatrix} -1 & 1 & 1 & 2\\ 0 & 5 & -k & 4\\ 0 & 0 & k & p+3 \end{pmatrix} \]

Part (a)

Using \(p=-3\)\[\begin{pmatrix} -1 & 1 & 1 & 2\\ 0 & 5 & -k & 4\\ 0 & 0 & k & 0 \end{pmatrix} \] case (i) Last equation says that \(kx_{3}=0\). If \(k\neq 0\), then only \(x_{3}=0\) will satisfy the equation. Which gives, from second equation \(5x_{2}-kx_{3}=4\) or \(x_{2}=\frac{4}{5}\). And from first equation \(-x_{1}+x_{2}+x_{3}=2\) or \(-x_{1}=2-x_{2}=2-\frac{4}{5}\). Hence \(x_{1}=\frac{4}{5}-2=-\frac{6}{5}\) Therefore \(k\neq 0\) gives unique solution. The solution in vector form is\[\begin{pmatrix} x_{1}\\ x_{2}\\ x_{3}\end{pmatrix} =\begin{pmatrix} -\frac{6}{5}\\ \frac{4}{5}\\ 0 \end{pmatrix} \] case (ii) There is no value of \(k\) which gives no solution.

case (iii) If \(k=0\) then we have \(0\left ( x_{3}\right ) =0\). Hence any \(x_{3}\) value will satisfy this. So there are infinite number of solutions. Let \(x_{3}=t\), hence from second equation \(5x_{2}-kt=4\) or \(x_{2}=\frac{4+kt}{5}\) and from the first equation \(-x_{1}+\frac{4+kt}{5}+t=2\) or \(-x_{1}=2-t-\frac{4+kt}{5}\), hence \(x_{1}=t+\frac{1}{5}kt-\frac{6}{5}\). The solution in vector form is\[\begin{pmatrix} x_{1}\\ x_{2}\\ x_{3}\end{pmatrix} =\begin{pmatrix} t+\frac{1}{5}kt-\frac{6}{5}\\ \frac{4+kt}{5}\\ t \end{pmatrix} =\begin{pmatrix} t-\frac{6}{5}\\ \frac{4}{5}\\ t \end{pmatrix} _{k=0}\]

Part (b)

Using \(p=-2\)\[\begin{pmatrix} -1 & 1 & 1 & 2\\ 0 & 5 & -k & 4\\ 0 & 0 & k & 1 \end{pmatrix} \] case (i) Last equation says that \(kx_{3}=1\). If \(k\neq 0\), then unique solution exist. But if \(k=0\), we have \(\left ( 0\right ) x_{3}=1\) which is not possible. So for unique solution we need \(k\neq 0\) for unique solution.

case (ii) If \(k=0\) we have \(\left ( 0\right ) x_{3}=1\) which is not possible. Hence \(k=0\) gives no solutions.

case (iii) There is no value of \(k\) which gives infinite number of solutions.

2.1.4.3 Problem 3

\[ \frac{dy}{dx}=-\frac{y}{\left ( x-1\right ) }+\frac{e^{-x}}{x-1};y\left ( 0\right ) =2 \]

part (a)

\[ \frac{dy}{dx}=\frac{-y+e^{-x}}{\left ( x-1\right ) }\] Hence \[ f\left ( x,y\right ) =\frac{-y+e^{-x}}{\left ( x-1\right ) }\] This is continuous in \(x\) except at \(x=1\). And continuous for all \(y\,\). Hence solution exist in region that does not include \(x=1\). Now \(\frac{\partial f}{\partial y}=\frac{-1}{\left ( x-1\right ) }\). We see also here that This is continuous in \(x\) except at \(x=1\). No dependency on \(y\). Hence solution exist and unique in some region that do not include \(x=1\). So solve, we use integrating factor\begin{align} \frac{dy}{dx}+\frac{y}{\left ( x-1\right ) } & =\frac{e^{-x}}{x-1}\tag{1}\\ \mu & =e^{\int \frac{1}{x-1}dx}=e^{\ln \left ( x-1\right ) }=\left ( x-1\right ) \nonumber \end{align}

Therefore, by multiplying both sides of (1) by \(\mu \), we obtain\begin{align*} \frac{d}{dx}\left ( \mu y\right ) & =\mu \frac{e^{-x}}{x-1}\\ \frac{d}{dx}\left ( \left ( x-1\right ) y\right ) & =\left ( x-1\right ) \frac{e^{-x}}{x-1}\\ & =e^{-x} \end{align*}

Integrating both sides\begin{align*} \left ( x-1\right ) y & =-e^{-x}+c\\ y\left ( x\right ) & =\frac{e^{-x}}{1-x}+\frac{c}{x-1} \end{align*}

From initial conditions

\begin{align*} 2 & =\frac{1}{1}+\frac{c}{-1}\\ c & =-1 \end{align*}

Hence the exact solution is\begin{align*} y\left ( x\right ) & =\frac{e^{-x}}{1-x}+\frac{1}{1-x}\\ & =\frac{e^{-x}+1}{1-x} \end{align*}

Since initial conditions is at \(x=0\) and since we found above that solution region can not include point \(x=1\), then the solution region is \(-\infty <x<1\)

Here is a plot of the solution showing the singularity at \(x=1\). For our case, the solution curve is the one to the left of \(x=1\) in this diagram

pict

Part (b)

In Forward Euler, we have \[ y_{n+1}=y_{n}+hf\left ( x_{n},y_{n}\right ) \] In this problem  \(f\left ( x,y\right ) =-\frac{y}{\left ( x-1\right ) }+\frac{e^{-x}}{x-1}\), hence\[ y_{n+1}=y_{n}+h\left ( -\frac{y_{n}}{\left ( x_{n}-1\right ) }+\frac{e^{-x_{n}}}{x_{n}-1}\right ) \] For \(n=0\), we have\[ y_{1}=y_{0}+h\left ( -\frac{y_{0}}{\left ( x_{0}-1\right ) }+\frac{e^{-x_{0}}}{x_{0}-1}\right ) \] But \(y_{0}=2\) at \(x_{0}=0\), hence the above becomes\begin{align*} y_{1} & =y_{0}+h\left ( -\frac{2}{-1}+\frac{1}{0-1}\right ) \\ & =y_{0}+h \end{align*}

Therefore, after one step \[ y\left ( h\right ) =y\left ( 0\right ) +h \]

2.1.4.4 Problem 4

\[ \frac{dy}{dx}=-\frac{5}{2}x^{4}y^{3};y\left ( 0\right ) =-1 \]

Part (a)

\(f\left ( x,y\right ) =-\frac{5}{2}x^{4}y^{3}\). We see that this is continuous for all \(x\) and all \(y\). \(\frac{\partial f}{\partial y}=-\frac{5}{2}3x^{4}y^{2}\). This is also continuous for all \(x\) and all \(y\). Therefore a solution exist and is unique in some region  inside \(-\infty <x<\infty \).

Now we solve the ODE. This is separable. Hence\[ \frac{dy}{y^{3}}=-\frac{5}{2}x^{4}dx \] Integrating\[ \frac{-1}{2y^{2}}=-\frac{1}{2}x^{5}+c \] Applying initial conditions\[ \frac{-1}{2}=c \] Hence exact solution is\begin{align*} \frac{-1}{2y^{2}} & =-\frac{1}{2}x^{5}-\frac{1}{2}\\ & =\frac{-x^{5}-1}{2} \end{align*}

Hence \(\frac{-1}{y^{2}}=-x^{5}-1\) or\begin{align*} y^{2} & =\frac{-1}{-x^{5}-1}\\ & =\frac{1}{x^{5}+1}\\ y & =\pm \sqrt{\frac{1}{x^{5}+1}} \end{align*}

But since \(y\left ( 0\right ) =-1\), then at this point, using the above solution, we see that \(-1=\pm \sqrt{\frac{1}{1}}\). Hence only the negative sign can be used, to satisfy the initial conditions. Therefore, the solution becomes\[ y=-\sqrt{\frac{1}{x^{5}+1}}\] Since the solution must be real, then \(x^{5}=-1\) is not allowed (or \(x=-1\) is not allowed). And since we started at \(x=0\), then the solution is valid for\[ \fbox{$-1<x<\infty $}\] Here is a plot of the solution curve

pict

Part (b)

In rk2, we have \begin{align*} k_{1} & =f\left ( x_{n},y_{n}\right ) \\ u_{n+1} & =y_{n}+hk_{1}\\ k_{2} & =f\left ( x_{n+1},u_{n+1}\right ) \\ y_{n+1} & =y_{n}+h\frac{1}{2}\left ( k_{1}+k_{2}\right ) \end{align*}

In this problem  \(f\left ( x,y\right ) =-\frac{5}{2}x^{4}y^{3}\), hence\[ k_{1}=-\frac{5}{2}x_{n}^{4}y_{n}^{3}\] For \(n=0\), we have\[ k_{1}=-\frac{5}{2}x_{0}^{4}y_{0}^{3}\] But \(y_{0}=-1\) at \(x_{0}=0\), hence the above becomes\[ k_{1}=0 \] Hence\begin{align*} u_{1} & =y_{0}+hk_{1}\\ & =y_{0}\\ & =-1 \end{align*}

And\begin{align*} k_{2} & =f\left ( x_{1},u_{1}\right ) \\ & =-\frac{5}{2}x_{1}^{4}u_{1}^{3}\\ & =-\frac{5}{2}h^{4}\left ( -1\right ) ^{3}\\ & =\frac{5}{2}h^{4} \end{align*}

Hence\begin{align*} y_{1} & =y_{0}+h\frac{1}{2}\left ( k_{1}+k_{2}\right ) \\ & =-1+h\frac{1}{2}\left ( 0+\frac{5}{2}h^{4}\right ) \\ & =\frac{5}{4}h^{5}-1 \end{align*}

2.1.4.5 Problem 5

\[ \frac{dy}{dt}=\left ( y-1\right ) ^{\frac{3}{2}};y\left ( 1\right ) =2 \] Here \[ f\left ( t,y\right ) =\left ( y-1\right ) ^{\frac{3}{2}}\] This does not depend on \(t\). If \(y<1\), then \(\left ( y-1\right ) ^{\frac{3}{2}}\) will be complex valued. Hence for real solution, we want \(y\geq 1\). \(\frac{\partial f}{\partial y}=\frac{3}{2}\left ( y-1\right ) ^{\frac{1}{2}}\). This does not depend on \(t\). Therefore a solution exist and is unique in some region \(-\infty <t<\infty \). As long as \(y\geq 1\). Hence TRUE

Note: When solving this, the solution came out to be \(y\left ( t\right ) =\frac{t^{2}-6t+13}{\left ( t-3\right ) ^{2}}\), which means the solution below up at \(t=3\). i.e the solution is singular at \(t=3\). Therefore, the subrange is \(-\infty <t<-3\). (we were not asked to find the subrange?)  Just to answer that there exist some subrange. Here is a plot of the solution

pict