Numerical Integration Interpolation
1. **Problem a:** Calculate the integral $$\int_0^1 \frac{1}{1+x^2} dx$$ using the Trapezoidal rule with 6 intervals.
2. **Formula:** The Trapezoidal rule for $n$ intervals is given by:
$$\int_a^b f(x) dx \approx \frac{h}{2} \left[f(x_0) + 2\sum_{i=1}^{n-1} f(x_i) + f(x_n)\right]$$
where $h = \frac{b-a}{n}$ and $x_i = a + ih$.
3. **Calculation:**
- Here, $a=0$, $b=1$, $n=6$, so $h=\frac{1-0}{6} = \frac{1}{6} \approx 0.1667$.
- The points are $x_i = 0, 0.1667, 0.3333, 0.5, 0.6667, 0.8333, 1$.
- Compute $f(x_i) = \frac{1}{1+x_i^2}$:
- $f(0) = 1$
- $f(0.1667) = \frac{1}{1+0.0278} = 0.9722$
- $f(0.3333) = \frac{1}{1+0.1111} = 0.9$
- $f(0.5) = \frac{1}{1+0.25} = 0.8$
- $f(0.6667) = \frac{1}{1+0.4444} = 0.6923$
- $f(0.8333) = \frac{1}{1+0.6944} = 0.5902$
- $f(1) = \frac{1}{2} = 0.5$
- Sum the interior terms:
$$2 \times (0.9722 + 0.9 + 0.8 + 0.6923 + 0.5902) = 2 \times 3.9547 = 7.9094$$
- Apply the formula:
$$\frac{h}{2} [f(0) + 7.9094 + f(1)] = \frac{0.1667}{2} [1 + 7.9094 + 0.5] = 0.0833 \times 9.4094 = 0.7841$$
4. **Answer for a:** The integral value is approximately $0.784$ (3 significant figures).
---
5. **Problem b:** Use Newton's divided difference formula to evaluate $f(6)$ for points $(5,150), (7,392), (11,1452), (13,2366), (21,9702)$.
6. **Newton's divided difference formula:**
$$P(x) = f[x_0] + f[x_0,x_1](x-x_0) + f[x_0,x_1,x_2](x-x_0)(x-x_1) + \cdots$$
7. **Calculate divided differences:**
- $f[5] = 150$, $f[7] = 392$, $f[11] = 1452$, $f[13] = 2366$, $f[21] = 9702$
- First order:
$$f[5,7] = \frac{392-150}{7-5} = 121$$
$$f[7,11] = \frac{1452-392}{11-7} = 265$$
$$f[11,13] = \frac{2366-1452}{13-11} = 457$$
$$f[13,21] = \frac{9702-2366}{21-13} = 917$$
- Second order:
$$f[5,7,11] = \frac{265-121}{11-5} = 24$$
$$f[7,11,13] = \frac{457-265}{13-7} = 32$$
$$f[11,13,21] = \frac{917-457}{21-11} = 46$$
- Third order:
$$f[5,7,11,13] = \frac{32-24}{13-5} = 1$$
$$f[7,11,13,21] = \frac{46-32}{21-7} = 1$$
- Fourth order:
$$f[5,7,11,13,21] = \frac{1-1}{21-5} = 0$$
8. **Construct polynomial:**
$$P(6) = 150 + 121(6-5) + 24(6-5)(6-7) + 1(6-5)(6-7)(6-11)$$
Calculate stepwise:
- $121(1) = 121$
- $24(1)(-1) = -24$
- $1(1)(-1)(-5) = 5$
Sum:
$$150 + 121 - 24 + 5 = 252$$
9. **Answer for b:** $f(6) \approx 252$.
---
10. **Problem c:** Check if the system
$$\begin{cases} x + 17y - 2z = 48 \\ 30x - 2y + 3z = 75 \\ 2x + 2y + 18z = 30 \end{cases}$$
is diagonally dominant and solve by Gauss-Jacobi method to 3 decimal places.
11. **Check diagonal dominance:**
- Row 1: $|1|$ vs $|17| + |2| = 19$ (Not dominant)
- Row 2: $|30|$ vs $|2| + |3| = 5$ (Dominant)
- Row 3: $|18|$ vs $|2| + |2| = 4$ (Dominant)
Since row 1 is not diagonally dominant, the system is not diagonally dominant.
12. **Gauss-Jacobi iteration formulas:**
$$x^{(k+1)} = \frac{1}{1} (48 - 17y^{(k)} + 2z^{(k)})$$
$$y^{(k+1)} = \frac{1}{-2} (75 - 30x^{(k)} - 3z^{(k)})$$
$$z^{(k+1)} = \frac{1}{18} (30 - 2x^{(k)} - 2y^{(k)})$$
13. **Initial guess:** $x^{(0)}=0$, $y^{(0)}=0$, $z^{(0)}=0$
14. **Iteration 1:**
- $x^{(1)} = 48 - 0 + 0 = 48$
- $y^{(1)} = -\frac{1}{2} (75 - 0 - 0) = -37.5$
- $z^{(1)} = \frac{1}{18} (30 - 0 - 0) = 1.667$
15. **Iteration 2:**
- $x^{(2)} = 48 - 17(-37.5) + 2(1.667) = 48 + 637.5 + 3.333 = 688.833$
- $y^{(2)} = -\frac{1}{2} (75 - 30(48) - 3(1.667)) = -\frac{1}{2} (75 - 1440 - 5) = -\frac{1}{2} (-1370) = 685$
- $z^{(2)} = \frac{1}{18} (30 - 2(48) - 2(-37.5)) = \frac{1}{18} (30 - 96 + 75) = \frac{9}{18} = 0.5$
16. **Iteration 3:**
- $x^{(3)} = 48 - 17(685) + 2(0.5) = 48 - 11645 + 1 = -11596$
- $y^{(3)} = -\frac{1}{2} (75 - 30(688.833) - 3(0.5)) = -\frac{1}{2} (75 - 20664.99 - 1.5) = -\frac{1}{2} (-20591.49) = 10295.745$
- $z^{(3)} = \frac{1}{18} (30 - 2(-11596) - 2(685)) = \frac{1}{18} (30 + 23192 - 1370) = \frac{21952}{18} = 1219.56$
17. The values are diverging, indicating Gauss-Jacobi method does not converge for this system due to lack of diagonal dominance.
**Final answers:**
- a) Integral $\approx 0.784$
- b) $f(6) \approx 252$
- c) System is not diagonally dominant; Gauss-Jacobi method does not converge.