![]() |
Prev | Next | multi_newton |
multi_newton(
xout,
fun,
n_grid,
xlow,
xup,
epsilon,
max_itr)
x \in [a, b]
(where
a < b
)
such that
f(x) = 0
.
i = 0 , \ldots , n
,
we define the i-th grid point
g_i
and the i-th interval
I_i
by
\[
\begin{array}{rcl}
g_i & = & a \frac{n - i}{n} + b \frac{i}{n}
\\
I_i & = & [ g_i , g_{i+1} ]
\end{array}
\]
Newton's method is applied starting
at the center of each of the intervals
I_i
for
i = 0 , \ldots , n-1
and at most one zero is found for each interval.
CppAD::vector<double> &
xout
The input size and value of the elements of xout do not matter.
Upon return from multi_newton
,
the size of xout is less than
n
and
\[
| f( xout[i] ) | \leq epsilon
\]
for each valid index i.
Two
x
solutions are considered equal (and joined as one) if
the absolute difference between the solutions is less than
(b - a) / n
.
Fun &
fun
This argument must evaluate the function
f(x)
using the syntax
f =
fun(
x)
where the argument x and the result f
have the prototypes
const AD<double> &
x
AD<double>
f
.
size_t
n_grid
It specifies the number of grid points; i.e.,
n
in the method
above.
double
xlow
It specifies the lower limit for the entire search; i.e.,
a
in the method
above.
double
xup
It specifies the upper limit for the entire search; i.e.,
b
in the method
above.
double
epsilon
It specifies the convergence criteria for Newton's method in terms
of how small the function value must be.
size_t
max_itr
It specifies the maximum number of iterations of Newton's method to try
before giving up on convergence.