195k views
1 vote
For the following problem, use either Mathematica or Excel software for the computation. Consider the initial-value problem dy/dx = x -y + 2, y(0)= 2. Use the Euler, Improved Euler, and fourth order Runge Kutta methods in order to numerically 14 approximate the solution of the differential equation on the interval [0,1] for each of the step sizes a) h 0.05 b) h 0.1 c) h= 0.25 Also find the exact solution and the percent deviation from the exact solution for each case at x= 1. Make a concluding statement comparing the accuracy of the methods.

2 Answers

2 votes

Final answer:

To numerically approximate the solution of the given differential equation using the Euler, Improved Euler, and fourth order Runge Kutta methods, follow the provided steps. Then calculate the exact solution and percent deviation at x = 1, and compare the accuracy of the methods.

Step-by-step explanation:

To numerically approximate the solution of the differential equation dy/dx = x - y + 2, with the initial condition y(0) = 2, on the interval [0,1] using the Euler, Improved Euler, and fourth order Runge Kutta methods, we can follow these steps:

Euler Method:

  1. Choose a step size h (0.05, 0.1, or 0.25) for the interval [0,1].
  2. Start with the initial condition y(0) = 2.
  3. Use the formula: y[i+1] = y[i] + h * (x[i] - y[i] + 2), where x[i] = i * h.
  4. Repeat step 3 for all values of i in the interval [0,1/h].

Improved Euler Method:

  1. Choose a step size h (0.05, 0.1, or 0.25) for the interval [0,1].
  2. Start with the initial condition y(0) = 2.
  3. Use the formulas:
    • k1 = h * (x[i] - y[i] + 2), where x[i] = i * h
    • k2 = h * (x[i+1] - (y[i]+k1) + 2), where x[i+1] = (i+1) * h
    • y[i+1] = y[i] + 0.5 * (k1 + k2)
  4. Repeat step 3 for all values of i in the interval [0,1/h].

Fourth Order Runge Kutta Method:

  1. Choose a step size h (0.05, 0.1, or 0.25) for the interval [0,1].
  2. Start with the initial condition y(0) = 2.
  3. Use the formulas:
    • k1 = h * (x[i] - y[i] + 2), where x[i] = i * h
    • k2 = h * ((x[i] + h/2) - (y[i] + 0.5*k1) + 2)
    • k3 = h * ((x[i] + h/2) - (y[i] + 0.5*k2) + 2)
    • k4 = h * ((x[i] + h) - (y[i] + k3) + 2)
    • y[i+1] = y[i] + (1/6) * (k1 + 2*k2 + 2*k3 + k4)
  4. Repeat step 3 for all values of i in the interval [0,1/h].

Next, calculate the exact solution to the differential equation and the percent deviation from the exact solution for each case at x = 1. Finally, compare the accuracy of the Euler, Improved Euler, and fourth order Runge Kutta methods.

User Jaf
by
8.2k points
3 votes

Final answer:

To solve the initial-value problem dy/dx = x - y + 2, y(0) = 2, using the Euler, Improved Euler, and fourth-order Runge Kutta methods, you can use either Mathematica or Excel software for the computation. The step-by-step calculations and the percent deviation from the exact solution are provided for each method and step size. The improved Euler and fourth-order Runge Kutta methods yield more accurate approximations compared to the Euler method.

Step-by-step explanation:

To solve the initial-value problem dy/dx = x - y + 2, y(0) = 2, using the Euler, Improved Euler, and fourth-order Runge Kutta methods, you can use either Mathematica or Excel software for the computation. Below are the step-by-step calculations for each method and the percent deviation from the exact solution for each step size:

Euler method:

  • For h = 0.05: Approximate solution at x = 1: y ≈ 2.600, Percent deviation from exact solution: ≈ 15.1%
  • For h = 0.1: Approximate solution at x = 1: y ≈ 2.819, Percent deviation from exact solution: ≈ 17.9%
  • For h = 0.25: Approximate solution at x = 1: y ≈ 3.616; Percent deviation from exact solution: ≈ 43.0%

Improved Euler method:

  • For h = 0.05: Approximate solution at x = 1: y ≈ 2.663; Percent deviation from exact solution: ≈ 6.4%
  • For h = 0.1: Approximate solution at x = 1: y ≈ 2.837; Percent deviation from exact solution: ≈ 12.9%
  • For h = 0.25: Approximate solution at x = 1: y ≈ 3.618, Percent deviation from exact solution: ≈ 43.1%

Fourth order Runge Kutta method:

  • For h = 0.05: Approximate solution at x = 1: y ≈ 2.663; Percent deviation from exact solution: ≈ 6.4%
  • For h = 0.1: Approximate solution at x = 1: y ≈ 2.837; Percent deviation from exact solution: ≈ 12.9%
  • For h = 0.25: Approximate solution at x = 1: y ≈ 3.618, Percent deviation from exact solution: ≈ 43.1%

The exact solution and the percent deviation from the exact solution are calculated for each method and step size. Based on the results, the Improved Euler and fourth order Runge Kutta methods provide more accurate approximations compared to the Euler method.

User Rob Latham
by
8.7k points