alglib 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Manifest.txt +253 -0
- data/README.txt +33 -0
- data/Rakefile +27 -0
- data/ext/Rakefile +24 -0
- data/ext/alglib.i +24 -0
- data/ext/alglib/Makefile +157 -0
- data/ext/alglib/airyf.cpp +372 -0
- data/ext/alglib/airyf.h +81 -0
- data/ext/alglib/alglib.cpp +8558 -0
- data/ext/alglib/alglib_util.cpp +19 -0
- data/ext/alglib/alglib_util.h +14 -0
- data/ext/alglib/ap.cpp +877 -0
- data/ext/alglib/ap.english.html +364 -0
- data/ext/alglib/ap.h +666 -0
- data/ext/alglib/ap.russian.html +442 -0
- data/ext/alglib/apvt.h +754 -0
- data/ext/alglib/bdss.cpp +1500 -0
- data/ext/alglib/bdss.h +251 -0
- data/ext/alglib/bdsvd.cpp +1339 -0
- data/ext/alglib/bdsvd.h +164 -0
- data/ext/alglib/bessel.cpp +1226 -0
- data/ext/alglib/bessel.h +331 -0
- data/ext/alglib/betaf.cpp +105 -0
- data/ext/alglib/betaf.h +74 -0
- data/ext/alglib/bidiagonal.cpp +1328 -0
- data/ext/alglib/bidiagonal.h +350 -0
- data/ext/alglib/binomialdistr.cpp +247 -0
- data/ext/alglib/binomialdistr.h +153 -0
- data/ext/alglib/blas.cpp +576 -0
- data/ext/alglib/blas.h +132 -0
- data/ext/alglib/cblas.cpp +226 -0
- data/ext/alglib/cblas.h +57 -0
- data/ext/alglib/cdet.cpp +138 -0
- data/ext/alglib/cdet.h +92 -0
- data/ext/alglib/chebyshev.cpp +216 -0
- data/ext/alglib/chebyshev.h +76 -0
- data/ext/alglib/chisquaredistr.cpp +157 -0
- data/ext/alglib/chisquaredistr.h +144 -0
- data/ext/alglib/cholesky.cpp +285 -0
- data/ext/alglib/cholesky.h +86 -0
- data/ext/alglib/cinverse.cpp +298 -0
- data/ext/alglib/cinverse.h +111 -0
- data/ext/alglib/clu.cpp +337 -0
- data/ext/alglib/clu.h +120 -0
- data/ext/alglib/correlation.cpp +280 -0
- data/ext/alglib/correlation.h +77 -0
- data/ext/alglib/correlationtests.cpp +726 -0
- data/ext/alglib/correlationtests.h +134 -0
- data/ext/alglib/crcond.cpp +826 -0
- data/ext/alglib/crcond.h +148 -0
- data/ext/alglib/creflections.cpp +310 -0
- data/ext/alglib/creflections.h +165 -0
- data/ext/alglib/csolve.cpp +312 -0
- data/ext/alglib/csolve.h +99 -0
- data/ext/alglib/ctrinverse.cpp +387 -0
- data/ext/alglib/ctrinverse.h +98 -0
- data/ext/alglib/ctrlinsolve.cpp +297 -0
- data/ext/alglib/ctrlinsolve.h +81 -0
- data/ext/alglib/dawson.cpp +234 -0
- data/ext/alglib/dawson.h +74 -0
- data/ext/alglib/descriptivestatistics.cpp +436 -0
- data/ext/alglib/descriptivestatistics.h +112 -0
- data/ext/alglib/det.cpp +140 -0
- data/ext/alglib/det.h +94 -0
- data/ext/alglib/dforest.cpp +1819 -0
- data/ext/alglib/dforest.h +316 -0
- data/ext/alglib/elliptic.cpp +497 -0
- data/ext/alglib/elliptic.h +217 -0
- data/ext/alglib/estnorm.cpp +429 -0
- data/ext/alglib/estnorm.h +107 -0
- data/ext/alglib/expintegrals.cpp +422 -0
- data/ext/alglib/expintegrals.h +108 -0
- data/ext/alglib/faq.english.html +258 -0
- data/ext/alglib/faq.russian.html +272 -0
- data/ext/alglib/fdistr.cpp +202 -0
- data/ext/alglib/fdistr.h +163 -0
- data/ext/alglib/fresnel.cpp +211 -0
- data/ext/alglib/fresnel.h +91 -0
- data/ext/alglib/gammaf.cpp +338 -0
- data/ext/alglib/gammaf.h +104 -0
- data/ext/alglib/gqgengauss.cpp +235 -0
- data/ext/alglib/gqgengauss.h +92 -0
- data/ext/alglib/gqgenhermite.cpp +268 -0
- data/ext/alglib/gqgenhermite.h +63 -0
- data/ext/alglib/gqgenjacobi.cpp +297 -0
- data/ext/alglib/gqgenjacobi.h +72 -0
- data/ext/alglib/gqgenlaguerre.cpp +265 -0
- data/ext/alglib/gqgenlaguerre.h +69 -0
- data/ext/alglib/gqgenlegendre.cpp +300 -0
- data/ext/alglib/gqgenlegendre.h +62 -0
- data/ext/alglib/gqgenlobatto.cpp +305 -0
- data/ext/alglib/gqgenlobatto.h +97 -0
- data/ext/alglib/gqgenradau.cpp +232 -0
- data/ext/alglib/gqgenradau.h +95 -0
- data/ext/alglib/hbisinv.cpp +480 -0
- data/ext/alglib/hbisinv.h +183 -0
- data/ext/alglib/hblas.cpp +228 -0
- data/ext/alglib/hblas.h +64 -0
- data/ext/alglib/hcholesky.cpp +339 -0
- data/ext/alglib/hcholesky.h +91 -0
- data/ext/alglib/hermite.cpp +114 -0
- data/ext/alglib/hermite.h +49 -0
- data/ext/alglib/hessenberg.cpp +370 -0
- data/ext/alglib/hessenberg.h +152 -0
- data/ext/alglib/hevd.cpp +247 -0
- data/ext/alglib/hevd.h +107 -0
- data/ext/alglib/hsschur.cpp +1316 -0
- data/ext/alglib/hsschur.h +108 -0
- data/ext/alglib/htridiagonal.cpp +734 -0
- data/ext/alglib/htridiagonal.h +180 -0
- data/ext/alglib/ialglib.cpp +6 -0
- data/ext/alglib/ialglib.h +9 -0
- data/ext/alglib/ibetaf.cpp +960 -0
- data/ext/alglib/ibetaf.h +125 -0
- data/ext/alglib/igammaf.cpp +430 -0
- data/ext/alglib/igammaf.h +157 -0
- data/ext/alglib/inv.cpp +274 -0
- data/ext/alglib/inv.h +115 -0
- data/ext/alglib/inverseupdate.cpp +480 -0
- data/ext/alglib/inverseupdate.h +185 -0
- data/ext/alglib/jacobianelliptic.cpp +164 -0
- data/ext/alglib/jacobianelliptic.h +94 -0
- data/ext/alglib/jarquebera.cpp +2271 -0
- data/ext/alglib/jarquebera.h +80 -0
- data/ext/alglib/kmeans.cpp +356 -0
- data/ext/alglib/kmeans.h +76 -0
- data/ext/alglib/laguerre.cpp +94 -0
- data/ext/alglib/laguerre.h +48 -0
- data/ext/alglib/lbfgs.cpp +1167 -0
- data/ext/alglib/lbfgs.h +218 -0
- data/ext/alglib/lda.cpp +434 -0
- data/ext/alglib/lda.h +133 -0
- data/ext/alglib/ldlt.cpp +1130 -0
- data/ext/alglib/ldlt.h +124 -0
- data/ext/alglib/leastsquares.cpp +1252 -0
- data/ext/alglib/leastsquares.h +290 -0
- data/ext/alglib/legendre.cpp +107 -0
- data/ext/alglib/legendre.h +49 -0
- data/ext/alglib/linreg.cpp +1185 -0
- data/ext/alglib/linreg.h +380 -0
- data/ext/alglib/logit.cpp +1523 -0
- data/ext/alglib/logit.h +333 -0
- data/ext/alglib/lq.cpp +399 -0
- data/ext/alglib/lq.h +160 -0
- data/ext/alglib/lu.cpp +462 -0
- data/ext/alglib/lu.h +119 -0
- data/ext/alglib/mannwhitneyu.cpp +4490 -0
- data/ext/alglib/mannwhitneyu.h +115 -0
- data/ext/alglib/minlm.cpp +918 -0
- data/ext/alglib/minlm.h +312 -0
- data/ext/alglib/mlpbase.cpp +3375 -0
- data/ext/alglib/mlpbase.h +589 -0
- data/ext/alglib/mlpe.cpp +1369 -0
- data/ext/alglib/mlpe.h +552 -0
- data/ext/alglib/mlptrain.cpp +1056 -0
- data/ext/alglib/mlptrain.h +283 -0
- data/ext/alglib/nearunityunit.cpp +91 -0
- data/ext/alglib/nearunityunit.h +17 -0
- data/ext/alglib/normaldistr.cpp +377 -0
- data/ext/alglib/normaldistr.h +175 -0
- data/ext/alglib/nsevd.cpp +1869 -0
- data/ext/alglib/nsevd.h +140 -0
- data/ext/alglib/pca.cpp +168 -0
- data/ext/alglib/pca.h +87 -0
- data/ext/alglib/poissondistr.cpp +143 -0
- data/ext/alglib/poissondistr.h +130 -0
- data/ext/alglib/polinterpolation.cpp +685 -0
- data/ext/alglib/polinterpolation.h +206 -0
- data/ext/alglib/psif.cpp +173 -0
- data/ext/alglib/psif.h +88 -0
- data/ext/alglib/qr.cpp +414 -0
- data/ext/alglib/qr.h +168 -0
- data/ext/alglib/ratinterpolation.cpp +134 -0
- data/ext/alglib/ratinterpolation.h +72 -0
- data/ext/alglib/rcond.cpp +705 -0
- data/ext/alglib/rcond.h +140 -0
- data/ext/alglib/reflections.cpp +504 -0
- data/ext/alglib/reflections.h +165 -0
- data/ext/alglib/rotations.cpp +473 -0
- data/ext/alglib/rotations.h +128 -0
- data/ext/alglib/rsolve.cpp +221 -0
- data/ext/alglib/rsolve.h +99 -0
- data/ext/alglib/sbisinv.cpp +217 -0
- data/ext/alglib/sbisinv.h +171 -0
- data/ext/alglib/sblas.cpp +185 -0
- data/ext/alglib/sblas.h +64 -0
- data/ext/alglib/schur.cpp +156 -0
- data/ext/alglib/schur.h +102 -0
- data/ext/alglib/sdet.cpp +193 -0
- data/ext/alglib/sdet.h +101 -0
- data/ext/alglib/sevd.cpp +116 -0
- data/ext/alglib/sevd.h +99 -0
- data/ext/alglib/sinverse.cpp +672 -0
- data/ext/alglib/sinverse.h +138 -0
- data/ext/alglib/spddet.cpp +138 -0
- data/ext/alglib/spddet.h +96 -0
- data/ext/alglib/spdgevd.cpp +842 -0
- data/ext/alglib/spdgevd.h +200 -0
- data/ext/alglib/spdinverse.cpp +509 -0
- data/ext/alglib/spdinverse.h +122 -0
- data/ext/alglib/spdrcond.cpp +421 -0
- data/ext/alglib/spdrcond.h +118 -0
- data/ext/alglib/spdsolve.cpp +275 -0
- data/ext/alglib/spdsolve.h +105 -0
- data/ext/alglib/spline2d.cpp +1192 -0
- data/ext/alglib/spline2d.h +301 -0
- data/ext/alglib/spline3.cpp +1264 -0
- data/ext/alglib/spline3.h +290 -0
- data/ext/alglib/srcond.cpp +595 -0
- data/ext/alglib/srcond.h +127 -0
- data/ext/alglib/ssolve.cpp +895 -0
- data/ext/alglib/ssolve.h +139 -0
- data/ext/alglib/stdafx.h +0 -0
- data/ext/alglib/stest.cpp +131 -0
- data/ext/alglib/stest.h +94 -0
- data/ext/alglib/studenttdistr.cpp +222 -0
- data/ext/alglib/studenttdistr.h +115 -0
- data/ext/alglib/studentttests.cpp +377 -0
- data/ext/alglib/studentttests.h +178 -0
- data/ext/alglib/svd.cpp +620 -0
- data/ext/alglib/svd.h +126 -0
- data/ext/alglib/tdbisinv.cpp +2608 -0
- data/ext/alglib/tdbisinv.h +228 -0
- data/ext/alglib/tdevd.cpp +1229 -0
- data/ext/alglib/tdevd.h +115 -0
- data/ext/alglib/tridiagonal.cpp +594 -0
- data/ext/alglib/tridiagonal.h +171 -0
- data/ext/alglib/trigintegrals.cpp +490 -0
- data/ext/alglib/trigintegrals.h +131 -0
- data/ext/alglib/trinverse.cpp +345 -0
- data/ext/alglib/trinverse.h +98 -0
- data/ext/alglib/trlinsolve.cpp +926 -0
- data/ext/alglib/trlinsolve.h +73 -0
- data/ext/alglib/tsort.cpp +405 -0
- data/ext/alglib/tsort.h +54 -0
- data/ext/alglib/variancetests.cpp +245 -0
- data/ext/alglib/variancetests.h +134 -0
- data/ext/alglib/wsr.cpp +6285 -0
- data/ext/alglib/wsr.h +96 -0
- data/ext/ap.i +97 -0
- data/ext/correlation.i +24 -0
- data/ext/extconf.rb +6 -0
- data/ext/logit.i +89 -0
- data/lib/alglib.rb +71 -0
- data/lib/alglib/correlation.rb +26 -0
- data/lib/alglib/linearregression.rb +63 -0
- data/lib/alglib/logit.rb +42 -0
- data/test/test_alglib.rb +52 -0
- data/test/test_correlation.rb +44 -0
- data/test/test_correlationtest.rb +45 -0
- data/test/test_linreg.rb +35 -0
- data/test/test_logit.rb +43 -0
- data/test/test_pca.rb +27 -0
- metadata +326 -0
@@ -0,0 +1,171 @@
|
|
1
|
+
/*************************************************************************
|
2
|
+
Copyright (c) 1992-2007 The University of Tennessee. All rights reserved.
|
3
|
+
|
4
|
+
Contributors:
|
5
|
+
* Sergey Bochkanov (ALGLIB project). Translation from FORTRAN to
|
6
|
+
pseudocode.
|
7
|
+
|
8
|
+
See subroutines comments for additional copyrights.
|
9
|
+
|
10
|
+
Redistribution and use in source and binary forms, with or without
|
11
|
+
modification, are permitted provided that the following conditions are
|
12
|
+
met:
|
13
|
+
|
14
|
+
- Redistributions of source code must retain the above copyright
|
15
|
+
notice, this list of conditions and the following disclaimer.
|
16
|
+
|
17
|
+
- Redistributions in binary form must reproduce the above copyright
|
18
|
+
notice, this list of conditions and the following disclaimer listed
|
19
|
+
in this license in the documentation and/or other materials
|
20
|
+
provided with the distribution.
|
21
|
+
|
22
|
+
- Neither the name of the copyright holders nor the names of its
|
23
|
+
contributors may be used to endorse or promote products derived from
|
24
|
+
this software without specific prior written permission.
|
25
|
+
|
26
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
27
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
28
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
29
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
30
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
31
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
32
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
33
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
34
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
35
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
36
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
37
|
+
*************************************************************************/
|
38
|
+
|
39
|
+
#ifndef _tridiagonal_h
|
40
|
+
#define _tridiagonal_h
|
41
|
+
|
42
|
+
#include "ap.h"
|
43
|
+
#include "ialglib.h"
|
44
|
+
|
45
|
+
#include "sblas.h"
|
46
|
+
#include "reflections.h"
|
47
|
+
|
48
|
+
|
49
|
+
/*************************************************************************
|
50
|
+
Reduction of a symmetric matrix which is given by its higher or lower
|
51
|
+
triangular part to a tridiagonal matrix using orthogonal similarity
|
52
|
+
transformation: Q'*A*Q=T.
|
53
|
+
|
54
|
+
Input parameters:
|
55
|
+
A - matrix to be transformed
|
56
|
+
array with elements [0..N-1, 0..N-1].
|
57
|
+
N - size of matrix A.
|
58
|
+
IsUpper - storage format. If IsUpper = True, then matrix A is given
|
59
|
+
by its upper triangle, and the lower triangle is not used
|
60
|
+
and not modified by the algorithm, and vice versa
|
61
|
+
if IsUpper = False.
|
62
|
+
|
63
|
+
Output parameters:
|
64
|
+
A - matrices T and Q in compact form (see lower)
|
65
|
+
Tau - array of factors which are forming matrices H(i)
|
66
|
+
array with elements [0..N-2].
|
67
|
+
D - main diagonal of symmetric matrix T.
|
68
|
+
array with elements [0..N-1].
|
69
|
+
E - secondary diagonal of symmetric matrix T.
|
70
|
+
array with elements [0..N-2].
|
71
|
+
|
72
|
+
|
73
|
+
If IsUpper=True, the matrix Q is represented as a product of elementary
|
74
|
+
reflectors
|
75
|
+
|
76
|
+
Q = H(n-2) . . . H(2) H(0).
|
77
|
+
|
78
|
+
Each H(i) has the form
|
79
|
+
|
80
|
+
H(i) = I - tau * v * v'
|
81
|
+
|
82
|
+
where tau is a real scalar, and v is a real vector with
|
83
|
+
v(i+1:n-1) = 0, v(i) = 1, v(0:i-1) is stored on exit in
|
84
|
+
A(0:i-1,i+1), and tau in TAU(i).
|
85
|
+
|
86
|
+
If IsUpper=False, the matrix Q is represented as a product of elementary
|
87
|
+
reflectors
|
88
|
+
|
89
|
+
Q = H(0) H(2) . . . H(n-2).
|
90
|
+
|
91
|
+
Each H(i) has the form
|
92
|
+
|
93
|
+
H(i) = I - tau * v * v'
|
94
|
+
|
95
|
+
where tau is a real scalar, and v is a real vector with
|
96
|
+
v(0:i) = 0, v(i+1) = 1, v(i+2:n-1) is stored on exit in A(i+2:n-1,i),
|
97
|
+
and tau in TAU(i).
|
98
|
+
|
99
|
+
The contents of A on exit are illustrated by the following examples
|
100
|
+
with n = 5:
|
101
|
+
|
102
|
+
if UPLO = 'U': if UPLO = 'L':
|
103
|
+
|
104
|
+
( d e v1 v2 v3 ) ( d )
|
105
|
+
( d e v2 v3 ) ( e d )
|
106
|
+
( d e v3 ) ( v0 e d )
|
107
|
+
( d e ) ( v0 v1 e d )
|
108
|
+
( d ) ( v0 v1 v2 e d )
|
109
|
+
|
110
|
+
where d and e denote diagonal and off-diagonal elements of T, and vi
|
111
|
+
denotes an element of the vector defining H(i).
|
112
|
+
|
113
|
+
-- LAPACK routine (version 3.0) --
|
114
|
+
Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
|
115
|
+
Courant Institute, Argonne National Lab, and Rice University
|
116
|
+
October 31, 1992
|
117
|
+
*************************************************************************/
|
118
|
+
void smatrixtd(ap::real_2d_array& a,
|
119
|
+
int n,
|
120
|
+
bool isupper,
|
121
|
+
ap::real_1d_array& tau,
|
122
|
+
ap::real_1d_array& d,
|
123
|
+
ap::real_1d_array& e);
|
124
|
+
|
125
|
+
|
126
|
+
/*************************************************************************
|
127
|
+
Unpacking matrix Q which reduces symmetric matrix to a tridiagonal
|
128
|
+
form.
|
129
|
+
|
130
|
+
Input parameters:
|
131
|
+
A - the result of a SMatrixTD subroutine
|
132
|
+
N - size of matrix A.
|
133
|
+
IsUpper - storage format (a parameter of SMatrixTD subroutine)
|
134
|
+
Tau - the result of a SMatrixTD subroutine
|
135
|
+
|
136
|
+
Output parameters:
|
137
|
+
Q - transformation matrix.
|
138
|
+
array with elements [0..N-1, 0..N-1].
|
139
|
+
|
140
|
+
-- ALGLIB --
|
141
|
+
Copyright 2005-2008 by Bochkanov Sergey
|
142
|
+
*************************************************************************/
|
143
|
+
void smatrixtdunpackq(const ap::real_2d_array& a,
|
144
|
+
const int& n,
|
145
|
+
const bool& isupper,
|
146
|
+
const ap::real_1d_array& tau,
|
147
|
+
ap::real_2d_array& q);
|
148
|
+
|
149
|
+
|
150
|
+
/*************************************************************************
|
151
|
+
Obsolete 1-based subroutine
|
152
|
+
*************************************************************************/
|
153
|
+
void totridiagonal(ap::real_2d_array& a,
|
154
|
+
int n,
|
155
|
+
bool isupper,
|
156
|
+
ap::real_1d_array& tau,
|
157
|
+
ap::real_1d_array& d,
|
158
|
+
ap::real_1d_array& e);
|
159
|
+
|
160
|
+
|
161
|
+
/*************************************************************************
|
162
|
+
Obsolete 1-based subroutine
|
163
|
+
*************************************************************************/
|
164
|
+
void unpackqfromtridiagonal(const ap::real_2d_array& a,
|
165
|
+
const int& n,
|
166
|
+
const bool& isupper,
|
167
|
+
const ap::real_1d_array& tau,
|
168
|
+
ap::real_2d_array& q);
|
169
|
+
|
170
|
+
|
171
|
+
#endif
|
@@ -0,0 +1,490 @@
|
|
1
|
+
/*************************************************************************
|
2
|
+
Cephes Math Library Release 2.8: June, 2000
|
3
|
+
Copyright by Stephen L. Moshier
|
4
|
+
|
5
|
+
Contributors:
|
6
|
+
* Sergey Bochkanov (ALGLIB project). Translation from C to
|
7
|
+
pseudocode.
|
8
|
+
|
9
|
+
See subroutines comments for additional copyrights.
|
10
|
+
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
12
|
+
modification, are permitted provided that the following conditions are
|
13
|
+
met:
|
14
|
+
|
15
|
+
- Redistributions of source code must retain the above copyright
|
16
|
+
notice, this list of conditions and the following disclaimer.
|
17
|
+
|
18
|
+
- Redistributions in binary form must reproduce the above copyright
|
19
|
+
notice, this list of conditions and the following disclaimer listed
|
20
|
+
in this license in the documentation and/or other materials
|
21
|
+
provided with the distribution.
|
22
|
+
|
23
|
+
- Neither the name of the copyright holders nor the names of its
|
24
|
+
contributors may be used to endorse or promote products derived from
|
25
|
+
this software without specific prior written permission.
|
26
|
+
|
27
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
28
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
29
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
30
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
31
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
32
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
33
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
34
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
35
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
36
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
37
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
38
|
+
*************************************************************************/
|
39
|
+
|
40
|
+
#include <stdafx.h>
|
41
|
+
#include "trigintegrals.h"
|
42
|
+
|
43
|
+
static void chebiterationshichi(double x,
|
44
|
+
double c,
|
45
|
+
double& b0,
|
46
|
+
double& b1,
|
47
|
+
double& b2);
|
48
|
+
|
49
|
+
/*************************************************************************
|
50
|
+
Sine and cosine integrals
|
51
|
+
|
52
|
+
Evaluates the integrals
|
53
|
+
|
54
|
+
x
|
55
|
+
-
|
56
|
+
| cos t - 1
|
57
|
+
Ci(x) = eul + ln x + | --------- dt,
|
58
|
+
| t
|
59
|
+
-
|
60
|
+
0
|
61
|
+
x
|
62
|
+
-
|
63
|
+
| sin t
|
64
|
+
Si(x) = | ----- dt
|
65
|
+
| t
|
66
|
+
-
|
67
|
+
0
|
68
|
+
|
69
|
+
where eul = 0.57721566490153286061 is Euler's constant.
|
70
|
+
The integrals are approximated by rational functions.
|
71
|
+
For x > 8 auxiliary functions f(x) and g(x) are employed
|
72
|
+
such that
|
73
|
+
|
74
|
+
Ci(x) = f(x) sin(x) - g(x) cos(x)
|
75
|
+
Si(x) = pi/2 - f(x) cos(x) - g(x) sin(x)
|
76
|
+
|
77
|
+
|
78
|
+
ACCURACY:
|
79
|
+
Test interval = [0,50].
|
80
|
+
Absolute error, except relative when > 1:
|
81
|
+
arithmetic function # trials peak rms
|
82
|
+
IEEE Si 30000 4.4e-16 7.3e-17
|
83
|
+
IEEE Ci 30000 6.9e-16 5.1e-17
|
84
|
+
|
85
|
+
Cephes Math Library Release 2.1: January, 1989
|
86
|
+
Copyright 1984, 1987, 1989 by Stephen L. Moshier
|
87
|
+
*************************************************************************/
|
88
|
+
void sinecosineintegrals(double x, double& si, double& ci)
|
89
|
+
{
|
90
|
+
double z;
|
91
|
+
double c;
|
92
|
+
double s;
|
93
|
+
double f;
|
94
|
+
double g;
|
95
|
+
int sg;
|
96
|
+
double sn;
|
97
|
+
double sd;
|
98
|
+
double cn;
|
99
|
+
double cd;
|
100
|
+
double fn;
|
101
|
+
double fd;
|
102
|
+
double gn;
|
103
|
+
double gd;
|
104
|
+
|
105
|
+
if( x<0 )
|
106
|
+
{
|
107
|
+
sg = -1;
|
108
|
+
x = -x;
|
109
|
+
}
|
110
|
+
else
|
111
|
+
{
|
112
|
+
sg = 0;
|
113
|
+
}
|
114
|
+
if( x==0 )
|
115
|
+
{
|
116
|
+
si = 0;
|
117
|
+
ci = -ap::maxrealnumber;
|
118
|
+
return;
|
119
|
+
}
|
120
|
+
if( x>1.0E9 )
|
121
|
+
{
|
122
|
+
si = 1.570796326794896619-cos(x)/x;
|
123
|
+
ci = sin(x)/x;
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
if( x<=4 )
|
127
|
+
{
|
128
|
+
z = x*x;
|
129
|
+
sn = -8.39167827910303881427E-11;
|
130
|
+
sn = sn*z+4.62591714427012837309E-8;
|
131
|
+
sn = sn*z-9.75759303843632795789E-6;
|
132
|
+
sn = sn*z+9.76945438170435310816E-4;
|
133
|
+
sn = sn*z-4.13470316229406538752E-2;
|
134
|
+
sn = sn*z+1.00000000000000000302E0;
|
135
|
+
sd = 2.03269266195951942049E-12;
|
136
|
+
sd = sd*z+1.27997891179943299903E-9;
|
137
|
+
sd = sd*z+4.41827842801218905784E-7;
|
138
|
+
sd = sd*z+9.96412122043875552487E-5;
|
139
|
+
sd = sd*z+1.42085239326149893930E-2;
|
140
|
+
sd = sd*z+9.99999999999999996984E-1;
|
141
|
+
s = x*sn/sd;
|
142
|
+
cn = 2.02524002389102268789E-11;
|
143
|
+
cn = cn*z-1.35249504915790756375E-8;
|
144
|
+
cn = cn*z+3.59325051419993077021E-6;
|
145
|
+
cn = cn*z-4.74007206873407909465E-4;
|
146
|
+
cn = cn*z+2.89159652607555242092E-2;
|
147
|
+
cn = cn*z-1.00000000000000000080E0;
|
148
|
+
cd = 4.07746040061880559506E-12;
|
149
|
+
cd = cd*z+3.06780997581887812692E-9;
|
150
|
+
cd = cd*z+1.23210355685883423679E-6;
|
151
|
+
cd = cd*z+3.17442024775032769882E-4;
|
152
|
+
cd = cd*z+5.10028056236446052392E-2;
|
153
|
+
cd = cd*z+4.00000000000000000080E0;
|
154
|
+
c = z*cn/cd;
|
155
|
+
if( sg!=0 )
|
156
|
+
{
|
157
|
+
s = -s;
|
158
|
+
}
|
159
|
+
si = s;
|
160
|
+
ci = 0.57721566490153286061+log(x)+c;
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
s = sin(x);
|
164
|
+
c = cos(x);
|
165
|
+
z = 1.0/(x*x);
|
166
|
+
if( x<8 )
|
167
|
+
{
|
168
|
+
fn = 4.23612862892216586994E0;
|
169
|
+
fn = fn*z+5.45937717161812843388E0;
|
170
|
+
fn = fn*z+1.62083287701538329132E0;
|
171
|
+
fn = fn*z+1.67006611831323023771E-1;
|
172
|
+
fn = fn*z+6.81020132472518137426E-3;
|
173
|
+
fn = fn*z+1.08936580650328664411E-4;
|
174
|
+
fn = fn*z+5.48900223421373614008E-7;
|
175
|
+
fd = 1.00000000000000000000E0;
|
176
|
+
fd = fd*z+8.16496634205391016773E0;
|
177
|
+
fd = fd*z+7.30828822505564552187E0;
|
178
|
+
fd = fd*z+1.86792257950184183883E0;
|
179
|
+
fd = fd*z+1.78792052963149907262E-1;
|
180
|
+
fd = fd*z+7.01710668322789753610E-3;
|
181
|
+
fd = fd*z+1.10034357153915731354E-4;
|
182
|
+
fd = fd*z+5.48900252756255700982E-7;
|
183
|
+
f = fn/(x*fd);
|
184
|
+
gn = 8.71001698973114191777E-2;
|
185
|
+
gn = gn*z+6.11379109952219284151E-1;
|
186
|
+
gn = gn*z+3.97180296392337498885E-1;
|
187
|
+
gn = gn*z+7.48527737628469092119E-2;
|
188
|
+
gn = gn*z+5.38868681462177273157E-3;
|
189
|
+
gn = gn*z+1.61999794598934024525E-4;
|
190
|
+
gn = gn*z+1.97963874140963632189E-6;
|
191
|
+
gn = gn*z+7.82579040744090311069E-9;
|
192
|
+
gd = 1.00000000000000000000E0;
|
193
|
+
gd = gd*z+1.64402202413355338886E0;
|
194
|
+
gd = gd*z+6.66296701268987968381E-1;
|
195
|
+
gd = gd*z+9.88771761277688796203E-2;
|
196
|
+
gd = gd*z+6.22396345441768420760E-3;
|
197
|
+
gd = gd*z+1.73221081474177119497E-4;
|
198
|
+
gd = gd*z+2.02659182086343991969E-6;
|
199
|
+
gd = gd*z+7.82579218933534490868E-9;
|
200
|
+
g = z*gn/gd;
|
201
|
+
}
|
202
|
+
else
|
203
|
+
{
|
204
|
+
fn = 4.55880873470465315206E-1;
|
205
|
+
fn = fn*z+7.13715274100146711374E-1;
|
206
|
+
fn = fn*z+1.60300158222319456320E-1;
|
207
|
+
fn = fn*z+1.16064229408124407915E-2;
|
208
|
+
fn = fn*z+3.49556442447859055605E-4;
|
209
|
+
fn = fn*z+4.86215430826454749482E-6;
|
210
|
+
fn = fn*z+3.20092790091004902806E-8;
|
211
|
+
fn = fn*z+9.41779576128512936592E-11;
|
212
|
+
fn = fn*z+9.70507110881952024631E-14;
|
213
|
+
fd = 1.00000000000000000000E0;
|
214
|
+
fd = fd*z+9.17463611873684053703E-1;
|
215
|
+
fd = fd*z+1.78685545332074536321E-1;
|
216
|
+
fd = fd*z+1.22253594771971293032E-2;
|
217
|
+
fd = fd*z+3.58696481881851580297E-4;
|
218
|
+
fd = fd*z+4.92435064317881464393E-6;
|
219
|
+
fd = fd*z+3.21956939101046018377E-8;
|
220
|
+
fd = fd*z+9.43720590350276732376E-11;
|
221
|
+
fd = fd*z+9.70507110881952025725E-14;
|
222
|
+
f = fn/(x*fd);
|
223
|
+
gn = 6.97359953443276214934E-1;
|
224
|
+
gn = gn*z+3.30410979305632063225E-1;
|
225
|
+
gn = gn*z+3.84878767649974295920E-2;
|
226
|
+
gn = gn*z+1.71718239052347903558E-3;
|
227
|
+
gn = gn*z+3.48941165502279436777E-5;
|
228
|
+
gn = gn*z+3.47131167084116673800E-7;
|
229
|
+
gn = gn*z+1.70404452782044526189E-9;
|
230
|
+
gn = gn*z+3.85945925430276600453E-12;
|
231
|
+
gn = gn*z+3.14040098946363334640E-15;
|
232
|
+
gd = 1.00000000000000000000E0;
|
233
|
+
gd = gd*z+1.68548898811011640017E0;
|
234
|
+
gd = gd*z+4.87852258695304967486E-1;
|
235
|
+
gd = gd*z+4.67913194259625806320E-2;
|
236
|
+
gd = gd*z+1.90284426674399523638E-3;
|
237
|
+
gd = gd*z+3.68475504442561108162E-5;
|
238
|
+
gd = gd*z+3.57043223443740838771E-7;
|
239
|
+
gd = gd*z+1.72693748966316146736E-9;
|
240
|
+
gd = gd*z+3.87830166023954706752E-12;
|
241
|
+
gd = gd*z+3.14040098946363335242E-15;
|
242
|
+
g = z*gn/gd;
|
243
|
+
}
|
244
|
+
si = 1.570796326794896619-f*c-g*s;
|
245
|
+
if( sg!=0 )
|
246
|
+
{
|
247
|
+
si = -si;
|
248
|
+
}
|
249
|
+
ci = f*s-g*c;
|
250
|
+
}
|
251
|
+
|
252
|
+
|
253
|
+
/*************************************************************************
|
254
|
+
Hyperbolic sine and cosine integrals
|
255
|
+
|
256
|
+
Approximates the integrals
|
257
|
+
|
258
|
+
x
|
259
|
+
-
|
260
|
+
| | cosh t - 1
|
261
|
+
Chi(x) = eul + ln x + | ----------- dt,
|
262
|
+
| | t
|
263
|
+
-
|
264
|
+
0
|
265
|
+
|
266
|
+
x
|
267
|
+
-
|
268
|
+
| | sinh t
|
269
|
+
Shi(x) = | ------ dt
|
270
|
+
| | t
|
271
|
+
-
|
272
|
+
0
|
273
|
+
|
274
|
+
where eul = 0.57721566490153286061 is Euler's constant.
|
275
|
+
The integrals are evaluated by power series for x < 8
|
276
|
+
and by Chebyshev expansions for x between 8 and 88.
|
277
|
+
For large x, both functions approach exp(x)/2x.
|
278
|
+
Arguments greater than 88 in magnitude return MAXNUM.
|
279
|
+
|
280
|
+
|
281
|
+
ACCURACY:
|
282
|
+
|
283
|
+
Test interval 0 to 88.
|
284
|
+
Relative error:
|
285
|
+
arithmetic function # trials peak rms
|
286
|
+
IEEE Shi 30000 6.9e-16 1.6e-16
|
287
|
+
Absolute error, except relative when |Chi| > 1:
|
288
|
+
IEEE Chi 30000 8.4e-16 1.4e-16
|
289
|
+
|
290
|
+
Cephes Math Library Release 2.8: June, 2000
|
291
|
+
Copyright 1984, 1987, 2000 by Stephen L. Moshier
|
292
|
+
*************************************************************************/
|
293
|
+
void hyperbolicsinecosineintegrals(double x, double& shi, double& chi)
|
294
|
+
{
|
295
|
+
double k;
|
296
|
+
double z;
|
297
|
+
double c;
|
298
|
+
double s;
|
299
|
+
double a;
|
300
|
+
int sg;
|
301
|
+
double b0;
|
302
|
+
double b1;
|
303
|
+
double b2;
|
304
|
+
|
305
|
+
if( x<0 )
|
306
|
+
{
|
307
|
+
sg = -1;
|
308
|
+
x = -x;
|
309
|
+
}
|
310
|
+
else
|
311
|
+
{
|
312
|
+
sg = 0;
|
313
|
+
}
|
314
|
+
if( x==0 )
|
315
|
+
{
|
316
|
+
shi = 0;
|
317
|
+
chi = -ap::maxrealnumber;
|
318
|
+
return;
|
319
|
+
}
|
320
|
+
if( x<8.0 )
|
321
|
+
{
|
322
|
+
z = x*x;
|
323
|
+
a = 1.0;
|
324
|
+
s = 1.0;
|
325
|
+
c = 0.0;
|
326
|
+
k = 2.0;
|
327
|
+
do
|
328
|
+
{
|
329
|
+
a = a*z/k;
|
330
|
+
c = c+a/k;
|
331
|
+
k = k+1.0;
|
332
|
+
a = a/k;
|
333
|
+
s = s+a/k;
|
334
|
+
k = k+1.0;
|
335
|
+
}
|
336
|
+
while(fabs(a/s)>=ap::machineepsilon);
|
337
|
+
s = s*x;
|
338
|
+
}
|
339
|
+
else
|
340
|
+
{
|
341
|
+
if( x<18.0 )
|
342
|
+
{
|
343
|
+
a = (576.0/x-52.0)/10.0;
|
344
|
+
k = exp(x)/x;
|
345
|
+
b0 = 1.83889230173399459482E-17;
|
346
|
+
b1 = 0.0;
|
347
|
+
chebiterationshichi(a, -9.55485532279655569575E-17, b0, b1, b2);
|
348
|
+
chebiterationshichi(a, 2.04326105980879882648E-16, b0, b1, b2);
|
349
|
+
chebiterationshichi(a, 1.09896949074905343022E-15, b0, b1, b2);
|
350
|
+
chebiterationshichi(a, -1.31313534344092599234E-14, b0, b1, b2);
|
351
|
+
chebiterationshichi(a, 5.93976226264314278932E-14, b0, b1, b2);
|
352
|
+
chebiterationshichi(a, -3.47197010497749154755E-14, b0, b1, b2);
|
353
|
+
chebiterationshichi(a, -1.40059764613117131000E-12, b0, b1, b2);
|
354
|
+
chebiterationshichi(a, 9.49044626224223543299E-12, b0, b1, b2);
|
355
|
+
chebiterationshichi(a, -1.61596181145435454033E-11, b0, b1, b2);
|
356
|
+
chebiterationshichi(a, -1.77899784436430310321E-10, b0, b1, b2);
|
357
|
+
chebiterationshichi(a, 1.35455469767246947469E-9, b0, b1, b2);
|
358
|
+
chebiterationshichi(a, -1.03257121792819495123E-9, b0, b1, b2);
|
359
|
+
chebiterationshichi(a, -3.56699611114982536845E-8, b0, b1, b2);
|
360
|
+
chebiterationshichi(a, 1.44818877384267342057E-7, b0, b1, b2);
|
361
|
+
chebiterationshichi(a, 7.82018215184051295296E-7, b0, b1, b2);
|
362
|
+
chebiterationshichi(a, -5.39919118403805073710E-6, b0, b1, b2);
|
363
|
+
chebiterationshichi(a, -3.12458202168959833422E-5, b0, b1, b2);
|
364
|
+
chebiterationshichi(a, 8.90136741950727517826E-5, b0, b1, b2);
|
365
|
+
chebiterationshichi(a, 2.02558474743846862168E-3, b0, b1, b2);
|
366
|
+
chebiterationshichi(a, 2.96064440855633256972E-2, b0, b1, b2);
|
367
|
+
chebiterationshichi(a, 1.11847751047257036625E0, b0, b1, b2);
|
368
|
+
s = k*0.5*(b0-b2);
|
369
|
+
b0 = -8.12435385225864036372E-18;
|
370
|
+
b1 = 0.0;
|
371
|
+
chebiterationshichi(a, 2.17586413290339214377E-17, b0, b1, b2);
|
372
|
+
chebiterationshichi(a, 5.22624394924072204667E-17, b0, b1, b2);
|
373
|
+
chebiterationshichi(a, -9.48812110591690559363E-16, b0, b1, b2);
|
374
|
+
chebiterationshichi(a, 5.35546311647465209166E-15, b0, b1, b2);
|
375
|
+
chebiterationshichi(a, -1.21009970113732918701E-14, b0, b1, b2);
|
376
|
+
chebiterationshichi(a, -6.00865178553447437951E-14, b0, b1, b2);
|
377
|
+
chebiterationshichi(a, 7.16339649156028587775E-13, b0, b1, b2);
|
378
|
+
chebiterationshichi(a, -2.93496072607599856104E-12, b0, b1, b2);
|
379
|
+
chebiterationshichi(a, -1.40359438136491256904E-12, b0, b1, b2);
|
380
|
+
chebiterationshichi(a, 8.76302288609054966081E-11, b0, b1, b2);
|
381
|
+
chebiterationshichi(a, -4.40092476213282340617E-10, b0, b1, b2);
|
382
|
+
chebiterationshichi(a, -1.87992075640569295479E-10, b0, b1, b2);
|
383
|
+
chebiterationshichi(a, 1.31458150989474594064E-8, b0, b1, b2);
|
384
|
+
chebiterationshichi(a, -4.75513930924765465590E-8, b0, b1, b2);
|
385
|
+
chebiterationshichi(a, -2.21775018801848880741E-7, b0, b1, b2);
|
386
|
+
chebiterationshichi(a, 1.94635531373272490962E-6, b0, b1, b2);
|
387
|
+
chebiterationshichi(a, 4.33505889257316408893E-6, b0, b1, b2);
|
388
|
+
chebiterationshichi(a, -6.13387001076494349496E-5, b0, b1, b2);
|
389
|
+
chebiterationshichi(a, -3.13085477492997465138E-4, b0, b1, b2);
|
390
|
+
chebiterationshichi(a, 4.97164789823116062801E-4, b0, b1, b2);
|
391
|
+
chebiterationshichi(a, 2.64347496031374526641E-2, b0, b1, b2);
|
392
|
+
chebiterationshichi(a, 1.11446150876699213025E0, b0, b1, b2);
|
393
|
+
c = k*0.5*(b0-b2);
|
394
|
+
}
|
395
|
+
else
|
396
|
+
{
|
397
|
+
if( x<=88.0 )
|
398
|
+
{
|
399
|
+
a = (6336.0/x-212.0)/70.0;
|
400
|
+
k = exp(x)/x;
|
401
|
+
b0 = -1.05311574154850938805E-17;
|
402
|
+
b1 = 0.0;
|
403
|
+
chebiterationshichi(a, 2.62446095596355225821E-17, b0, b1, b2);
|
404
|
+
chebiterationshichi(a, 8.82090135625368160657E-17, b0, b1, b2);
|
405
|
+
chebiterationshichi(a, -3.38459811878103047136E-16, b0, b1, b2);
|
406
|
+
chebiterationshichi(a, -8.30608026366935789136E-16, b0, b1, b2);
|
407
|
+
chebiterationshichi(a, 3.93397875437050071776E-15, b0, b1, b2);
|
408
|
+
chebiterationshichi(a, 1.01765565969729044505E-14, b0, b1, b2);
|
409
|
+
chebiterationshichi(a, -4.21128170307640802703E-14, b0, b1, b2);
|
410
|
+
chebiterationshichi(a, -1.60818204519802480035E-13, b0, b1, b2);
|
411
|
+
chebiterationshichi(a, 3.34714954175994481761E-13, b0, b1, b2);
|
412
|
+
chebiterationshichi(a, 2.72600352129153073807E-12, b0, b1, b2);
|
413
|
+
chebiterationshichi(a, 1.66894954752839083608E-12, b0, b1, b2);
|
414
|
+
chebiterationshichi(a, -3.49278141024730899554E-11, b0, b1, b2);
|
415
|
+
chebiterationshichi(a, -1.58580661666482709598E-10, b0, b1, b2);
|
416
|
+
chebiterationshichi(a, -1.79289437183355633342E-10, b0, b1, b2);
|
417
|
+
chebiterationshichi(a, 1.76281629144264523277E-9, b0, b1, b2);
|
418
|
+
chebiterationshichi(a, 1.69050228879421288846E-8, b0, b1, b2);
|
419
|
+
chebiterationshichi(a, 1.25391771228487041649E-7, b0, b1, b2);
|
420
|
+
chebiterationshichi(a, 1.16229947068677338732E-6, b0, b1, b2);
|
421
|
+
chebiterationshichi(a, 1.61038260117376323993E-5, b0, b1, b2);
|
422
|
+
chebiterationshichi(a, 3.49810375601053973070E-4, b0, b1, b2);
|
423
|
+
chebiterationshichi(a, 1.28478065259647610779E-2, b0, b1, b2);
|
424
|
+
chebiterationshichi(a, 1.03665722588798326712E0, b0, b1, b2);
|
425
|
+
s = k*0.5*(b0-b2);
|
426
|
+
b0 = 8.06913408255155572081E-18;
|
427
|
+
b1 = 0.0;
|
428
|
+
chebiterationshichi(a, -2.08074168180148170312E-17, b0, b1, b2);
|
429
|
+
chebiterationshichi(a, -5.98111329658272336816E-17, b0, b1, b2);
|
430
|
+
chebiterationshichi(a, 2.68533951085945765591E-16, b0, b1, b2);
|
431
|
+
chebiterationshichi(a, 4.52313941698904694774E-16, b0, b1, b2);
|
432
|
+
chebiterationshichi(a, -3.10734917335299464535E-15, b0, b1, b2);
|
433
|
+
chebiterationshichi(a, -4.42823207332531972288E-15, b0, b1, b2);
|
434
|
+
chebiterationshichi(a, 3.49639695410806959872E-14, b0, b1, b2);
|
435
|
+
chebiterationshichi(a, 6.63406731718911586609E-14, b0, b1, b2);
|
436
|
+
chebiterationshichi(a, -3.71902448093119218395E-13, b0, b1, b2);
|
437
|
+
chebiterationshichi(a, -1.27135418132338309016E-12, b0, b1, b2);
|
438
|
+
chebiterationshichi(a, 2.74851141935315395333E-12, b0, b1, b2);
|
439
|
+
chebiterationshichi(a, 2.33781843985453438400E-11, b0, b1, b2);
|
440
|
+
chebiterationshichi(a, 2.71436006377612442764E-11, b0, b1, b2);
|
441
|
+
chebiterationshichi(a, -2.56600180000355990529E-10, b0, b1, b2);
|
442
|
+
chebiterationshichi(a, -1.61021375163803438552E-9, b0, b1, b2);
|
443
|
+
chebiterationshichi(a, -4.72543064876271773512E-9, b0, b1, b2);
|
444
|
+
chebiterationshichi(a, -3.00095178028681682282E-9, b0, b1, b2);
|
445
|
+
chebiterationshichi(a, 7.79387474390914922337E-8, b0, b1, b2);
|
446
|
+
chebiterationshichi(a, 1.06942765566401507066E-6, b0, b1, b2);
|
447
|
+
chebiterationshichi(a, 1.59503164802313196374E-5, b0, b1, b2);
|
448
|
+
chebiterationshichi(a, 3.49592575153777996871E-4, b0, b1, b2);
|
449
|
+
chebiterationshichi(a, 1.28475387530065247392E-2, b0, b1, b2);
|
450
|
+
chebiterationshichi(a, 1.03665693917934275131E0, b0, b1, b2);
|
451
|
+
c = k*0.5*(b0-b2);
|
452
|
+
}
|
453
|
+
else
|
454
|
+
{
|
455
|
+
if( sg!=0 )
|
456
|
+
{
|
457
|
+
shi = -ap::maxrealnumber;
|
458
|
+
}
|
459
|
+
else
|
460
|
+
{
|
461
|
+
shi = ap::maxrealnumber;
|
462
|
+
}
|
463
|
+
chi = ap::maxrealnumber;
|
464
|
+
return;
|
465
|
+
}
|
466
|
+
}
|
467
|
+
}
|
468
|
+
if( sg!=0 )
|
469
|
+
{
|
470
|
+
s = -s;
|
471
|
+
}
|
472
|
+
shi = s;
|
473
|
+
chi = 0.57721566490153286061+log(x)+c;
|
474
|
+
}
|
475
|
+
|
476
|
+
|
477
|
+
static void chebiterationshichi(double x,
|
478
|
+
double c,
|
479
|
+
double& b0,
|
480
|
+
double& b1,
|
481
|
+
double& b2)
|
482
|
+
{
|
483
|
+
|
484
|
+
b2 = b1;
|
485
|
+
b1 = b0;
|
486
|
+
b0 = x*b1-b2+c;
|
487
|
+
}
|
488
|
+
|
489
|
+
|
490
|
+
|