Diff Eq Explanation
1. **Problem Statement:**
(a) Explain the differences between:
(1) Dependent variable and independent variable
(2) Ordinary differential equation (ODE) and Partial differential equation (PDE)
(3) First-order equation and second-order equation
(b) Use Euler's method to numerically solve the ODE $$\frac{dy}{dx} = -2x^3 + 12x^2 - 20x + 8.5$$ from $$x=0$$ to $$x=5$$ with step size $$h=0.5$$ and initial condition $$y(0)=1$$.
2. **Definitions and Differences:**
(1) Dependent variable depends on the independent variable. Here, $$y$$ is dependent on $$x$$, which is independent.
(2) ODE involves derivatives with respect to one independent variable; PDE involves partial derivatives with respect to multiple independent variables.
(3) First-order equation involves first derivative only; second-order involves up to second derivative.
3. **Euler's Method Formula:**
$$y_{n+1} = y_n + h f(x_n,y_n)$$
where $$f(x,y) = \frac{dy}{dx}$$.
4. **Given:**
$$f(x) = -2x^3 + 12x^2 - 20x + 8.5$$, $$h=0.5$$, $$y_0=1$$ at $$x_0=0$$.
5. **Step-by-step Calculation:**
- Step 0: $$x_0=0, y_0=1$$
- Step 1: $$f(x_0) = -2(0)^3 + 12(0)^2 - 20(0) + 8.5 = 8.5$$
$$y_1 = y_0 + h f(x_0) = 1 + 0.5 \times 8.5 = 5.25$$
- Step 2: $$x_1=0.5$$
$$f(0.5) = -2(0.5)^3 + 12(0.5)^2 - 20(0.5) + 8.5 = -2(0.125) + 12(0.25) - 10 + 8.5 = -0.25 + 3 - 10 + 8.5 = 1.25$$
$$y_2 = y_1 + h f(x_1) = 5.25 + 0.5 \times 1.25 = 5.875$$
- Step 3: $$x_2=1.0$$
$$f(1) = -2(1)^3 + 12(1)^2 - 20(1) + 8.5 = -2 + 12 - 20 + 8.5 = -1.5$$
$$y_3 = 5.875 + 0.5 \times (-1.5) = 5.125$$
- Step 4: $$x_3=1.5$$
$$f(1.5) = -2(3.375) + 12(2.25) - 20(1.5) + 8.5 = -6.75 + 27 - 30 + 8.5 = -1.25$$
$$y_4 = 5.125 + 0.5 \times (-1.25) = 4.5$$
- Step 5: $$x_4=2.0$$
$$f(2) = -2(8) + 12(4) - 20(2) + 8.5 = -16 + 48 - 40 + 8.5 = 0.5$$
$$y_5 = 4.5 + 0.5 \times 0.5 = 4.75$$
- Step 6: $$x_5=2.5$$
$$f(2.5) = -2(15.625) + 12(6.25) - 20(2.5) + 8.5 = -31.25 + 75 - 50 + 8.5 = 2.25$$
$$y_6 = 4.75 + 0.5 \times 2.25 = 5.875$$
- Step 7: $$x_6=3.0$$
$$f(3) = -2(27) + 12(9) - 20(3) + 8.5 = -54 + 108 - 60 + 8.5 = 2.5$$
$$y_7 = 5.875 + 0.5 \times 2.5 = 7.125$$
- Step 8: $$x_7=3.5$$
$$f(3.5) = -2(42.875) + 12(12.25) - 20(3.5) + 8.5 = -85.75 + 147 - 70 + 8.5 = -0.25$$
$$y_8 = 7.125 + 0.5 \times (-0.25) = 6.999$$
- Step 9: $$x_8=4.0$$
$$f(4) = -2(64) + 12(16) - 20(4) + 8.5 = -128 + 192 - 80 + 8.5 = -7.5$$
$$y_9 = 6.999 + 0.5 \times (-7.5) = 3.749$$
- Step 10: $$x_9=4.5$$
$$f(4.5) = -2(91.125) + 12(20.25) - 20(4.5) + 8.5 = -182.25 + 243 - 90 + 8.5 = -20.75$$
$$y_{10} = 3.749 + 0.5 \times (-20.75) = -6.126$$
- Step 11: $$x_{10}=5.0$$
$$f(5) = -2(125) + 12(25) - 20(5) + 8.5 = -250 + 300 - 100 + 8.5 = -41.5$$
$$y_{11} = -6.126 + 0.5 \times (-41.5) = -26.876$$
6. **Final approximate values:**
$$y(5) \approx -26.876$$ using Euler's method with step size 0.5.
This method approximates the solution by stepping forward using the slope at the current point.