Problem Set: Direction Fields and Numerical Methods

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


A direction field with horizontal arrows pointing to the right at 0. The arrows above the x-axis point down and to the right. The further away from the x-axis, the steeper the arrows are, and the closer to the x-axis, the flatter the arrows are. Likewise, the arrows below the x-axis point up and to the right. The further away from the x-axis, the steeper the arrows are, and the closer to the x-axis, the flatter the arrows are.

1. [latex]y\left(0\right)=1[/latex]

2. [latex]y\left(0\right)=0[/latex]

3. [latex]y\left(0\right)=-1[/latex]

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

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


A direction field with horizontal arrows at y = 0 and y = 2. The arrows point up for y > 2 and for y < 0. The arrows point down for 0 < y < 2. The closer the arrows are to these lines, the more horizontal they are, and the further away, the more vertical the arrows are.

5. [latex]y\left(0\right)=3[/latex]

6. [latex]y\left(0\right)=1[/latex]

7. [latex]y\left(0\right)=-1[/latex]

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. [latex]y^{\prime} ={t}^{3}[/latex]

10. [latex]y^{\prime} ={e}^{t}[/latex]

11. [latex]\frac{dy}{dx}={x}^{2}\cos{x}[/latex]

12. [latex]\frac{dy}{dt}=t{e}^{t}[/latex]

13. [latex]\frac{dx}{dt}=\text{cosh}\left(t\right)[/latex]

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. [latex]y^{\prime} ={y}^{2}-1[/latex]

15. [latex]y^{\prime} =y-x[/latex]

16. [latex]y^{\prime} =1-{y}^{2}-{x}^{2}[/latex]

17. [latex]y^{\prime} ={t}^{2}\sin{y}[/latex]

18. [latex]y^{\prime} =3y+xy[/latex]

Match the direction field with the given differential equations. Explain your selections.A direction field with arrows pointing down and to the right in quadrants two and three. After crossing the y axis, the arrows change direction and point up to the right.

 A direction field with horizontal arrows pointing to the left in quadrants two and three. In crossing the y axis, the arrows switch and point upward in quadrants one and four.

 A direction field with horizontal arrows pointing to the right on the x axis. Above, the arrows point down and to the right, and below, the arrows point up and to the right. The further from the x axis, the more vertical the arrows become.

 A direction field with horizontal arrows on the x and y axes. The arrows point down and to the right in quadrants one and three. They point up and to the right in quadrants two and four.

 A direction field with arrows pointing up in quadrants two and three, to the right on the y axis, and down in quadrants one and four.

19. [latex]y^{\prime} =-3y[/latex]

20. [latex]y^{\prime} =-3t[/latex]

21. [latex]y^{\prime} ={e}^{t}[/latex]

22. [latex]y^{\prime} =\frac{1}{2}y+t[/latex]

23. [latex]y^{\prime} =\text{-}ty[/latex]

Match the direction field with the given differential equations. Explain your selections.A direction field with horizontal arrows pointing to the right on the x and y axes. In quadrants one and three, the arrows point up, and in quadrants two and four, they point down.


A direction field with horizontal arrows pointing to the right on the x and y axes. In quadrants one and three, the arrows point up and to the right, and in quadrants two and four, the arrows point down and to the right.

 A direction field with horizontal arrows pointing to the right on the x and y axes. In quadrants two and three, the arrows point down, and in quadrants one and four, the arrows point up.


A direction field with horizontal arrows pointing to the right on the x axis. The arrows point up and to the right in all quadrants. The closer the arrows are to the x axis, the more horizontal the arrows are, and the further away they are, the more vertical they are.

 A direction field with horizontal arrows on the y axis. The arrows are also more horizontal closer to y = 1.5, y = -1.5, and the y axis. For y > 1.5 and x < 0, for y < -1.5 and x < 0, and for -1.5 < y < 1.5 and x > 0-, the arrows point down. For y> 1.5 and x > 0, for y < -1.5, for y < -1.5 and x > 0, and for -1.5 < y < 1.5 and x < 0, the arrows point up.

24. [latex]y^{\prime} =t\sin{y}[/latex]

25. [latex]y^{\prime} =\text{-}t\cos{y}[/latex]

26. [latex]y^{\prime} =t\tan{y}[/latex]

27. [latex]y^{\prime} ={\sin}^{2}y[/latex]

28. [latex]y^{\prime} ={y}^{2}{t}^{3}[/latex]

Estimate the following solutions using Euler’s method with [latex]n=5[/latex] steps over the interval [latex]t=\left[0,1\right][/latex]. 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. [latex]y^{\prime} =-3y,y\left(0\right)=1[/latex]

30. [latex]y^{\prime} ={t}^{2}[/latex]

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

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

33. [latex]{y}^{\prime }=2t,y\left(0\right)=0[/latex]

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

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

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

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

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

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. [latex]S[/latex] represents the size of the susceptible population, and [latex]I[/latex] represents the size of the infected population. We assume that if a susceptible person interacts with an infected person, there is a probability [latex]c[/latex] that the susceptible person will become infected. Each infected person recovers from the infection at a rate [latex]r[/latex] 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, [latex]N[/latex]. The differential equations that model these population sizes are

[latex]\begin{array}{c}S\prime =rI-cSI\text{ and}\hfill \\ I\prime =cSI-rI.\hfill \end{array}[/latex]

Here [latex]c[/latex] represents the contact rate and [latex]r[/latex] is the recovery rate.

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

40. Assuming the parameters are [latex]c=0.5,N=5[/latex], and [latex]r=0.5[/latex], draw the resulting directional field.

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

Create function [latex]f\left(t,y\right)[/latex]

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

Write a for loop:

for [latex]\text{k}=1\text{to N}[/latex]

[latex]\text{fn}=\text{f}\left(\text{t}\left(\text{k}\right),\text{y}\left(\text{k}\right)\right)[/latex]

[latex]\text{y}\left(\text{k+1}\right)=\text{y}\left(\text{k}\right)+\text{h*fn}[/latex]

[latex]\text{t}\left(\text{k+1}\right)=\text{t}\left(\text{k}\right)+\text{h}[/latex]

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

43. Draw the directional field

44. [latex]h=1[/latex]

45. [T] [latex]h=10[/latex]

46. [T] [latex]h=100[/latex]

47. [T] [latex]h=1000[/latex]

48. [T] Evaluate the exact solution at [latex]t=1[/latex]. 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 [latex]y^{\prime} =-2y,y\left(0\right)=2[/latex].

49. Show that [latex]y=2{e}^{-2x}[/latex] 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 [latex]t=10[/latex] using [latex]h=5[/latex].

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

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