Graphics Programs Reference
In-Depth Information
x
2
, wecan write Eq. (4.5a) as
Dropping termsoforder
f
(
x
+
x
)
=
f
(
x
)
+
J
(
x
)
x
(4.5b)
where
J
(
x
) is the
Jacobian matrix
(of size
n
×
n
) made up of the partial derivatives
∂
f
i
J
i j
=
(4.6)
∂
x
j
Note that Eq. (4.5b) is a linear approximation (vector
x
being the variable) of the
vector-valued function
f
in the vicinity of point
x
.
Let us nowassumethat
x
is the current approximation of the solution of
f
(
x
)
=
0
,
and let
x
+
x
be the improved solution. To find the correction
x,
we set
f
(
x
+
x
)
=
0
in Eq. (4.5b). The result is a set of linear equationsfor
x
:
J
(
x
)
x
=−
f
(
x
)
(4.7)
The following stepsconstitute the Newton-Raphsonmethod for simultaneous,
nonlinear equations:
1. Estimate the solutionvector
x
.
2. Evaluate
f
(
x
).
3. Compute the Jacobian matrix
J
(
x
)fromEq. (4.6).
4. et up the simultaneousequations in Eq. (4.7) and solvefor
x
.
5.
Let
x
←
x
+
x
and repeat steps 2-5.
is the error tolerance.As
in the one-dimensionalcase, success of the Newton-Raphsonprocedure depends
entirely on the initial estimate of
x
The above process iscontinueduntil
|
x
|
<ε,
where
ε
If agood starting point is used,convergence to the
solutionis very rapid. Otherwise, the results are unpredictable.
Because analytical derivation of each
.
x
j
can be difficult or impractical, it is
preferable to let the computer calculate the partial derivatives from the finite differ-
ence approximation
∂
f
i
/∂
∂
f
i
f
i
(
x
+
e
j
h
)
−
f
i
(
x
)
x
j
≈
(4.8)
∂
h
where
h
is a small increment and
e
j
represents a unit vectorinthe direction of
x
j
.
Thisformula can beobtained fromEq. (4.5a) afterdropping the termsoforder
x
2
and setting
e
j
h
.Byusing the finite difference approximation, we also avoid the
tedium of typing the expressionsfor
x
=
∂
f
i
/∂
x
j
into the computer code.
newtonRaphson2
Thisfunctionis an implementation of the Newton-Raphsonmethod. The nested func-
tion
jacobian
computes the Jacobianmatrix fromthe finite difference approximation
Search WWH ::
Custom Search