Skip to content

Commit a674f92

Browse files
Do Numerical Methods Ass 2 Q1
1 parent af9ff67 commit a674f92

File tree

1 file changed

+42
-1
lines changed
  • second-year/MA2K4-Numerical-Methods-and-Computing/Ass-2

1 file changed

+42
-1
lines changed

second-year/MA2K4-Numerical-Methods-and-Computing/Ass-2/main.tex

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,48 @@
2323
Interpolate the function $f(x) = \sqrt x$ by a quadratic polynomial $p_2(x)$ with notes at $x_0 = 1$, $x_1 = 2$, and $x_2 = 3$. Isolate the coefficients in the polynomial. Further, compute the error at $x = 6$ to three significant digits.
2424
\end{questionbody}
2525

26-
Answer
26+
\begin{align*}
27+
p_2(x) &= \sum_{k=0}^2 L_k(x) y_k \\[0.5ex]
28+
&= \sum_{k=0}^2 L_k(x) \sqrt k \\[0.5ex]
29+
&= L_0(x) \sqrt 1 + L_1(x) \sqrt 2 + L_2(x) \sqrt 3 \\[0.5ex]
30+
&= L_0(x) + L_1(x) \sqrt 2 + L_2(x) \sqrt 3 \\[0.5ex]
31+
&= \f{(x - x_1) (x - x_2)}{(x_0 - x_1) (x_0 - x_2)}
32+
+ \f{(x - x_0) (x - x_2)}{(x_1 - x_0) (x_1 - x_2)} \sqrt 2
33+
+ \f{(x - x_0) (x - x_1)}{(x_2 - x_0) (x_2 - x_1)} \sqrt 3 \\[0.5ex]
34+
&= \f{(x - 2) (x - 3)}{(1 - 2) (1 - 3)}
35+
+ \f{(x - 1) (x - 3)}{(2 - 1) (2 - 3)} \sqrt 2
36+
+ \f{(x - 1) (x - 2)}{(3 - 1) (3 - 2)} \sqrt 3 \\[0.5ex]
37+
&= \f{(x - 2) (x - 3)}{2}
38+
+ \f{(x - 1) (x - 3)}{-1} \sqrt 2
39+
+ \f{(x - 1) (x - 2)}{2} \sqrt 3 \\[0.5ex]
40+
&= \f{x^2 - 5x + 6}{2}
41+
+ \f{x^2 - 4x + 3}{-1} \sqrt 2
42+
+ \f{x^2 - 3x + 2}{2} \sqrt 3 \\[0.5ex]
43+
&= \f12 x^2 - \f52 x + 3
44+
- \sqrt 2 x^2 + 4\sqrt 2 x - 3 \sqrt 2
45+
+ \f{\sqrt 3}2 x^2 - \f{3\sqrt 3}2 x + \sqrt 3 \\[0.5ex]
46+
&= \l( \f12 - \sqrt 2 + \f{\sqrt 3}2 \r) x^2
47+
+ \l( -\f52 + 4\sqrt 2 - \f{3\sqrt 3}2 \r) x
48+
+ \l( 3 - 3 \sqrt 2 + \sqrt 3 \r)
49+
\end{align*}
50+
51+
The interpolation error at $x=6$ is
52+
\begin{align*}
53+
f(6) - p_2(6) &= \sqrt 6 - \l( \f12 - \sqrt 2 + \f{\sqrt 3}2 \r) 6^2 \\
54+
&\qquad - \l( -\f52 + 4\sqrt 2 - \f{3\sqrt 3}2 \r) 6
55+
- \l( 3 - 3 \sqrt 2 + \sqrt 3 \r) \\[0.5ex]
56+
&= \sqrt 6 - \l( 18 - 36 \sqrt 2 + 18 \sqrt 3 \r) \\
57+
&\qquad + 15 - 24 \sqrt 2 + 9\sqrt 3
58+
- 3 + 3 \sqrt 2 - \sqrt 3 \\[0.5ex]
59+
&= \sqrt 6 - 18 + 36 \sqrt 2 - 18 \sqrt 3 \\
60+
&\qquad + 15 - 24 \sqrt 2 + 9\sqrt 3
61+
- 3 + 3 \sqrt 2 - \sqrt 3 \\[0.5ex]
62+
&= -18 + 15 - 3
63+
+ 36 \sqrt 2 - 24 \sqrt 2 + 3 \sqrt 2 \\
64+
&\qquad - 18 \sqrt 3 + 9\sqrt 3 - \sqrt 3 + \sqrt 6 \\[0.5ex]
65+
&= -6 + 15 \sqrt 2 - 10 \sqrt 3 + \sqrt 6
66+
\end{align*}
67+
This computes to be 0.342 to 3 significant digits.
2768

2869
% }}}
2970

0 commit comments

Comments
 (0)