5.4 (a)
ENGR20005
Numerical Methods in Engineering
Workshop 5 Solutions
The system may be written as
2 −1 0x 1
−1 2 −1 y = 4 0 −1 2 z 7
So the matrices [A] and {c} are given by
2 −1 0 [A] = −1 2 −1
0 −1 2 1
{c} = 4 7
(b) Using Cholesky decomposition, we may write
√ √
2002−√10
2−10 13 2
−√ 0 3 2 [A]=−12−1=2 2 0 −
23 0−12 0−2√2 00√2
333
NOTE: The existence of a Cholesky decomposition of a symmetric matrix is sufficient to show that it is positive definite. But we’ll outline why that is the case.
Let {z} = (a, b, c)T ∈ R3. Then, we may write
√2 0 0
1 3 √
{ z } T [ L ] = a b c − √ 2 2 0 = 2 a − √1 b 3 b − 2 c √2 c 0−2√2 2 2 3 3
1
33
Hence
{z} [L][L] {z}= 2a−√2b 2b− 3c √3c 2b− 3
√ 2 a − √1 b √2
T T 1 3 2 23 2 √2 c
3
√ 1 2 3 22 2 2
= 2a−√2b + 2b− 3 + √3c >0
where the final inequality holds ∀(a, b, c) ∈ R3 \ {(0, 0, 0)}. (c),(d),(e) See Q5 4 sol.m for a solution.
5.5 (a)
The Newton–Raphson in vector form is given by
{a}(n+1) = {a}(n) − (∇{d}(n))−1 · {d}(n)
where {d} = ∇S = ∂S . ∂ai
The term ∇{d} is equivalent to the Jacobian of {d}, which is given by ∂
∂a1 ∂
∂a2 ∂S ∂S
[H]= . ∂a1 ∂a2 ··· ∂an
∂ ∂an
∂2S ∂2S···∂2S
∂ a 21 ∂2S
∂ a 1 ∂ a 2 ∂2S
∂ a 1 ∂ a n ∂2S
= ∂a2∂a1
∂a2 ···
∂a2∂an
. 2 . . … . ..
∂2S ∂2S ··· ∂2S ∂ a n ∂ a 1 ∂ a n ∂ a 2 ∂ a 2n
which is also known as the Hessian matrix.
(b) We may write
{a}(n+1) = {a}(n) − ([H](n))−1{d}(n)
⇒ − ([H](n))−1{d}(n) = {a}(n+1) − {a}(n) ⇒ [H](n)({a}(n+1) − {a}(n)) = −{d}(n)
Which is a much better form to work with since we don’t need to evaluate the inverse of [H](n).
(c) For y = axb, the error is given by
ei = yi − axbi
Hence the squared error is given by
NN
S=e2i =(yi−axbi)2
i=1
i=1
2
∂S
Taking the partial derivatives with respect to a and b, we have
∂b = Now, the second derivatives are
∂2S N
∂2S ∂2S
∂a∂b (a(n),b(n)) ∂b2 (a(n),b(n))
5.6 See Q5 6 sol.m.
b(n+1) −b(n) =−∂S
∂b (a(n),b(n))
∂S N
2(yi −axbi)(−xbi)
2(yi −axbi)(−alogxixbi)
∂a =
∂S N
=
∂a2
i=1
∂2S ∂2S N = =
∂a∂b ∂b∂a
∂2S N
i=1
i=1
2x2b i
4alogxx2b −2logxxby ii iii
4a2 log2 x x2b − 2a log2 x xby ∂b2 ii iii
i=1
Hence, the optimal parameters (a, b) may be determined using the following iter- ative method
∂2S ∂2S ∂S (n+1) (n)
=
i=1
∂a2 (a(n),b(n)) ∂b∂a (a(n),b(n)) a a ∂a (a(n),b(n))
3