## Problem Set: Direction Fields and Numerical Methods

For the following problems, use the direction field below from the differential equation $y^{\prime} =-2y$. Sketch the graph of the solution for the given initial conditions.

1. $y\left(0\right)=1$

2. $y\left(0\right)=0$

3. $y\left(0\right)=-1$

4. Are there any equilibria? What are their stabilities?

For the following problems, use the direction field below from the differential equation $y^{\prime} ={y}^{2}-2y$. Sketch the graph of the solution for the given initial conditions.

5. $y\left(0\right)=3$

6. $y\left(0\right)=1$

7. $y\left(0\right)=-1$

8. Are there any equilibria? What are their stabilities?

Draw the direction field for the following differential equations, then solve the differential equation. Draw your solution on top of the direction field. Does your solution follow along the arrows on your direction field?

9. $y^{\prime} ={t}^{3}$

10. $y^{\prime} ={e}^{t}$

11. $\frac{dy}{dx}={x}^{2}\cos{x}$

12. $\frac{dy}{dt}=t{e}^{t}$

13. $\frac{dx}{dt}=\text{cosh}\left(t\right)$

Draw the directional field for the following differential equations. What can you say about the behavior of the solution? Are there equilibria? What stability do these equilibria have?

14. $y^{\prime} ={y}^{2}-1$

15. $y^{\prime} =y-x$

16. $y^{\prime} =1-{y}^{2}-{x}^{2}$

17. $y^{\prime} ={t}^{2}\sin{y}$

18. $y^{\prime} =3y+xy$

Match the direction field with the given differential equations. Explain your selections.

19. $y^{\prime} =-3y$

20. $y^{\prime} =-3t$

21. $y^{\prime} ={e}^{t}$

22. $y^{\prime} =\frac{1}{2}y+t$

23. $y^{\prime} =\text{-}ty$

Match the direction field with the given differential equations. Explain your selections.

24. $y^{\prime} =t\sin{y}$

25. $y^{\prime} =\text{-}t\cos{y}$

26. $y^{\prime} =t\tan{y}$

27. $y^{\prime} ={\sin}^{2}y$

28. $y^{\prime} ={y}^{2}{t}^{3}$

Estimate the following solutions using Euler’s method with $n=5$ steps over the interval $t=\left[0,1\right]$. If you are able to solve the initial-value problem exactly, compare your solution with the exact solution. If you are unable to solve the initial-value problem, the exact solution will be provided for you to compare with Euler’s method. How accurate is Euler’s method?

29. $y^{\prime} =-3y,y\left(0\right)=1$

30. $y^{\prime} ={t}^{2}$

31. ${y}^{\prime }=3t-y,y\left(0\right)=1$. Exact solution is $y=3t+4{e}^{\text{-}t}-3$

32. ${y}^{\prime }=y+{t}^{2},y\left(0\right)=3$. Exact solution is $y=5{e}^{t}-2-{t}^{2}-2t$

33. ${y}^{\prime }=2t,y\left(0\right)=0$

34. [T] $y^{\prime} ={e}^{\left(x+y\right)},y\left(0\right)=-1$. Exact solution is $y=\text{-}\text{ln}\left(e+1-{e}^{x}\right)$

35. ${y}^{\prime }={y}^{2}\text{ln}\left(x+1\right),y\left(0\right)=1$. Exact solution is $y=-\frac{1}{\left(x+1\right)\left(\text{ln}\left(x+1\right)-1\right)}$

36. ${y}^{\prime }={2}^{x},y\left(0\right)=0$, Exact solution is $y=\frac{{2}^{x}-1}{\text{ln}\left(2\right)}$

37. ${y}^{\prime }=y,y\left(0\right)=-1$. Exact solution is $y=\text{-}{e}^{x}$.

38. ${y}^{\prime }=-5t,y\left(0\right)=-2$. Exact solution is $y=-\frac{5}{2}{t}^{2}-2$

Differential equations can be used to model disease epidemics. In the next set of problems, we examine the change of size of two sub-populations of people living in a city: individuals who are infected and individuals who are susceptible to infection. $S$ represents the size of the susceptible population, and $I$ represents the size of the infected population. We assume that if a susceptible person interacts with an infected person, there is a probability $c$ that the susceptible person will become infected. Each infected person recovers from the infection at a rate $r$ and becomes susceptible again. We consider the case of influenza, where we assume that no one dies from the disease, so we assume that the total population size of the two sub-populations is a constant number, $N$. The differential equations that model these population sizes are

$\begin{array}{c}S\prime =rI-cSI\text{ and}\hfill \\ I\prime =cSI-rI.\hfill \end{array}$

Here $c$ represents the contact rate and $r$ is the recovery rate.

39. Show that, by our assumption that the total population size is constant $\left(S+I=N\right)$, you can reduce the system to a single differential equation in $I\text{:}I\prime =c\left(N-I\right)I-rI$.

40. Assuming the parameters are $c=0.5,N=5$, and $r=0.5$, draw the resulting directional field.

41. [T] Use computational software or a calculator to compute the solution to the initial-value problem $y^{\prime} =ty,y\left(0\right)=2$ using Euler’s Method with the given step size $h$. Find the solution at $t=1$. For a hint, here is “pseudo-code” for how to write a computer program to perform Euler’s Method for $y^{\prime} =f\left(t,y\right),y\left(0\right)=2\text{:}$

Create function $f\left(t,y\right)$

Define parameters $y\left(1\right)={y}_{0},t\left(0\right)=0$, step size $h$, and total number of steps, $N$

Write a for loop:

for $\text{k}=1\text{to N}$

$\text{fn}=\text{f}\left(\text{t}\left(\text{k}\right),\text{y}\left(\text{k}\right)\right)$

$\text{y}\left(\text{k+1}\right)=\text{y}\left(\text{k}\right)+\text{h*fn}$

$\text{t}\left(\text{k+1}\right)=\text{t}\left(\text{k}\right)+\text{h}$

42. Solve the initial-value problem for the exact solution.

43. Draw the directional field

44. $h=1$

45. [T] $h=10$

46. [T] $h=100$

47. [T] $h=1000$

48. [T] Evaluate the exact solution at $t=1$. Make a table of errors for the relative error between the Euler’s method solution and the exact solution. How much does the error change? Can you explain?

Consider the initial-value problem $y^{\prime} =-2y,y\left(0\right)=2$.

49. Show that $y=2{e}^{-2x}$ solves this initial-value problem.

50. Draw the directional field of this differential equation.

51. [T] By hand or by calculator or computer, approximate the solution using Euler’s Method at $t=10$ using $h=5$.

52. [T] By calculator or computer, approximate the solution using Euler’s Method at $t=10$ using $h=100$.

53. [T] Plot exact answer and each Euler approximation (for $h=5$ and $h=100$) at each $h$ on the directional field. What do you notice?