ellpe.c
Go to the documentation of this file.
1 /* ellpe.c
2  *
3  * Complete elliptic integral of the second kind
4  *
5  *
6  *
7  * SYNOPSIS:
8  *
9  * double m, y, ellpe();
10  *
11  * y = ellpe( m );
12  *
13  *
14  *
15  * DESCRIPTION:
16  *
17  * Approximates the integral
18  *
19  *
20  * pi/2
21  * -
22  * | | 2
23  * E(m) = | sqrt( 1 - m sin t ) dt
24  * | |
25  * -
26  * 0
27  *
28  * Where m = 1 - m1, using the approximation
29  *
30  * P(x) - x log x Q(x).
31  *
32  * Though there are no singularities, the argument m1 is used
33  * internally rather than m for compatibility with ellpk().
34  *
35  * E(1) = 1; E(0) = pi/2.
36  *
37  *
38  * ACCURACY:
39  *
40  * Relative error:
41  * arithmetic domain # trials peak rms
42  * IEEE 0, 1 10000 2.1e-16 7.3e-17
43  *
44  *
45  * ERROR MESSAGES:
46  *
47  * message condition value returned
48  * ellpe domain x<0, x>1 0.0
49  *
50  */
51 
52 /* ellpe.c */
53 
54 /* Elliptic integral of second kind */
55 
56 /*
57  * Cephes Math Library, Release 2.1: February, 1989
58  * Copyright 1984, 1987, 1989 by Stephen L. Moshier
59  * Direct inquiries to 30 Frost Street, Cambridge, MA 02140
60  *
61  * Feb, 2002: altered by Travis Oliphant
62  * so that it is called with argument m
63  * (which gets immediately converted to m1 = 1-m)
64  */
65 
66 #include "mconf.h"
67 
68 static double P[] = {
69  1.53552577301013293365E-4,
70  2.50888492163602060990E-3,
71  8.68786816565889628429E-3,
72  1.07350949056076193403E-2,
73  7.77395492516787092951E-3,
74  7.58395289413514708519E-3,
75  1.15688436810574127319E-2,
76  2.18317996015557253103E-2,
77  5.68051945617860553470E-2,
78  4.43147180560990850618E-1,
79  1.00000000000000000299E0
80 };
81 
82 static double Q[] = {
83  3.27954898576485872656E-5,
84  1.00962792679356715133E-3,
85  6.50609489976927491433E-3,
86  1.68862163993311317300E-2,
87  2.61769742454493659583E-2,
88  3.34833904888224918614E-2,
89  4.27180926518931511717E-2,
90  5.85936634471101055642E-2,
91  9.37499997197644278445E-2,
92  2.49999999999888314361E-1
93 };
94 
95 double ellpe(double x)
96 {
97  x = 1.0 - x;
98  if (x <= 0.0) {
99  if (x == 0.0)
100  return (1.0);
101  sf_error("ellpe", SF_ERROR_DOMAIN, NULL);
102  return (NAN);
103  }
104  if (x > 1.0) {
105  return ellpe(1.0 - 1/x) * sqrt(x);
106  }
107  return (polevl(x, P, 10) - log(x) * (x * polevl(x, Q, 9)));
108 }
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
log
const EIGEN_DEVICE_FUNC LogReturnType log() const
Definition: ArrayCwiseUnaryOps.h:128
polevl
static double polevl(double x, const double coef[], int N)
Definition: polevl.h:65
Eigen::Quaternion
The quaternion class used to represent 3D orientations and rotations.
Definition: ForwardDeclarations.h:293
mconf.h
ellpe
double ellpe(double x)
Definition: ellpe.c:95
sf_error
void sf_error(const char *func_name, sf_error_t code, const char *fmt,...)
Definition: sf_error.c:41
P
static double P[]
Definition: ellpe.c:68
NULL
#define NULL
Definition: ccolamd.c:609
SF_ERROR_DOMAIN
@ SF_ERROR_DOMAIN
Definition: sf_error.h:16
ceres::sqrt
Jet< T, N > sqrt(const Jet< T, N > &f)
Definition: jet.h:418


gtsam
Author(s):
autogenerated on Thu Jun 13 2024 03:02:18