1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
|
[/
Copyright (c) 2006 Xiaogang Zhang
Copyright (c) 2006 John Maddock
Use, modification and distribution are subject to the
Boost Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
]
[section:ellint_1 Elliptic Integrals of the First Kind - Legendre Form]
[heading Synopsis]
``
#include <boost/math/special_functions/ellint_1.hpp>
``
namespace boost { namespace math {
template <class T1, class T2>
``__sf_result`` ellint_1(T1 k, T2 phi);
template <class T1, class T2, class ``__Policy``>
``__sf_result`` ellint_1(T1 k, T2 phi, const ``__Policy``&);
template <class T>
``__sf_result`` ellint_1(T k);
template <class T, class ``__Policy``>
``__sf_result`` ellint_1(T k, const ``__Policy``&);
}} // namespaces
[heading Description]
These two functions evaluate the incomplete elliptic integral of the first kind
['F([phi], k)] and its complete counterpart ['K(k) = F([pi]/2, k)].
[graph ellint_1]
The return type of these functions is computed using the __arg_pomotion_rules
when T1 and T2 are different types: when they are the same type then the result
is the same type as the arguments.
template <class T1, class T2>
``__sf_result`` ellint_1(T1 k, T2 phi);
template <class T1, class T2, class ``__Policy``>
``__sf_result`` ellint_1(T1 k, T2 phi, const ``__Policy``&);
Returns the incomplete elliptic integral of the first kind ['F([phi], k)]:
[equation ellint2]
Requires -1 <= k <= 1, otherwise returns the result of __domain_error.
[optional_policy]
template <class T>
``__sf_result`` ellint_1(T k);
template <class T>
``__sf_result`` ellint_1(T k, const ``__Policy``&);
Returns the complete elliptic integral of the first kind ['K(k)]:
[equation ellint6]
Requires -1 <= k <= 1, otherwise returns the result of __domain_error.
[optional_policy]
[heading Accuracy]
These functions are computed using only basic arithmetic operations, so
there isn't much variation in accuracy over differing platforms.
Note that only results for the widest floating point type on the
system are given as narrower types have __zero_error. All values
are relative errors in units of epsilon.
[table Errors Rates in the Elliptic Integrals of the First Kind
[[Significand Size] [Platform and Compiler] [F([phi], k)] [K(k)] ]
[[53] [Win32 / Visual C++ 8.0] [Peak=3 Mean=0.8] [Peak=1.8 Mean=0.7] ]
[[64] [Red Hat Linux / G++ 3.4] [Peak=2.6 Mean=1.7] [Peak=2.2 Mean=1.8] ]
[[113] [HP-UX / HP aCC 6] [Peak=4.6 Mean=1.5] [Peak=3.7 Mean=1.5] ]
]
[heading Testing]
The tests use a mixture of spot test values calculated using the online
calculator at [@http://functions.wolfram.com/ functions.wolfram.com],
and random test data generated using
NTL::RR at 1000-bit precision and this implementation.
[heading Implementation]
These functions are implemented in terms of Carlson's integrals
using the relations:
[equation ellint19]
and
[equation ellint20]
[endsect]
[section:ellint_2 Elliptic Integrals of the Second Kind - Legendre Form]
[heading Synopsis]
``
#include <boost/math/special_functions/ellint_2.hpp>
``
namespace boost { namespace math {
template <class T1, class T2>
``__sf_result`` ellint_2(T1 k, T2 phi);
template <class T1, class T2, class ``__Policy``>
``__sf_result`` ellint_2(T1 k, T2 phi, const ``__Policy``&);
template <class T>
``__sf_result`` ellint_2(T k);
template <class T, class ``__Policy``>
``__sf_result`` ellint_2(T k, const ``__Policy``&);
}} // namespaces
[heading Description]
These two functions evaluate the incomplete elliptic integral of the second kind
['E([phi], k)] and its complete counterpart ['E(k) = E([pi]/2, k)].
[graph ellint_2]
The return type of these functions is computed using the __arg_pomotion_rules
when T1 and T2 are different types: when they are the same type then the result
is the same type as the arguments.
template <class T1, class T2>
``__sf_result`` ellint_2(T1 k, T2 phi);
template <class T1, class T2, class ``__Policy``>
``__sf_result`` ellint_2(T1 k, T2 phi, const ``__Policy``&);
Returns the incomplete elliptic integral of the second kind ['E([phi], k)]:
[equation ellint3]
Requires -1 <= k <= 1, otherwise returns the result of __domain_error.
[optional_policy]
template <class T>
``__sf_result`` ellint_2(T k);
template <class T>
``__sf_result`` ellint_2(T k, const ``__Policy``&);
Returns the complete elliptic integral of the second kind ['E(k)]:
[equation ellint7]
Requires -1 <= k <= 1, otherwise returns the result of __domain_error.
[optional_policy]
[heading Accuracy]
These functions are computed using only basic arithmetic operations, so
there isn't much variation in accuracy over differing platforms.
Note that only results for the widest floating point type on the
system are given as narrower types have __zero_error. All values
are relative errors in units of epsilon.
[table Errors Rates in the Elliptic Integrals of the Second Kind
[[Significand Size] [Platform and Compiler] [F([phi], k)] [K(k)] ]
[[53] [Win32 / Visual C++ 8.0] [Peak=4.6 Mean=1.2] [Peak=3.5 Mean=1.0] ]
[[64] [Red Hat Linux / G++ 3.4] [Peak=4.3 Mean=1.1] [Peak=4.6 Mean=1.2] ]
[[113] [HP-UX / HP aCC 6] [Peak=5.8 Mean=2.2] [Peak=10.8 Mean=2.3] ]
]
[heading Testing]
The tests use a mixture of spot test values calculated using the online
calculator at [@http://functions.wolfram.com
functions.wolfram.com], and random test data generated using
NTL::RR at 1000-bit precision and this implementation.
[heading Implementation]
These functions are implemented in terms of Carlson's integrals
using the relations:
[equation ellint21]
and
[equation ellint22]
[endsect]
[section:ellint_3 Elliptic Integrals of the Third Kind - Legendre Form]
[heading Synopsis]
``
#include <boost/math/special_functions/ellint_3.hpp>
``
namespace boost { namespace math {
template <class T1, class T2, class T3>
``__sf_result`` ellint_3(T1 k, T2 n, T3 phi);
template <class T1, class T2, class T3, class ``__Policy``>
``__sf_result`` ellint_3(T1 k, T2 n, T3 phi, const ``__Policy``&);
template <class T1, class T2>
``__sf_result`` ellint_3(T1 k, T2 n);
template <class T1, class T2, class ``__Policy``>
``__sf_result`` ellint_3(T1 k, T2 n, const ``__Policy``&);
}} // namespaces
[heading Description]
These two functions evaluate the incomplete elliptic integral of the third kind
['[Pi](n, [phi], k)] and its complete counterpart ['[Pi](n, k) = E(n, [pi]/2, k)].
[graph ellint_3]
The return type of these functions is computed using the __arg_pomotion_rules
when the arguments are of different types: when they are the same type then the result
is the same type as the arguments.
template <class T1, class T2, class T3>
``__sf_result`` ellint_3(T1 k, T2 n, T3 phi);
template <class T1, class T2, class T3, class ``__Policy``>
``__sf_result`` ellint_3(T1 k, T2 n, T3 phi, const ``__Policy``&);
Returns the incomplete elliptic integral of the third kind ['[Pi](n, [phi], k)]:
[equation ellint4]
Requires ['-1 <= k <= 1] and ['n < 1/sin[super 2]([phi])], otherwise
returns the result of __domain_error (outside this range the result
would be complex).
[optional_policy]
template <class T1, class T2>
``__sf_result`` ellint_3(T1 k, T2 n);
template <class T1, class T2, class ``__Policy``>
``__sf_result`` ellint_3(T1 k, T2 n, const ``__Policy``&);
Returns the complete elliptic integral of the first kind ['[Pi](n, k)]:
[equation ellint8]
Requires ['-1 <= k <= 1] and ['n < 1], otherwise returns the
result of __domain_error (outside this range the result would be complex).
[optional_policy]
[heading Accuracy]
These functions are computed using only basic arithmetic operations, so
there isn't much variation in accuracy over differing platforms.
Note that only results for the widest floating point type on the
system are given as narrower types have __zero_error. All values
are relative errors in units of epsilon.
[table Errors Rates in the Elliptic Integrals of the Third Kind
[[Significand Size] [Platform and Compiler] [[Pi](n, [phi], k)] [[Pi](n, k)] ]
[[53] [Win32 / Visual C++ 8.0] [Peak=29 Mean=2.2] [Peak=3 Mean=0.8] ]
[[64] [Red Hat Linux / G++ 3.4] [Peak=14 Mean=1.3] [Peak=2.3 Mean=0.8] ]
[[113] [HP-UX / HP aCC 6] [Peak=10 Mean=1.4] [Peak=4.2 Mean=1.1] ]
]
[heading Testing]
The tests use a mixture of spot test values calculated using the online
calculator at [@http://functions.wolfram.com
functions.wolfram.com], and random test data generated using
NTL::RR at 1000-bit precision and this implementation.
[heading Implementation]
The implementation for [Pi](n, [phi], k) first siphons off the special cases:
['[Pi](0, [phi], k) = F([phi], k)]
['[Pi](n, [pi]/2, k) = [Pi](n, k)]
and
[equation ellint23]
Then if n < 0 the relations (A&S 17.7.15/16):
[equation ellint24]
are used to shift /n/ to the range \[0, 1\].
Then the relations:
['[Pi](n, -[phi], k) = -[Pi](n, [phi], k)]
['[Pi](n, [phi]+m[pi], k) = [Pi](n, [phi], k) + 2m[Pi](n, k) ; n <= 1]
['[Pi](n, [phi]+m[pi], k) = [Pi](n, [phi], k) ; n > 1]
[footnote I haven't been able to find a literature reference for this
relation, but it appears to be the convention used by Mathematica.
Intuitively the first ['2 * m * [Pi](n, k)] terms cancel out as the
derivative alternates between +[infin] and -[infin].]
are used to move [phi][space] to the range \[0, [pi]\/2\].
The functions are then implemented in terms of Carlson's integrals
using the relations:
[equation ellint25]
and
[equation ellint26]
[endsect]
|