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,372 @@
|
|
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 "airyf.h"
|
42
|
+
|
43
|
+
/*************************************************************************
|
44
|
+
Airy function
|
45
|
+
|
46
|
+
Solution of the differential equation
|
47
|
+
|
48
|
+
y"(x) = xy.
|
49
|
+
|
50
|
+
The function returns the two independent solutions Ai, Bi
|
51
|
+
and their first derivatives Ai'(x), Bi'(x).
|
52
|
+
|
53
|
+
Evaluation is by power series summation for small x,
|
54
|
+
by rational minimax approximations for large x.
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
ACCURACY:
|
59
|
+
Error criterion is absolute when function <= 1, relative
|
60
|
+
when function > 1, except * denotes relative error criterion.
|
61
|
+
For large negative x, the absolute error increases as x^1.5.
|
62
|
+
For large positive x, the relative error increases as x^1.5.
|
63
|
+
|
64
|
+
Arithmetic domain function # trials peak rms
|
65
|
+
IEEE -10, 0 Ai 10000 1.6e-15 2.7e-16
|
66
|
+
IEEE 0, 10 Ai 10000 2.3e-14* 1.8e-15*
|
67
|
+
IEEE -10, 0 Ai' 10000 4.6e-15 7.6e-16
|
68
|
+
IEEE 0, 10 Ai' 10000 1.8e-14* 1.5e-15*
|
69
|
+
IEEE -10, 10 Bi 30000 4.2e-15 5.3e-16
|
70
|
+
IEEE -10, 10 Bi' 30000 4.9e-15 7.3e-16
|
71
|
+
|
72
|
+
Cephes Math Library Release 2.8: June, 2000
|
73
|
+
Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
|
74
|
+
*************************************************************************/
|
75
|
+
void airy(double x, double& ai, double& aip, double& bi, double& bip)
|
76
|
+
{
|
77
|
+
double z;
|
78
|
+
double zz;
|
79
|
+
double t;
|
80
|
+
double f;
|
81
|
+
double g;
|
82
|
+
double uf;
|
83
|
+
double ug;
|
84
|
+
double k;
|
85
|
+
double zeta;
|
86
|
+
double theta;
|
87
|
+
int domflg;
|
88
|
+
double c1;
|
89
|
+
double c2;
|
90
|
+
double sqrt3;
|
91
|
+
double sqpii;
|
92
|
+
double afn;
|
93
|
+
double afd;
|
94
|
+
double agn;
|
95
|
+
double agd;
|
96
|
+
double apfn;
|
97
|
+
double apfd;
|
98
|
+
double apgn;
|
99
|
+
double apgd;
|
100
|
+
double an;
|
101
|
+
double ad;
|
102
|
+
double apn;
|
103
|
+
double apd;
|
104
|
+
double bn16;
|
105
|
+
double bd16;
|
106
|
+
double bppn;
|
107
|
+
double bppd;
|
108
|
+
|
109
|
+
sqpii = 5.64189583547756286948E-1;
|
110
|
+
c1 = 0.35502805388781723926;
|
111
|
+
c2 = 0.258819403792806798405;
|
112
|
+
sqrt3 = 1.732050807568877293527;
|
113
|
+
domflg = 0;
|
114
|
+
if( x>25.77 )
|
115
|
+
{
|
116
|
+
ai = 0;
|
117
|
+
aip = 0;
|
118
|
+
bi = ap::maxrealnumber;
|
119
|
+
bip = ap::maxrealnumber;
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
if( x<-2.09 )
|
123
|
+
{
|
124
|
+
domflg = 15;
|
125
|
+
t = sqrt(-x);
|
126
|
+
zeta = -2.0*x*t/3.0;
|
127
|
+
t = sqrt(t);
|
128
|
+
k = sqpii/t;
|
129
|
+
z = 1.0/zeta;
|
130
|
+
zz = z*z;
|
131
|
+
afn = -1.31696323418331795333E-1;
|
132
|
+
afn = afn*zz-6.26456544431912369773E-1;
|
133
|
+
afn = afn*zz-6.93158036036933542233E-1;
|
134
|
+
afn = afn*zz-2.79779981545119124951E-1;
|
135
|
+
afn = afn*zz-4.91900132609500318020E-2;
|
136
|
+
afn = afn*zz-4.06265923594885404393E-3;
|
137
|
+
afn = afn*zz-1.59276496239262096340E-4;
|
138
|
+
afn = afn*zz-2.77649108155232920844E-6;
|
139
|
+
afn = afn*zz-1.67787698489114633780E-8;
|
140
|
+
afd = 1.00000000000000000000E0;
|
141
|
+
afd = afd*zz+1.33560420706553243746E1;
|
142
|
+
afd = afd*zz+3.26825032795224613948E1;
|
143
|
+
afd = afd*zz+2.67367040941499554804E1;
|
144
|
+
afd = afd*zz+9.18707402907259625840E0;
|
145
|
+
afd = afd*zz+1.47529146771666414581E0;
|
146
|
+
afd = afd*zz+1.15687173795188044134E-1;
|
147
|
+
afd = afd*zz+4.40291641615211203805E-3;
|
148
|
+
afd = afd*zz+7.54720348287414296618E-5;
|
149
|
+
afd = afd*zz+4.51850092970580378464E-7;
|
150
|
+
uf = 1.0+zz*afn/afd;
|
151
|
+
agn = 1.97339932091685679179E-2;
|
152
|
+
agn = agn*zz+3.91103029615688277255E-1;
|
153
|
+
agn = agn*zz+1.06579897599595591108E0;
|
154
|
+
agn = agn*zz+9.39169229816650230044E-1;
|
155
|
+
agn = agn*zz+3.51465656105547619242E-1;
|
156
|
+
agn = agn*zz+6.33888919628925490927E-2;
|
157
|
+
agn = agn*zz+5.85804113048388458567E-3;
|
158
|
+
agn = agn*zz+2.82851600836737019778E-4;
|
159
|
+
agn = agn*zz+6.98793669997260967291E-6;
|
160
|
+
agn = agn*zz+8.11789239554389293311E-8;
|
161
|
+
agn = agn*zz+3.41551784765923618484E-10;
|
162
|
+
agd = 1.00000000000000000000E0;
|
163
|
+
agd = agd*zz+9.30892908077441974853E0;
|
164
|
+
agd = agd*zz+1.98352928718312140417E1;
|
165
|
+
agd = agd*zz+1.55646628932864612953E1;
|
166
|
+
agd = agd*zz+5.47686069422975497931E0;
|
167
|
+
agd = agd*zz+9.54293611618961883998E-1;
|
168
|
+
agd = agd*zz+8.64580826352392193095E-2;
|
169
|
+
agd = agd*zz+4.12656523824222607191E-3;
|
170
|
+
agd = agd*zz+1.01259085116509135510E-4;
|
171
|
+
agd = agd*zz+1.17166733214413521882E-6;
|
172
|
+
agd = agd*zz+4.91834570062930015649E-9;
|
173
|
+
ug = z*agn/agd;
|
174
|
+
theta = zeta+0.25*ap::pi();
|
175
|
+
f = sin(theta);
|
176
|
+
g = cos(theta);
|
177
|
+
ai = k*(f*uf-g*ug);
|
178
|
+
bi = k*(g*uf+f*ug);
|
179
|
+
apfn = 1.85365624022535566142E-1;
|
180
|
+
apfn = apfn*zz+8.86712188052584095637E-1;
|
181
|
+
apfn = apfn*zz+9.87391981747398547272E-1;
|
182
|
+
apfn = apfn*zz+4.01241082318003734092E-1;
|
183
|
+
apfn = apfn*zz+7.10304926289631174579E-2;
|
184
|
+
apfn = apfn*zz+5.90618657995661810071E-3;
|
185
|
+
apfn = apfn*zz+2.33051409401776799569E-4;
|
186
|
+
apfn = apfn*zz+4.08718778289035454598E-6;
|
187
|
+
apfn = apfn*zz+2.48379932900442457853E-8;
|
188
|
+
apfd = 1.00000000000000000000E0;
|
189
|
+
apfd = apfd*zz+1.47345854687502542552E1;
|
190
|
+
apfd = apfd*zz+3.75423933435489594466E1;
|
191
|
+
apfd = apfd*zz+3.14657751203046424330E1;
|
192
|
+
apfd = apfd*zz+1.09969125207298778536E1;
|
193
|
+
apfd = apfd*zz+1.78885054766999417817E0;
|
194
|
+
apfd = apfd*zz+1.41733275753662636873E-1;
|
195
|
+
apfd = apfd*zz+5.44066067017226003627E-3;
|
196
|
+
apfd = apfd*zz+9.39421290654511171663E-5;
|
197
|
+
apfd = apfd*zz+5.65978713036027009243E-7;
|
198
|
+
uf = 1.0+zz*apfn/apfd;
|
199
|
+
apgn = -3.55615429033082288335E-2;
|
200
|
+
apgn = apgn*zz-6.37311518129435504426E-1;
|
201
|
+
apgn = apgn*zz-1.70856738884312371053E0;
|
202
|
+
apgn = apgn*zz-1.50221872117316635393E0;
|
203
|
+
apgn = apgn*zz-5.63606665822102676611E-1;
|
204
|
+
apgn = apgn*zz-1.02101031120216891789E-1;
|
205
|
+
apgn = apgn*zz-9.48396695961445269093E-3;
|
206
|
+
apgn = apgn*zz-4.60325307486780994357E-4;
|
207
|
+
apgn = apgn*zz-1.14300836484517375919E-5;
|
208
|
+
apgn = apgn*zz-1.33415518685547420648E-7;
|
209
|
+
apgn = apgn*zz-5.63803833958893494476E-10;
|
210
|
+
apgd = 1.00000000000000000000E0;
|
211
|
+
apgd = apgd*zz+9.85865801696130355144E0;
|
212
|
+
apgd = apgd*zz+2.16401867356585941885E1;
|
213
|
+
apgd = apgd*zz+1.73130776389749389525E1;
|
214
|
+
apgd = apgd*zz+6.17872175280828766327E0;
|
215
|
+
apgd = apgd*zz+1.08848694396321495475E0;
|
216
|
+
apgd = apgd*zz+9.95005543440888479402E-2;
|
217
|
+
apgd = apgd*zz+4.78468199683886610842E-3;
|
218
|
+
apgd = apgd*zz+1.18159633322838625562E-4;
|
219
|
+
apgd = apgd*zz+1.37480673554219441465E-6;
|
220
|
+
apgd = apgd*zz+5.79912514929147598821E-9;
|
221
|
+
ug = z*apgn/apgd;
|
222
|
+
k = sqpii*t;
|
223
|
+
aip = -k*(g*uf+f*ug);
|
224
|
+
bip = k*(f*uf-g*ug);
|
225
|
+
return;
|
226
|
+
}
|
227
|
+
if( x>=2.09 )
|
228
|
+
{
|
229
|
+
domflg = 5;
|
230
|
+
t = sqrt(x);
|
231
|
+
zeta = 2.0*x*t/3.0;
|
232
|
+
g = exp(zeta);
|
233
|
+
t = sqrt(t);
|
234
|
+
k = 2.0*t*g;
|
235
|
+
z = 1.0/zeta;
|
236
|
+
an = 3.46538101525629032477E-1;
|
237
|
+
an = an*z+1.20075952739645805542E1;
|
238
|
+
an = an*z+7.62796053615234516538E1;
|
239
|
+
an = an*z+1.68089224934630576269E2;
|
240
|
+
an = an*z+1.59756391350164413639E2;
|
241
|
+
an = an*z+7.05360906840444183113E1;
|
242
|
+
an = an*z+1.40264691163389668864E1;
|
243
|
+
an = an*z+9.99999999999999995305E-1;
|
244
|
+
ad = 5.67594532638770212846E-1;
|
245
|
+
ad = ad*z+1.47562562584847203173E1;
|
246
|
+
ad = ad*z+8.45138970141474626562E1;
|
247
|
+
ad = ad*z+1.77318088145400459522E2;
|
248
|
+
ad = ad*z+1.64234692871529701831E2;
|
249
|
+
ad = ad*z+7.14778400825575695274E1;
|
250
|
+
ad = ad*z+1.40959135607834029598E1;
|
251
|
+
ad = ad*z+1.00000000000000000470E0;
|
252
|
+
f = an/ad;
|
253
|
+
ai = sqpii*f/k;
|
254
|
+
k = -0.5*sqpii*t/g;
|
255
|
+
apn = 6.13759184814035759225E-1;
|
256
|
+
apn = apn*z+1.47454670787755323881E1;
|
257
|
+
apn = apn*z+8.20584123476060982430E1;
|
258
|
+
apn = apn*z+1.71184781360976385540E2;
|
259
|
+
apn = apn*z+1.59317847137141783523E2;
|
260
|
+
apn = apn*z+6.99778599330103016170E1;
|
261
|
+
apn = apn*z+1.39470856980481566958E1;
|
262
|
+
apn = apn*z+1.00000000000000000550E0;
|
263
|
+
apd = 3.34203677749736953049E-1;
|
264
|
+
apd = apd*z+1.11810297306158156705E1;
|
265
|
+
apd = apd*z+7.11727352147859965283E1;
|
266
|
+
apd = apd*z+1.58778084372838313640E2;
|
267
|
+
apd = apd*z+1.53206427475809220834E2;
|
268
|
+
apd = apd*z+6.86752304592780337944E1;
|
269
|
+
apd = apd*z+1.38498634758259442477E1;
|
270
|
+
apd = apd*z+9.99999999999999994502E-1;
|
271
|
+
f = apn/apd;
|
272
|
+
aip = f*k;
|
273
|
+
if( x>8.3203353 )
|
274
|
+
{
|
275
|
+
bn16 = -2.53240795869364152689E-1;
|
276
|
+
bn16 = bn16*z+5.75285167332467384228E-1;
|
277
|
+
bn16 = bn16*z-3.29907036873225371650E-1;
|
278
|
+
bn16 = bn16*z+6.44404068948199951727E-2;
|
279
|
+
bn16 = bn16*z-3.82519546641336734394E-3;
|
280
|
+
bd16 = 1.00000000000000000000E0;
|
281
|
+
bd16 = bd16*z-7.15685095054035237902E0;
|
282
|
+
bd16 = bd16*z+1.06039580715664694291E1;
|
283
|
+
bd16 = bd16*z-5.23246636471251500874E0;
|
284
|
+
bd16 = bd16*z+9.57395864378383833152E-1;
|
285
|
+
bd16 = bd16*z-5.50828147163549611107E-2;
|
286
|
+
f = z*bn16/bd16;
|
287
|
+
k = sqpii*g;
|
288
|
+
bi = k*(1.0+f)/t;
|
289
|
+
bppn = 4.65461162774651610328E-1;
|
290
|
+
bppn = bppn*z-1.08992173800493920734E0;
|
291
|
+
bppn = bppn*z+6.38800117371827987759E-1;
|
292
|
+
bppn = bppn*z-1.26844349553102907034E-1;
|
293
|
+
bppn = bppn*z+7.62487844342109852105E-3;
|
294
|
+
bppd = 1.00000000000000000000E0;
|
295
|
+
bppd = bppd*z-8.70622787633159124240E0;
|
296
|
+
bppd = bppd*z+1.38993162704553213172E1;
|
297
|
+
bppd = bppd*z-7.14116144616431159572E0;
|
298
|
+
bppd = bppd*z+1.34008595960680518666E0;
|
299
|
+
bppd = bppd*z-7.84273211323341930448E-2;
|
300
|
+
f = z*bppn/bppd;
|
301
|
+
bip = k*t*(1.0+f);
|
302
|
+
return;
|
303
|
+
}
|
304
|
+
}
|
305
|
+
f = 1.0;
|
306
|
+
g = x;
|
307
|
+
t = 1.0;
|
308
|
+
uf = 1.0;
|
309
|
+
ug = x;
|
310
|
+
k = 1.0;
|
311
|
+
z = x*x*x;
|
312
|
+
while(t>ap::machineepsilon)
|
313
|
+
{
|
314
|
+
uf = uf*z;
|
315
|
+
k = k+1.0;
|
316
|
+
uf = uf/k;
|
317
|
+
ug = ug*z;
|
318
|
+
k = k+1.0;
|
319
|
+
ug = ug/k;
|
320
|
+
uf = uf/k;
|
321
|
+
f = f+uf;
|
322
|
+
k = k+1.0;
|
323
|
+
ug = ug/k;
|
324
|
+
g = g+ug;
|
325
|
+
t = fabs(uf/f);
|
326
|
+
}
|
327
|
+
uf = c1*f;
|
328
|
+
ug = c2*g;
|
329
|
+
if( domflg%2==0 )
|
330
|
+
{
|
331
|
+
ai = uf-ug;
|
332
|
+
}
|
333
|
+
if( domflg/2%2==0 )
|
334
|
+
{
|
335
|
+
bi = sqrt3*(uf+ug);
|
336
|
+
}
|
337
|
+
k = 4.0;
|
338
|
+
uf = x*x/2.0;
|
339
|
+
ug = z/3.0;
|
340
|
+
f = uf;
|
341
|
+
g = 1.0+ug;
|
342
|
+
uf = uf/3.0;
|
343
|
+
t = 1.0;
|
344
|
+
while(t>ap::machineepsilon)
|
345
|
+
{
|
346
|
+
uf = uf*z;
|
347
|
+
ug = ug/k;
|
348
|
+
k = k+1.0;
|
349
|
+
ug = ug*z;
|
350
|
+
uf = uf/k;
|
351
|
+
f = f+uf;
|
352
|
+
k = k+1.0;
|
353
|
+
ug = ug/k;
|
354
|
+
uf = uf/k;
|
355
|
+
g = g+ug;
|
356
|
+
k = k+1.0;
|
357
|
+
t = fabs(ug/g);
|
358
|
+
}
|
359
|
+
uf = c1*f;
|
360
|
+
ug = c2*g;
|
361
|
+
if( domflg/4%2==0 )
|
362
|
+
{
|
363
|
+
aip = uf-ug;
|
364
|
+
}
|
365
|
+
if( domflg/8%2==0 )
|
366
|
+
{
|
367
|
+
bip = sqrt3*(uf+ug);
|
368
|
+
}
|
369
|
+
}
|
370
|
+
|
371
|
+
|
372
|
+
|
data/ext/alglib/airyf.h
ADDED
@@ -0,0 +1,81 @@
|
|
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
|
+
#ifndef _airyf_h
|
41
|
+
#define _airyf_h
|
42
|
+
|
43
|
+
#include "ap.h"
|
44
|
+
#include "ialglib.h"
|
45
|
+
|
46
|
+
/*************************************************************************
|
47
|
+
Airy function
|
48
|
+
|
49
|
+
Solution of the differential equation
|
50
|
+
|
51
|
+
y"(x) = xy.
|
52
|
+
|
53
|
+
The function returns the two independent solutions Ai, Bi
|
54
|
+
and their first derivatives Ai'(x), Bi'(x).
|
55
|
+
|
56
|
+
Evaluation is by power series summation for small x,
|
57
|
+
by rational minimax approximations for large x.
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
ACCURACY:
|
62
|
+
Error criterion is absolute when function <= 1, relative
|
63
|
+
when function > 1, except * denotes relative error criterion.
|
64
|
+
For large negative x, the absolute error increases as x^1.5.
|
65
|
+
For large positive x, the relative error increases as x^1.5.
|
66
|
+
|
67
|
+
Arithmetic domain function # trials peak rms
|
68
|
+
IEEE -10, 0 Ai 10000 1.6e-15 2.7e-16
|
69
|
+
IEEE 0, 10 Ai 10000 2.3e-14* 1.8e-15*
|
70
|
+
IEEE -10, 0 Ai' 10000 4.6e-15 7.6e-16
|
71
|
+
IEEE 0, 10 Ai' 10000 1.8e-14* 1.5e-15*
|
72
|
+
IEEE -10, 10 Bi 30000 4.2e-15 5.3e-16
|
73
|
+
IEEE -10, 10 Bi' 30000 4.9e-15 7.3e-16
|
74
|
+
|
75
|
+
Cephes Math Library Release 2.8: June, 2000
|
76
|
+
Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
|
77
|
+
*************************************************************************/
|
78
|
+
void airy(double x, double& ai, double& aip, double& bi, double& bip);
|
79
|
+
|
80
|
+
|
81
|
+
#endif
|