Skip to content

Commit

Permalink
Minor cleanup of minimaxApprox and plot documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
aadler committed Aug 23, 2023
1 parent 89a907e commit 9a71e80
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
59 changes: 30 additions & 29 deletions man/MiniMaxApprox.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ minimaxApprox(fn, lower, upper, degree, relErr = FALSE, xi = NULL,
\code{maxiter}.
\item \code{showProgress}: logical; If \code{TRUE} will print error
values at each iteration.
\item \code{convRatio}: numeric; The convergence ratio tolerance.
Defaults to \code{1+1e-9}. See \strong{Details}.
\item \code{tol}: numeric; The absolute difference tolerance.
Defaults to \code{1e-14}. See \strong{Details}.
\item \code{tailtol}: numeric; The tolerance of the coefficient of
the largest power of \code{x} to be ignored when performing the
polynomial approximation a second time. Defaults to \code{1e-10}.
See \strong{Details}.
\item \code{convRatio}: numeric; The convergence ratio tolerance.
Defaults to \code{1+1e-9}. See \strong{Details}.
\item \code{tol}: numeric; The absolute difference tolerance.
Defaults to \code{1e-14}. See \strong{Details}.
\item \code{tailtol}: numeric; The tolerance of the coefficient of
the largest power of \code{x} to be ignored when performing the
polynomial approximation a second time. Defaults to \code{1e-10}.
See \strong{Details}.
}
}
}
Expand All @@ -69,42 +69,43 @@ as described by Cody et al. (1968). Convergence is considered achieved when all
three of the following criteria are met:
\enumerate{
\item The observed error magnitudes are within tolerance of the expected
error (Distance Test).
\item The observed error magnitudes are within tolerance of each other
(Magnitude Test).
\item The observed error signs oscillate (Oscillating Test).
error---the \strong{Distance Test}.
\item The observed error magnitudes are within tolerance of each
other---the \strong{Magnitude Test}.
\item The observed error signs oscillate---the
\strong{Oscillation Test}.
}
\dQuote{Within tolerance} can be met in one of two ways:
\enumerate{
\item The difference between the absolute magnitudes is less than or
equal to \code{tol}.
\item The ratio between the larger and smaller is less than or equal to
\code{convRatio}.
\item The ratio between the absolute magnitudes of the larger and
smaller is less than or equal to \code{convRatio}.
}

For efficiency, the Distance Test is taken between the absolute value of the
largest observed error and the absolute value of the expected error. Similarly,
the Magnitude Test is taken between the absolute value of the largest observed
error and the absolute value of the smallest observed error. Both the Magnitude
Test and the Distance Test can be passed by \strong{either} being within
\code{tol} or \code{convRatio} as described above.
For efficiency, the \strong{Distance Test} is taken between the absolute value
of the largest observed error and the absolute value of the expected error.
Similarly, the \strong{Magnitude Test} is taken between the absolute value of
the largest observed error and the absolute value of the smallest observed
error. Both tests can be passed by \strong{either} being within \code{tol} or
\code{convRatio} as described above.
}
\subsection{Polynomial Evaluation}{
The polynomials are evaluated using the Compensated Horner Scheme of Langlois et
al. (2006) to enhance both stability and precision at the expense of some speed.
al. (2006) to enhance both stability and precision.
}
\subsection{Polynomial Algorithm Singular Error Response}{
\subsection{Polynomial Algorithm \dQuote{Singular Error} Response}{
When too high of a degree is requested for the tolerance of the algorithm, it
often fails with a singular matrix error. In this case, for the polynomial
version, the algorithm will try looking for an approximation of degree
\code{n + 1}. If it finds one, \strong{and} the contribution of that coefficient
to the approximation is \eqn{\le}\code{tailtol}, it will ignore that coefficient
and return the resulting degree \code{n} polynomial, as the largest coefficient
is effectively 0. The contribution is measured by multiplying that coefficient
by the endpoint with the larger absolute magnitude raised to the \code{n + 1}
power. This is done to prevent errors in cases where a very small coefficient is
found on a range with very large absolute values and the resulting contribution
to the approximation is \strong{not} \emph{de minimis}.
to the approximation is \eqn{\le} \code{tailtol}, it will ignore that
coefficient and return the resulting degree \code{n} polynomial, as the largest
coefficient is effectively 0. The contribution is measured by multiplying that
coefficient by the endpoint with the larger absolute magnitude raised to the
\code{n + 1} power. This is done to prevent errors in cases where a very small
coefficient is found on a range with very large absolute values and the
resulting contribution to the approximation is \strong{not} \emph{de minimis}.
}
}
\value{
Expand Down
2 changes: 1 addition & 1 deletion man/plot.minimaxApprox.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

\description{
Produces a plot of the error of the \code{"minimaxApprox"} object, highlighting
the basis points and error bounds.
the basis points and the error bounds.
}

\usage{\method{plot}{minimaxApprox}(x, y, \dots)}
Expand Down

0 comments on commit 9a71e80

Please sign in to comment.