3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Examples of Root-Finding (with and without derivatives)
</title>
5 <link rel=
"stylesheet" href=
"../../math.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.77.1">
7 <link rel=
"home" href=
"../../index.html" title=
"Math Toolkit 2.5.1">
8 <link rel=
"up" href=
"../roots.html" title=
"Root finding">
9 <link rel=
"prev" href=
"roots_deriv.html" title=
"Root Finding With Derivatives: Newton-Raphson, Halley & Schröder">
10 <link rel=
"next" href=
"root_finding_examples/cbrt_eg.html" title=
"Finding the Cubed Root With and Without Derivatives">
12 <body bgcolor=
"white" text=
"black" link=
"#0000FF" vlink=
"#840084" alink=
"#0000FF">
13 <table cellpadding=
"2" width=
"100%"><tr>
14 <td valign=
"top"><img alt=
"Boost C++ Libraries" width=
"277" height=
"86" src=
"../../../../../../boost.png"></td>
15 <td align=
"center"><a href=
"../../../../../../index.html">Home
</a></td>
16 <td align=
"center"><a href=
"../../../../../../libs/libraries.htm">Libraries
</a></td>
17 <td align=
"center"><a href=
"http://www.boost.org/users/people.html">People
</a></td>
18 <td align=
"center"><a href=
"http://www.boost.org/users/faq.html">FAQ
</a></td>
19 <td align=
"center"><a href=
"../../../../../../more/index.htm">More
</a></td>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"roots_deriv.html"><img src=
"../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../roots.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_finding_examples/cbrt_eg.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>
26 <div class=
"titlepage"><div><div><h3 class=
"title">
27 <a name=
"math_toolkit.roots.root_finding_examples"></a><a class=
"link" href=
"root_finding_examples.html" title=
"Examples of Root-Finding (with and without derivatives)">Examples of
28 Root-Finding (with and without derivatives)
</a>
29 </h3></div></div></div>
31 <dt><span class=
"section"><a href=
"root_finding_examples/cbrt_eg.html">Finding
32 the Cubed Root With and Without Derivatives
</a></span></dt>
33 <dt><span class=
"section"><a href=
"root_finding_examples/lambda.html">Using
34 C++
11 Lambda's
</a></span></dt>
35 <dt><span class=
"section"><a href=
"root_finding_examples/5th_root_eg.html">Computing
36 the Fifth Root
</a></span></dt>
37 <dt><span class=
"section"><a href=
"root_finding_examples/multiprecision_root.html">Root-finding
38 using Boost.Multiprecision
</a></span></dt>
39 <dt><span class=
"section"><a href=
"root_finding_examples/nth_root.html">Generalizing
40 to Compute the nth root
</a></span></dt>
41 <dt><span class=
"section"><a href=
"root_finding_examples/elliptic_eg.html">A
42 More complex example - Inverting the Elliptic Integrals
</a></span></dt>
45 The examples demonstrate how to use the various tools for
<a href=
"http://en.wikipedia.org/wiki/Root-finding_algorithm" target=
"_top">root
49 We start with the simple cube root function
<code class=
"computeroutput"><span class=
"identifier">cbrt
</span></code>
50 ( C++ standard function name
<a href=
"http://en.cppreference.com/w/cpp/numeric/math/cbrt" target=
"_top">cbrt
</a>)
51 showing root finding
<a class=
"link" href=
"root_finding_examples/cbrt_eg.html#math_toolkit.roots.root_finding_examples.cbrt_eg.cbrt_no_derivatives">without
55 We then show how use of derivatives can improve the speed of convergence.
58 (But these examples are only a demonstration and do not try to make the ultimate
59 improvements of an 'industrial-strength' implementation, for example, of
60 <code class=
"computeroutput"><span class=
"identifier">boost
</span><span class=
"special">::
</span><span class=
"identifier">math
</span><span class=
"special">::
</span><span class=
"identifier">cbrt
</span></code>, mainly by using a better computed
61 initial 'guess' at
<a href=
"../../../../../../libs/math/include/boost/math/special_functions/cbrt.hpp" target=
"_top">cbrt.hpp
</a>).
64 Then we show how a higher root (
<a class=
"link" href=
"root_finding_examples/5th_root_eg.html" title=
"Computing the Fifth Root">fifth
65 root
</a>)
<sup>5</sup>√ can be computed, and in
<a href=
"../../../../example/root_finding_n_example.cpp" target=
"_top">root_finding_n_example.cpp
</a>
66 a generic method for the
<a class=
"link" href=
"root_finding_examples/nth_root.html" title=
"Generalizing to Compute the nth root">nth
67 root
</a> that constructs the derivatives at compile-time.
70 These methods should be applicable to other functions that can be differentiated
74 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
75 <td align=
"left"></td>
76 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2006-
2010,
2012-
2014 Nikhar Agrawal,
77 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
78 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R
åde, Gautam Sewani,
79 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang
<p>
80 Distributed under the Boost Software License, Version
1.0. (See accompanying
81 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>)
86 <div class=
"spirit-nav">
87 <a accesskey=
"p" href=
"roots_deriv.html"><img src=
"../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../roots.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_finding_examples/cbrt_eg.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>