]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/doc/html/math_toolkit/ellint/ellint_3.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / ellint / ellint_3.html
CommitLineData
7c673cae
FG
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4<title>Elliptic Integrals of the Third Kind - Legendre Form</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="../ellint.html" title="Elliptic Integrals">
9<link rel="prev" href="ellint_2.html" title="Elliptic Integrals of the Second Kind - Legendre Form">
10<link rel="next" href="ellint_d.html" title="Elliptic Integral D - Legendre Form">
11</head>
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>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="ellint_2.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ellint.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="ellint_d.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="math_toolkit.ellint.ellint_3"></a><a class="link" href="ellint_3.html" title="Elliptic Integrals of the Third Kind - Legendre Form">Elliptic Integrals of the
28 Third Kind - Legendre Form</a>
29</h3></div></div></div>
30<h5>
31<a name="math_toolkit.ellint.ellint_3.h0"></a>
32 <span class="phrase"><a name="math_toolkit.ellint.ellint_3.synopsis"></a></span><a class="link" href="ellint_3.html#math_toolkit.ellint.ellint_3.synopsis">Synopsis</a>
33 </h5>
34<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">ellint_3</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
35</pre>
36<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span> <span class="special">{</span>
37
38<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
39<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ellint_3</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">phi</span><span class="special">);</span>
40
41<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
42<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ellint_3</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">phi</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
43
44<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
45<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ellint_3</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">n</span><span class="special">);</span>
46
47<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
48<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ellint_3</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
49
50<span class="special">}}</span> <span class="comment">// namespaces</span>
51</pre>
52<h5>
53<a name="math_toolkit.ellint.ellint_3.h1"></a>
54 <span class="phrase"><a name="math_toolkit.ellint.ellint_3.description"></a></span><a class="link" href="ellint_3.html#math_toolkit.ellint.ellint_3.description">Description</a>
55 </h5>
56<p>
57 These two functions evaluate the incomplete elliptic integral of the third
58 kind <span class="emphasis"><em>&#928;(n, &#966;, k)</em></span> and its complete counterpart <span class="emphasis"><em>&#928;(n,
59 k) = E(n, &#960;/2, k)</em></span>.
60 </p>
61<p>
62 <span class="inlinemediaobject"><img src="../../../graphs/ellint_3.svg" align="middle"></span>
63 </p>
64<p>
65 The return type of these functions is computed using the <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>result
66 type calculation rules</em></span></a> when the arguments are of different
67 types: when they are the same type then the result is the same type as the
68 arguments.
69 </p>
70<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">&gt;</span>
71<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ellint_3</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">phi</span><span class="special">);</span>
72
73<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
74<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ellint_3</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">phi</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
75</pre>
76<p>
77 Returns the incomplete elliptic integral of the third kind <span class="emphasis"><em>&#928;(n,
78 &#966;, k)</em></span>:
79 </p>
80<p>
81 <span class="inlinemediaobject"><img src="../../../equations/ellint4.svg"></span>
82 </p>
83<p>
84 Requires <span class="emphasis"><em>-1 &lt;= k &lt;= 1</em></span> and <span class="emphasis"><em>n &lt; 1/sin<sup>2</sup>(&#966;)</em></span>,
85 otherwise returns the result of <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
86 (outside this range the result would be complex).
87 </p>
88<p>
89 The final <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
90 be used to control the behaviour of the function: how it handles errors,
91 what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">policy
92 documentation for more details</a>.
93 </p>
94<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">&gt;</span>
95<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ellint_3</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">n</span><span class="special">);</span>
96
97<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
98<a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">ellint_3</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">k</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
99</pre>
100<p>
101 Returns the complete elliptic integral of the first kind <span class="emphasis"><em>&#928;(n, k)</em></span>:
102 </p>
103<p>
104 <span class="inlinemediaobject"><img src="../../../equations/ellint8.svg"></span>
105 </p>
106<p>
107 Requires <span class="emphasis"><em>-1 &lt;= k &lt;= 1</em></span> and <span class="emphasis"><em>n &lt; 1</em></span>,
108 otherwise returns the result of <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
109 (outside this range the result would be complex).
110 </p>
111<p>
112 The final <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
113 be used to control the behaviour of the function: how it handles errors,
114 what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">policy
115 documentation for more details</a>.
116 </p>
117<h5>
118<a name="math_toolkit.ellint.ellint_3.h2"></a>
119 <span class="phrase"><a name="math_toolkit.ellint.ellint_3.accuracy"></a></span><a class="link" href="ellint_3.html#math_toolkit.ellint.ellint_3.accuracy">Accuracy</a>
120 </h5>
121<p>
122 These functions are computed using only basic arithmetic operations, so there
123 isn't much variation in accuracy over differing platforms. Note that only
124 results for the widest floating point type on the system are given as narrower
125 types have <a class="link" href="../relative_error.html#math_toolkit.relative_error.zero_error">effectively
126 zero error</a>. All values are relative errors in units of epsilon.
127 </p>
128<div class="table">
129<a name="math_toolkit.ellint.ellint_3.table_ellint_3"></a><p class="title"><b>Table&#160;6.65.&#160;Error rates for ellint_3</b></p>
130<div class="table-contents"><table class="table" summary="Error rates for ellint_3">
131<colgroup>
132<col>
133<col>
134<col>
135<col>
136<col>
137</colgroup>
138<thead><tr>
139<th>
140 </th>
141<th>
142 <p>
143 Microsoft Visual C++ version 12.0<br> Win32<br> double
144 </p>
145 </th>
146<th>
147 <p>
148 GNU C++ version 5.1.0<br> linux<br> long double
149 </p>
150 </th>
151<th>
152 <p>
153 GNU C++ version 5.1.0<br> linux<br> double
154 </p>
155 </th>
156<th>
157 <p>
158 Sun compiler version 0x5130<br> Sun Solaris<br> long double
159 </p>
160 </th>
161</tr></thead>
162<tbody>
163<tr>
164<td>
165 <p>
166 Elliptic Integral PI: Mathworld Data
167 </p>
168 </td>
169<td>
170 <p>
171 <span class="blue">Max = 565&#949; (Mean = 102&#949;)</span>
172 </p>
173 </td>
174<td>
175 <p>
176 <span class="blue">Max = 475&#949; (Mean = 86.3&#949;)</span><br> <br>
177 (<span class="emphasis"><em>&lt;tr1/cmath&gt;:</em></span> <span class="red">Max
178 = +INF&#949; (Mean = +INF&#949;) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_long_double_ellint_3__tr1_cmath__Elliptic_Integral_PI_Mathworld_Data">And
179 other failures.</a>)</span>
180 </p>
181 </td>
182<td>
183 <p>
184 <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span><br> <br> (<span class="emphasis"><em>GSL
185 1.16:</em></span> Max = 1.48e+05&#949; (Mean = 2.54e+04&#949;) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_double_ellint_3_GSL_1_16_Elliptic_Integral_PI_Mathworld_Data">And
186 other failures.</a>)
187 </p>
188 </td>
189<td>
190 <p>
191 <span class="blue">Max = 475&#949; (Mean = 86.3&#949;)</span>
192 </p>
193 </td>
194</tr>
195<tr>
196<td>
197 <p>
198 Elliptic Integral PI: Random Data
199 </p>
200 </td>
201<td>
202 <p>
203 <span class="blue">Max = 9.08&#949; (Mean = 0.99&#949;)</span>
204 </p>
205 </td>
206<td>
207 <p>
208 <span class="blue">Max = 4.54&#949; (Mean = 0.895&#949;)</span><br> <br>
209 (<span class="emphasis"><em>&lt;tr1/cmath&gt;:</em></span> <span class="red">Max
210 = 3.37e+20&#949; (Mean = 3.47e+19&#949;) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_long_double_ellint_3__tr1_cmath__Elliptic_Integral_PI_Random_Data">And
211 other failures.</a>)</span>
212 </p>
213 </td>
214<td>
215 <p>
216 <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span><br> <br> (<span class="emphasis"><em>GSL
217 1.16:</em></span> Max = 633&#949; (Mean = 50.1&#949;))
218 </p>
219 </td>
220<td>
221 <p>
222 <span class="blue">Max = 4.49&#949; (Mean = 0.891&#949;)</span>
223 </p>
224 </td>
225</tr>
226<tr>
227<td>
228 <p>
229 Elliptic Integral PI: Large Random Data
230 </p>
231 </td>
232<td>
233 <p>
234 <span class="blue">Max = 2.86&#949; (Mean = 0.944&#949;)</span>
235 </p>
236 </td>
237<td>
238 <p>
239 <span class="blue">Max = 3.7&#949; (Mean = 0.893&#949;)</span><br> <br>
240 (<span class="emphasis"><em>&lt;tr1/cmath&gt;:</em></span> <span class="red">Max
241 = 2.52e+18&#949; (Mean = 4.83e+17&#949;) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_long_double_ellint_3__tr1_cmath__Elliptic_Integral_PI_Large_Random_Data">And
242 other failures.</a>)</span>
243 </p>
244 </td>
245<td>
246 <p>
247 <span class="blue">Max = 0.557&#949; (Mean = 0.0389&#949;)</span><br>
248 <br> (<span class="emphasis"><em>GSL 1.16:</em></span> Max = 40.1&#949; (Mean = 7.77&#949;))
249 </p>
250 </td>
251<td>
252 <p>
253 <span class="blue">Max = 3.7&#949; (Mean = 0.892&#949;)</span>
254 </p>
255 </td>
256</tr>
257</tbody>
258</table></div>
259</div>
260<br class="table-break"><h5>
261<a name="math_toolkit.ellint.ellint_3.h3"></a>
262 <span class="phrase"><a name="math_toolkit.ellint.ellint_3.testing"></a></span><a class="link" href="ellint_3.html#math_toolkit.ellint.ellint_3.testing">Testing</a>
263 </h5>
264<p>
265 The tests use a mixture of spot test values calculated using the online calculator
266 at <a href="http://functions.wolfram.com" target="_top">functions.wolfram.com</a>,
267 and random test data generated using NTL::RR at 1000-bit precision and this
268 implementation.
269 </p>
270<h5>
271<a name="math_toolkit.ellint.ellint_3.h4"></a>
272 <span class="phrase"><a name="math_toolkit.ellint.ellint_3.implementation"></a></span><a class="link" href="ellint_3.html#math_toolkit.ellint.ellint_3.implementation">Implementation</a>
273 </h5>
274<p>
275 The implementation for &#928;(n, &#966;, k) first siphons off the special cases:
276 </p>
277<p>
278 <span class="emphasis"><em>&#928;(0, &#966;, k) = F(&#966;, k)</em></span>
279 </p>
280<p>
281 <span class="emphasis"><em>&#928;(n, &#960;/2, k) = &#928;(n, k)</em></span>
282 </p>
283<p>
284 and
285 </p>
286<p>
287 <span class="inlinemediaobject"><img src="../../../equations/ellint23.svg"></span>
288 </p>
289<p>
290 Then if n &lt; 0 the relations (A&amp;S 17.7.15/16):
291 </p>
292<p>
293 <span class="inlinemediaobject"><img src="../../../equations/ellint24.svg"></span>
294 </p>
295<p>
296 are used to shift <span class="emphasis"><em>n</em></span> to the range [0, 1].
297 </p>
298<p>
299 Then the relations:
300 </p>
301<p>
302 <span class="emphasis"><em>&#928;(n, -&#966;, k) = -&#928;(n, &#966;, k)</em></span>
303 </p>
304<p>
305 <span class="emphasis"><em>&#928;(n, &#966;+m&#960;, k) = &#928;(n, &#966;, k) + 2m&#928;(n, k) ; n &lt;= 1</em></span>
306 </p>
307<p>
308 <span class="emphasis"><em>&#928;(n, &#966;+m&#960;, k) = &#928;(n, &#966;, k) ; n &gt; 1</em></span> <a href="#ftn.math_toolkit.ellint.ellint_3.f0" class="footnote"><sup class="footnote"><a name="math_toolkit.ellint.ellint_3.f0"></a>[1]</sup></a>
309 </p>
310<p>
311 are used to move &#966; &#160; to the range [0, &#960;/2].
312 </p>
313<p>
314 The functions are then implemented in terms of Carlson's integrals using
315 the relations:
316 </p>
317<p>
318 <span class="inlinemediaobject"><img src="../../../equations/ellint25.svg"></span>
319 </p>
320<p>
321 and
322 </p>
323<p>
324 <span class="inlinemediaobject"><img src="../../../equations/ellint26.svg"></span>
325 </p>
326<div class="footnotes">
327<br><hr style="width:100; align:left;">
328<div id="ftn.math_toolkit.ellint.ellint_3.f0" class="footnote"><p><a href="#math_toolkit.ellint.ellint_3.f0" class="para"><sup class="para">[1] </sup></a>
329 I haven't been able to find a literature reference for this relation, but
330 it appears to be the convention used by Mathematica. Intuitively the first
331 <span class="emphasis"><em>2 * m * &#928;(n, k)</em></span> terms cancel out as the derivative
332 alternates between +&#8734; and -&#8734;.
333 </p></div>
334</div>
335</div>
336<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
337<td align="left"></td>
338<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
339 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
340 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
341 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
342 Distributed under the Boost Software License, Version 1.0. (See accompanying
343 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>)
344 </p>
345</div></td>
346</tr></table>
347<hr>
348<div class="spirit-nav">
349<a accesskey="p" href="ellint_2.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ellint.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="ellint_d.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
350</div>
351</body>
352</html>