mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-03 14:34:41 -04:00
Squashed 'boost/' content from commit b4feb19f2
git-subtree-dir: boost git-subtree-split: b4feb19f287ee92d87a9624b5d36b7cf46aeadeb
This commit is contained in:
@@ -0,0 +1,193 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Algorithm TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions</title>
|
||||
<link rel="stylesheet" href="../../../math.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../../index.html" title="Math Toolkit 2.5.1">
|
||||
<link rel="up" href="../roots_noderiv.html" title="Root Finding Without Derivatives">
|
||||
<link rel="prev" href="bracket_solve.html" title="Bracket and Solve Root">
|
||||
<link rel="next" href="brent.html" title="Brent-Decker Algorithm">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="bracket_solve.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="brent.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="math_toolkit.roots.roots_noderiv.TOMS748"></a><a class="link" href="TOMS748.html" title="Algorithm TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions">Algorithm
|
||||
TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions</a>
|
||||
</h4></div></div></div>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Tol</span><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="identifier">toms748_solve</span><span class="special">(</span>
|
||||
<span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">Tol</span> <span class="identifier">tol</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uintmax_t</span><span class="special">&</span> <span class="identifier">max_iter</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Tol</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="identifier">toms748_solve</span><span class="special">(</span>
|
||||
<span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="identifier">Tol</span> <span class="identifier">tol</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uintmax_t</span><span class="special">&</span> <span class="identifier">max_iter</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Tol</span><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="identifier">toms748_solve</span><span class="special">(</span>
|
||||
<span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">fa</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">fb</span><span class="special">,</span>
|
||||
<span class="identifier">Tol</span> <span class="identifier">tol</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uintmax_t</span><span class="special">&</span> <span class="identifier">max_iter</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Tol</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="identifier">toms748_solve</span><span class="special">(</span>
|
||||
<span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">b</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">fa</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">fb</span><span class="special">,</span>
|
||||
<span class="identifier">Tol</span> <span class="identifier">tol</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uintmax_t</span><span class="special">&</span> <span class="identifier">max_iter</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
|
||||
</pre>
|
||||
<p>
|
||||
These functions implement TOMS Algorithm 748: it uses a mixture of cubic,
|
||||
quadratic and linear (secant) interpolation to locate the root of <span class="emphasis"><em>f(x)</em></span>.
|
||||
The two pairs of functions differ only by whether values for <span class="emphasis"><em>f(a)</em></span>
|
||||
and <span class="emphasis"><em>f(b)</em></span> are already available.
|
||||
</p>
|
||||
<p>
|
||||
Generally speaking it is easier (and often more efficient) to use <a class="link" href="bracket_solve.html" title="Bracket and Solve Root">bracket and solve</a>
|
||||
rather than trying to bracket the root yourself as this function requires.
|
||||
</p>
|
||||
<p>
|
||||
This function is provided rather than <a href="http://en.wikipedia.org/wiki/Brent%27s_method" target="_top">Brent's
|
||||
method</a> as it is known to be more effient in many cases (it is asymptotically
|
||||
the most efficient known, and has been shown to be optimal for a certain
|
||||
classes of smooth functions). It also has the useful property of decreasing
|
||||
the bracket size with each step, unlike Brent's method which only shrinks
|
||||
the enclosing interval in the final step. This makes it particularly useful
|
||||
when you need a result where the ends of the interval round to the same
|
||||
integer: as often happens in statistical applications for example. In this
|
||||
situation the function is able to exit after a much smaller number of iterations
|
||||
than would otherwise be possible.
|
||||
</p>
|
||||
<p>
|
||||
The <a class="link" href="TOMS748.html" title="Algorithm TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions">TOMS 748 algorithm</a>
|
||||
parameters are:
|
||||
</p>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl class="variablelist">
|
||||
<dt><span class="term">f</span></dt>
|
||||
<dd><p>
|
||||
A unary functor that is the function whose root is to be solved.
|
||||
f(x) need not be uniformly increasing or decreasing on <span class="emphasis"><em>x</em></span>
|
||||
and may have multiple roots. However, the bounds given must bracket
|
||||
a single root.
|
||||
</p></dd>
|
||||
<dt><span class="term">a</span></dt>
|
||||
<dd><p>
|
||||
The lower bound for the initial bracket of the root.
|
||||
</p></dd>
|
||||
<dt><span class="term">b</span></dt>
|
||||
<dd><p>
|
||||
The upper bound for the initial bracket of the root. It is a precondition
|
||||
that <span class="emphasis"><em>a < b</em></span> and that <span class="emphasis"><em>a</em></span>
|
||||
and <span class="emphasis"><em>b</em></span> bracket the root to find so that <span class="emphasis"><em>f(a)
|
||||
* f(b) < 0</em></span>.
|
||||
</p></dd>
|
||||
<dt><span class="term">fa</span></dt>
|
||||
<dd><p>
|
||||
Optional: the value of <span class="emphasis"><em>f(a)</em></span>.
|
||||
</p></dd>
|
||||
<dt><span class="term">fb</span></dt>
|
||||
<dd><p>
|
||||
Optional: the value of <span class="emphasis"><em>f(b)</em></span>.
|
||||
</p></dd>
|
||||
<dt><span class="term">tol</span></dt>
|
||||
<dd><p>
|
||||
A binary functor that determines the termination condition for the
|
||||
search for the root. <span class="emphasis"><em>tol</em></span> is passed the current
|
||||
brackets at each step, when it returns true, then the current brackets
|
||||
are returned as the result. See also <a class="link" href="root_termination.html" title="Termination Condition Functors">predefined
|
||||
termination functors</a>.
|
||||
</p></dd>
|
||||
<dt><span class="term">max_iter</span></dt>
|
||||
<dd><p>
|
||||
The maximum number of function invocations to perform in the search
|
||||
for the root. On exit, <span class="emphasis"><em>max_iter</em></span> is set to actual
|
||||
number of function invocations used.
|
||||
</p></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
The final <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and
|
||||
can be used to control the behaviour of the function: how it handles errors,
|
||||
what level of precision to use etc. Refer to the <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">policy
|
||||
documentation for more details</a>.
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">toms748_solve</span></code> returns:
|
||||
a pair of values <span class="emphasis"><em>r</em></span> that bracket the root so that:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">f</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">first</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">second</span><span class="special">)</span> <span class="special"><=</span> <span class="number">0</span>
|
||||
</pre>
|
||||
<p>
|
||||
and either
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">tol</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">r</span><span class="special">.</span><span class="identifier">second</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">true</span>
|
||||
</pre>
|
||||
<p>
|
||||
or
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">max_iter</span> <span class="special">>=</span> <span class="identifier">m</span>
|
||||
</pre>
|
||||
<p>
|
||||
where <span class="emphasis"><em>m</em></span> is the initial value of <span class="emphasis"><em>max_iter</em></span>
|
||||
passed to the function.
|
||||
</p>
|
||||
<p>
|
||||
In other words, it's up to the caller to verify whether termination occurred
|
||||
as a result of exceeding <span class="emphasis"><em>max_iter</em></span> function invocations
|
||||
(easily done by checking the updated value of <span class="emphasis"><em>max_iter</em></span>
|
||||
against its previous value passed as parameter), rather than because the
|
||||
termination condition <span class="emphasis"><em>tol</em></span> was satisfied.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal,
|
||||
Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
|
||||
Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani,
|
||||
Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="bracket_solve.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="brent.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,152 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Bisection</title>
|
||||
<link rel="stylesheet" href="../../../math.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../../index.html" title="Math Toolkit 2.5.1">
|
||||
<link rel="up" href="../roots_noderiv.html" title="Root Finding Without Derivatives">
|
||||
<link rel="prev" href="../roots_noderiv.html" title="Root Finding Without Derivatives">
|
||||
<link rel="next" href="bracket_solve.html" title="Bracket and Solve Root">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="bracket_solve.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="math_toolkit.roots.roots_noderiv.bisect"></a><a class="link" href="bisect.html" title="Bisection">Bisection</a>
|
||||
</h4></div></div></div>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Tol</span><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="identifier">bisect</span><span class="special">(</span> <span class="comment">// Unlimited iterations.</span>
|
||||
<span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">T</span> <span class="identifier">min</span><span class="special">,</span>
|
||||
<span class="identifier">T</span> <span class="identifier">max</span><span class="special">,</span>
|
||||
<span class="identifier">Tol</span> <span class="identifier">tol</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Tol</span><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="identifier">bisect</span><span class="special">(</span> <span class="comment">// Limited iterations.</span>
|
||||
<span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">T</span> <span class="identifier">min</span><span class="special">,</span>
|
||||
<span class="identifier">T</span> <span class="identifier">max</span><span class="special">,</span>
|
||||
<span class="identifier">Tol</span> <span class="identifier">tol</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uintmax_t</span><span class="special">&</span> <span class="identifier">max_iter</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Tol</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="identifier">bisect</span><span class="special">(</span> <span class="comment">// Specified policy.</span>
|
||||
<span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="identifier">T</span> <span class="identifier">min</span><span class="special">,</span>
|
||||
<span class="identifier">T</span> <span class="identifier">max</span><span class="special">,</span>
|
||||
<span class="identifier">Tol</span> <span class="identifier">tol</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uintmax_t</span><span class="special">&</span> <span class="identifier">max_iter</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
|
||||
</pre>
|
||||
<p>
|
||||
These functions locate the root using <a href="https://en.wikipedia.org/wiki/Bisection" target="_top">bisection</a>.
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">bisect</span></code> function arguments
|
||||
are:
|
||||
</p>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl class="variablelist">
|
||||
<dt><span class="term">f</span></dt>
|
||||
<dd><p>
|
||||
A unary functor which is the function <span class="emphasis"><em>f(x)</em></span> whose
|
||||
root is to be found.
|
||||
</p></dd>
|
||||
<dt><span class="term">min</span></dt>
|
||||
<dd><p>
|
||||
The left bracket of the interval known to contain the root.
|
||||
</p></dd>
|
||||
<dt><span class="term">max</span></dt>
|
||||
<dd><p>
|
||||
The right bracket of the interval known to contain the root.<br>
|
||||
It is a precondition that <span class="emphasis"><em>min < max</em></span> and
|
||||
<span class="emphasis"><em>f(min)*f(max) <= 0</em></span>, the function raises an
|
||||
<a class="link" href="../../error_handling.html#math_toolkit.error_handling.evaluation_error">evaluation_error</a>
|
||||
if these preconditions are violated. The action taken on error is
|
||||
controlled by the <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a> template argument:
|
||||
the default behavior is to throw a <span class="emphasis"><em>boost::math::evaluation_error</em></span>.
|
||||
If the <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a> is changed to not throw
|
||||
then it returns <span class="emphasis"><em>std::pair<T>(min, min)</em></span>.
|
||||
</p></dd>
|
||||
<dt><span class="term">tol</span></dt>
|
||||
<dd><p>
|
||||
A binary functor that specifies the termination condition: the function
|
||||
will return the current brackets enclosing the root when <span class="emphasis"><em>tol(min,
|
||||
max)</em></span> becomes true. See also <a class="link" href="root_termination.html" title="Termination Condition Functors">predefined
|
||||
termination functors</a>.
|
||||
</p></dd>
|
||||
<dt><span class="term">max_iter</span></dt>
|
||||
<dd><p>
|
||||
The maximum number of invocations of <span class="emphasis"><em>f(x)</em></span> to
|
||||
make while searching for the root. On exit, this is updated to the
|
||||
actual number of invocations performed.
|
||||
</p></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
The final <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and
|
||||
can be used to control the behaviour of the function: how it handles errors,
|
||||
what level of precision to use etc. Refer to the <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">policy
|
||||
documentation for more details</a>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Returns</strong></span>: a pair of values <span class="emphasis"><em>r</em></span>
|
||||
that bracket the root so that:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">f</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">first</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">second</span><span class="special">)</span> <span class="special"><=</span> <span class="number">0</span>
|
||||
</pre>
|
||||
<p>
|
||||
and either
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">tol</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">r</span><span class="special">.</span><span class="identifier">second</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">true</span>
|
||||
</pre>
|
||||
<p>
|
||||
or
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">max_iter</span> <span class="special">>=</span> <span class="identifier">m</span>
|
||||
</pre>
|
||||
<p>
|
||||
where <span class="emphasis"><em>m</em></span> is the initial value of <span class="emphasis"><em>max_iter</em></span>
|
||||
passed to the function.
|
||||
</p>
|
||||
<p>
|
||||
In other words, it's up to the caller to verify whether termination occurred
|
||||
as a result of exceeding <span class="emphasis"><em>max_iter</em></span> function invocations
|
||||
(easily done by checking the updated value of <span class="emphasis"><em>max_iter</em></span>
|
||||
when the function returns), rather than because the termination condition
|
||||
<span class="emphasis"><em>tol</em></span> was satisfied.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal,
|
||||
Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
|
||||
Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani,
|
||||
Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="bracket_solve.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,186 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Bracket and Solve Root</title>
|
||||
<link rel="stylesheet" href="../../../math.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../../index.html" title="Math Toolkit 2.5.1">
|
||||
<link rel="up" href="../roots_noderiv.html" title="Root Finding Without Derivatives">
|
||||
<link rel="prev" href="bisect.html" title="Bisection">
|
||||
<link rel="next" href="TOMS748.html" title="Algorithm TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="bisect.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="TOMS748.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="math_toolkit.roots.roots_noderiv.bracket_solve"></a><a class="link" href="bracket_solve.html" title="Bracket and Solve Root">Bracket
|
||||
and Solve Root</a>
|
||||
</h4></div></div></div>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Tol</span><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="identifier">bracket_and_solve_root</span><span class="special">(</span>
|
||||
<span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">guess</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">factor</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">rising</span><span class="special">,</span>
|
||||
<span class="identifier">Tol</span> <span class="identifier">tol</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uintmax_t</span><span class="special">&</span> <span class="identifier">max_iter</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">F</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Tol</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="identifier">bracket_and_solve_root</span><span class="special">(</span>
|
||||
<span class="identifier">F</span> <span class="identifier">f</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">guess</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">factor</span><span class="special">,</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">rising</span><span class="special">,</span>
|
||||
<span class="identifier">Tol</span> <span class="identifier">tol</span><span class="special">,</span>
|
||||
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uintmax_t</span><span class="special">&</span> <span class="identifier">max_iter</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
|
||||
</pre>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">bracket_and_solve_root</span></code>
|
||||
is a convenience function that calls <a class="link" href="TOMS748.html" title="Algorithm TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions">TOMS
|
||||
748 algorithm</a> internally to find the root of <span class="emphasis"><em>f(x)</em></span>.
|
||||
It is generally much easier to use this function rather than <a class="link" href="TOMS748.html" title="Algorithm TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions">TOMS
|
||||
748 algorithm</a>, since it does the hard work of bracketing the root
|
||||
for you. It's bracketing routines are quite robust and will usually be
|
||||
more foolproof than home-grown routines, unless the function can be analysed
|
||||
to yield tight brackets.
|
||||
</p>
|
||||
<p>
|
||||
Note that this routine can only be used when:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
<span class="emphasis"><em>f(x)</em></span> is monotonic in the half of the real axis
|
||||
containing <span class="emphasis"><em>guess</em></span>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The value of the inital guess must have the same sign as the root:
|
||||
the function will <span class="emphasis"><em>never cross the origin</em></span> when
|
||||
searching for the root.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The location of the root should be known at least approximately, if
|
||||
the location of the root differs by many orders of magnitude from
|
||||
<span class="emphasis"><em>guess</em></span> then many iterations will be needed to bracket
|
||||
the root in spite of the special heuristics used to guard against this
|
||||
very situation. A typical example would be setting the initial guess
|
||||
to 0.1, when the root is at 1e-300.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The <code class="computeroutput"><span class="identifier">bracket_and_solve_root</span></code>
|
||||
parameters are:
|
||||
</p>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl class="variablelist">
|
||||
<dt><span class="term">f</span></dt>
|
||||
<dd><p>
|
||||
A unary functor that is the function whose root is to be solved.
|
||||
<span class="emphasis"><em>f(x)</em></span> must be uniformly increasing or decreasing
|
||||
on <span class="emphasis"><em>x</em></span>.
|
||||
</p></dd>
|
||||
<dt><span class="term">guess</span></dt>
|
||||
<dd><p>
|
||||
An initial approximation to the root.
|
||||
</p></dd>
|
||||
<dt><span class="term">factor</span></dt>
|
||||
<dd><p>
|
||||
A scaling factor that is used to bracket the root: the value <span class="emphasis"><em>guess</em></span>
|
||||
is multiplied (or divided as appropriate) by <span class="emphasis"><em>factor</em></span>
|
||||
until two values are found that bracket the root. A value such as
|
||||
2 is a typical choice for <span class="emphasis"><em>factor</em></span>. In addition
|
||||
<span class="emphasis"><em>factor</em></span> will be multiplied by 2 every 32 iterations:
|
||||
this is to guard against a really very bad initial guess, typically
|
||||
these occur when it's known the result is very large or small, but
|
||||
not the exact order of magnitude.
|
||||
</p></dd>
|
||||
<dt><span class="term">rising</span></dt>
|
||||
<dd><p>
|
||||
Set to <span class="emphasis"><em>true</em></span> if <span class="emphasis"><em>f(x)</em></span> is
|
||||
rising on <span class="emphasis"><em>x</em></span> and <span class="emphasis"><em>false</em></span> if
|
||||
<span class="emphasis"><em>f(x)</em></span> is falling on <span class="emphasis"><em>x</em></span>. This
|
||||
value is used along with the result of <span class="emphasis"><em>f(guess)</em></span>
|
||||
to determine if <span class="emphasis"><em>guess</em></span> is above or below the
|
||||
root.
|
||||
</p></dd>
|
||||
<dt><span class="term">tol</span></dt>
|
||||
<dd><p>
|
||||
A binary functor that determines the termination condition for the
|
||||
search for the root. <span class="emphasis"><em>tol</em></span> is passed the current
|
||||
brackets at each step, when it returns true then the current brackets
|
||||
are returned as the pair result. See also <a class="link" href="root_termination.html" title="Termination Condition Functors">predefined
|
||||
termination functors</a>.
|
||||
</p></dd>
|
||||
<dt><span class="term">max_iter</span></dt>
|
||||
<dd><p>
|
||||
The maximum number of function invocations to perform in the search
|
||||
for the root. On exit is set to the actual number of invocations
|
||||
performed.
|
||||
</p></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
The final <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and
|
||||
can be used to control the behaviour of the function: how it handles errors,
|
||||
what level of precision to use etc. Refer to the <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">policy
|
||||
documentation for more details</a>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Returns</strong></span>: a pair of values <span class="emphasis"><em>r</em></span>
|
||||
that bracket the root so that:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">f</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">first</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">second</span><span class="special">)</span> <span class="special"><=</span> <span class="number">0</span>
|
||||
</pre>
|
||||
<p>
|
||||
and either
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">tol</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">r</span><span class="special">.</span><span class="identifier">second</span><span class="special">)</span> <span class="special">==</span> <span class="keyword">true</span>
|
||||
</pre>
|
||||
<p>
|
||||
or
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">max_iter</span> <span class="special">>=</span> <span class="identifier">m</span>
|
||||
</pre>
|
||||
<p>
|
||||
where <span class="emphasis"><em>m</em></span> is the initial value of <span class="emphasis"><em>max_iter</em></span>
|
||||
passed to the function.
|
||||
</p>
|
||||
<p>
|
||||
In other words, it's up to the caller to verify whether termination occurred
|
||||
as a result of exceeding <span class="emphasis"><em>max_iter</em></span> function invocations
|
||||
(easily done by checking the value of <span class="emphasis"><em>max_iter</em></span> when
|
||||
the function returns), rather than because the termination condition <span class="emphasis"><em>tol</em></span>
|
||||
was satisfied.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal,
|
||||
Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
|
||||
Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani,
|
||||
Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="bisect.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="TOMS748.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,54 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Brent-Decker Algorithm</title>
|
||||
<link rel="stylesheet" href="../../../math.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../../index.html" title="Math Toolkit 2.5.1">
|
||||
<link rel="up" href="../roots_noderiv.html" title="Root Finding Without Derivatives">
|
||||
<link rel="prev" href="TOMS748.html" title="Algorithm TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions">
|
||||
<link rel="next" href="root_termination.html" title="Termination Condition Functors">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="TOMS748.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="root_termination.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="math_toolkit.roots.roots_noderiv.brent"></a><a class="link" href="brent.html" title="Brent-Decker Algorithm">Brent-Decker
|
||||
Algorithm</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
The <a href="http://en.wikipedia.org/wiki/Brent%27s_method" target="_top">Brent-Dekker
|
||||
algorithm</a>, although very well know, is not provided by this library
|
||||
as <a class="link" href="TOMS748.html" title="Algorithm TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions">TOMS 748 algorithm</a>
|
||||
or its slightly easier to use variant <a class="link" href="bracket_solve.html" title="Bracket and Solve Root">bracket
|
||||
and solve</a> are superior and provide equivalent functionality.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal,
|
||||
Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
|
||||
Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani,
|
||||
Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="TOMS748.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="root_termination.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,63 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Implementation</title>
|
||||
<link rel="stylesheet" href="../../../math.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../../index.html" title="Math Toolkit 2.5.1">
|
||||
<link rel="up" href="../roots_noderiv.html" title="Root Finding Without Derivatives">
|
||||
<link rel="prev" href="root_termination.html" title="Termination Condition Functors">
|
||||
<link rel="next" href="../roots_deriv.html" title="Root Finding With Derivatives: Newton-Raphson, Halley & Schröder">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="root_termination.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../roots_deriv.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="math_toolkit.roots.roots_noderiv.implementation"></a><a class="link" href="implementation.html" title="Implementation">Implementation</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
The implementation of the bisection algorithm is extremely straightforward
|
||||
and not detailed here.
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://portal.acm.org/citation.cfm?id=210111" target="_top">TOMS Algorithm
|
||||
748: enclosing zeros of continuous functions</a> is described in detail
|
||||
in:
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Algorithm 748: Enclosing Zeros of Continuous Functions, G. E.
|
||||
Alefeld, F. A. Potra and Yixun Shi, ACM Transactions on Mathematica1 Software,
|
||||
Vol. 21. No. 3. September 1995. Pages 327-344.</em></span>
|
||||
</p>
|
||||
<p>
|
||||
The implementation here is a faithful translation of this paper into C++.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal,
|
||||
Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
|
||||
Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani,
|
||||
Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="root_termination.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../roots_deriv.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,102 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Termination Condition Functors</title>
|
||||
<link rel="stylesheet" href="../../../math.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="../../../index.html" title="Math Toolkit 2.5.1">
|
||||
<link rel="up" href="../roots_noderiv.html" title="Root Finding Without Derivatives">
|
||||
<link rel="prev" href="brent.html" title="Brent-Decker Algorithm">
|
||||
<link rel="next" href="implementation.html" title="Implementation">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="brent.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="implementation.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="math_toolkit.roots.roots_noderiv.root_termination"></a><a class="link" href="root_termination.html" title="Termination Condition Functors">Termination
|
||||
Condition Functors</a>
|
||||
</h4></div></div></div>
|
||||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">eps_tolerance</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">eps_tolerance</span><span class="special">();</span>
|
||||
<span class="identifier">eps_tolerance</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">bits</span><span class="special">);</span>
|
||||
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">b</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">eps_tolerance</span></code> is the usual
|
||||
termination condition used with these root finding functions. Its <code class="computeroutput"><span class="keyword">operator</span><span class="special">()</span></code>
|
||||
will return true when the relative distance between <span class="emphasis"><em>a</em></span>
|
||||
and <span class="emphasis"><em>b</em></span> is less than four times the machine epsilon
|
||||
for T, or 2<sup>1-bits</sup>, whichever is the larger. In other words, you set <span class="emphasis"><em>bits</em></span>
|
||||
to the number of bits of precision you want in the result. The minimal
|
||||
tolerance of <span class="emphasis"><em>four times the machine epsilon of type T</em></span>
|
||||
is required to ensure that we get back a bracketing interval, since this
|
||||
must clearly be at greater than one epsilon in size. While in theory a
|
||||
maximum distance of twice machine epsilon is possible to achieve, in practice
|
||||
this results in a great deal of "thrashing" given that the function
|
||||
whose root is being found can only ever be accurate to 1 epsilon at best.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">equal_floor</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">equal_floor</span><span class="special">();</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">b</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
This termination condition is used when you want to find an integer result
|
||||
that is the <span class="emphasis"><em>floor</em></span> of the true root. It will terminate
|
||||
as soon as both ends of the interval have the same <span class="emphasis"><em>floor</em></span>.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">equal_ceil</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">equal_ceil</span><span class="special">();</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">b</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
This termination condition is used when you want to find an integer result
|
||||
that is the <span class="emphasis"><em>ceil</em></span> of the true root. It will terminate
|
||||
as soon as both ends of the interval have the same <span class="emphasis"><em>ceil</em></span>.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">equal_nearest_integer</span>
|
||||
<span class="special">{</span>
|
||||
<span class="identifier">equal_nearest_integer</span><span class="special">();</span>
|
||||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> <span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">()(</span><span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">a</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">T</span><span class="special">&</span> <span class="identifier">b</span><span class="special">)</span><span class="keyword">const</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
</pre>
|
||||
<p>
|
||||
This termination condition is used when you want to find an integer result
|
||||
that is the <span class="emphasis"><em>closest</em></span> to the true root. It will terminate
|
||||
as soon as both ends of the interval round to the same nearest integer.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal,
|
||||
Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
|
||||
Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani,
|
||||
Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="brent.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots_noderiv.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="implementation.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user