The Newton idea for systems¶
Let us use Newton’s method on the system defined by the function
Here is a function that computes the Jacobian matrix.
(These functions could be written as separate files, or embedded within another function as we have done here.) Our initial guess at a root is the origin.
We need the value (residual) of the nonlinear function, and its Jacobian, at this value for x.
We solve for the Newton step and compute the new estimate.
Here is the new residual.
We don’t seem to be especially close to a root. Let’s iterate a few more times. To do that, we start keeping the root estimates as elements of a vector (i.e., a vector of vectors). Same for the residuals.
We find the infinity norms of the residuals.
We don’t know an exact answer, so we will take the last computed value as its surrogate.
The following will subtract r from every column of x.
Now we take infinity norms and check for quadratic convergence.
For a brief time, we see ratios around 2, but then the limitation of double precision makes it impossible for the doubling to continue.