~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

Viewing changes to Lib/special/cephes/airy.c

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik
  • Date: 2008-06-16 22:58:01 UTC
  • mfrom: (2.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616225801-irdhrpcwiocfbcmt
Tags: 0.6.0-12
* The description updated to match the current SciPy (Closes: #489149).
* Standards-Version bumped to 3.8.0 (no action needed)
* Build-Depends: netcdf-dev changed to libnetcdf-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*                                                      airy.c
2
 
 *
3
 
 *      Airy function
4
 
 *
5
 
 *
6
 
 *
7
 
 * SYNOPSIS:
8
 
 *
9
 
 * double x, ai, aip, bi, bip;
10
 
 * int airy();
11
 
 *
12
 
 * airy( x, _&ai, _&aip, _&bi, _&bip );
13
 
 *
14
 
 *
15
 
 *
16
 
 * DESCRIPTION:
17
 
 *
18
 
 * Solution of the differential equation
19
 
 *
20
 
 *      y"(x) = xy.
21
 
 *
22
 
 * The function returns the two independent solutions Ai, Bi
23
 
 * and their first derivatives Ai'(x), Bi'(x).
24
 
 *
25
 
 * Evaluation is by power series summation for small x,
26
 
 * by rational minimax approximations for large x.
27
 
 *
28
 
 *
29
 
 *
30
 
 * ACCURACY:
31
 
 * Error criterion is absolute when function <= 1, relative
32
 
 * when function > 1, except * denotes relative error criterion.
33
 
 * For large negative x, the absolute error increases as x^1.5.
34
 
 * For large positive x, the relative error increases as x^1.5.
35
 
 *
36
 
 * Arithmetic  domain   function  # trials      peak         rms
37
 
 * IEEE        -10, 0     Ai        10000       1.6e-15     2.7e-16
38
 
 * IEEE          0, 10    Ai        10000       2.3e-14*    1.8e-15*
39
 
 * IEEE        -10, 0     Ai'       10000       4.6e-15     7.6e-16
40
 
 * IEEE          0, 10    Ai'       10000       1.8e-14*    1.5e-15*
41
 
 * IEEE        -10, 10    Bi        30000       4.2e-15     5.3e-16
42
 
 * IEEE        -10, 10    Bi'       30000       4.9e-15     7.3e-16
43
 
 * DEC         -10, 0     Ai         5000       1.7e-16     2.8e-17
44
 
 * DEC           0, 10    Ai         5000       2.1e-15*    1.7e-16*
45
 
 * DEC         -10, 0     Ai'        5000       4.7e-16     7.8e-17
46
 
 * DEC           0, 10    Ai'       12000       1.8e-15*    1.5e-16*
47
 
 * DEC         -10, 10    Bi        10000       5.5e-16     6.8e-17
48
 
 * DEC         -10, 10    Bi'        7000       5.3e-16     8.7e-17
49
 
 *
50
 
 */
51
 
/*                                                     airy.c */
52
 
 
53
 
/*
54
 
Cephes Math Library Release 2.8:  June, 2000
55
 
Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
56
 
*/
57
 
 
58
 
#include "mconf.h"
59
 
 
60
 
static double c1 = 0.35502805388781723926;
61
 
static double c2 = 0.258819403792806798405;
62
 
static double sqrt3 = 1.732050807568877293527;
63
 
static double sqpii = 5.64189583547756286948E-1;
64
 
extern double PI;
65
 
 
66
 
extern double MAXNUM, MACHEP;
67
 
#ifdef UNK
68
 
#define MAXAIRY 25.77
69
 
#endif
70
 
#ifdef DEC
71
 
#define MAXAIRY 25.77
72
 
#endif
73
 
#ifdef IBMPC
74
 
#define MAXAIRY 103.892
75
 
#endif
76
 
#ifdef MIEEE
77
 
#define MAXAIRY 103.892
78
 
#endif
79
 
 
80
 
 
81
 
#ifdef UNK
82
 
static double AN[8] = {
83
 
  3.46538101525629032477E-1,
84
 
  1.20075952739645805542E1,
85
 
  7.62796053615234516538E1,
86
 
  1.68089224934630576269E2,
87
 
  1.59756391350164413639E2,
88
 
  7.05360906840444183113E1,
89
 
  1.40264691163389668864E1,
90
 
  9.99999999999999995305E-1,
91
 
};
92
 
static double AD[8] = {
93
 
  5.67594532638770212846E-1,
94
 
  1.47562562584847203173E1,
95
 
  8.45138970141474626562E1,
96
 
  1.77318088145400459522E2,
97
 
  1.64234692871529701831E2,
98
 
  7.14778400825575695274E1,
99
 
  1.40959135607834029598E1,
100
 
  1.00000000000000000470E0,
101
 
};
102
 
#endif
103
 
#ifdef DEC
104
 
static unsigned short AN[32] = {
105
 
0037661,0066561,0024675,0131301,
106
 
0041100,0017434,0034324,0101466,
107
 
0041630,0107450,0067427,0007430,
108
 
0042050,0013327,0071000,0034737,
109
 
0042037,0140642,0156417,0167366,
110
 
0041615,0011172,0075147,0051165,
111
 
0041140,0066152,0160520,0075146,
112
 
0040200,0000000,0000000,0000000,
113
 
};
114
 
static unsigned short AD[32] = {
115
 
0040021,0046740,0011422,0064606,
116
 
0041154,0014640,0024631,0062450,
117
 
0041651,0003435,0101152,0106401,
118
 
0042061,0050556,0034605,0136602,
119
 
0042044,0036024,0152377,0151414,
120
 
0041616,0172247,0072216,0115374,
121
 
0041141,0104334,0124154,0166007,
122
 
0040200,0000000,0000000,0000000,
123
 
};
124
 
#endif
125
 
#ifdef IBMPC
126
 
static unsigned short AN[32] = {
127
 
0xb658,0x2537,0x2dae,0x3fd6,
128
 
0x9067,0x871a,0x03e3,0x4028,
129
 
0xe1e3,0x0de2,0x11e5,0x4053,
130
 
0x073c,0xee40,0x02da,0x4065,
131
 
0xfddf,0x5ba1,0xf834,0x4063,
132
 
0xea4f,0x4f4c,0xa24f,0x4051,
133
 
0x0f4d,0x5c2a,0x0d8d,0x402c,
134
 
0x0000,0x0000,0x0000,0x3ff0,
135
 
};
136
 
static unsigned short AD[32] = {
137
 
0x4d31,0x0262,0x29bc,0x3fe2,
138
 
0x2ca5,0x0533,0x8334,0x402d,
139
 
0x51a0,0xb04d,0x20e3,0x4055,
140
 
0xb7b0,0xc730,0x2a2d,0x4066,
141
 
0xfa61,0x9a9f,0x8782,0x4064,
142
 
0xd35f,0xee91,0xde94,0x4051,
143
 
0x9d81,0x950d,0x311b,0x402c,
144
 
0x0000,0x0000,0x0000,0x3ff0,
145
 
};
146
 
#endif
147
 
#ifdef MIEEE
148
 
static unsigned short AN[32] = {
149
 
0x3fd6,0x2dae,0x2537,0xb658,
150
 
0x4028,0x03e3,0x871a,0x9067,
151
 
0x4053,0x11e5,0x0de2,0xe1e3,
152
 
0x4065,0x02da,0xee40,0x073c,
153
 
0x4063,0xf834,0x5ba1,0xfddf,
154
 
0x4051,0xa24f,0x4f4c,0xea4f,
155
 
0x402c,0x0d8d,0x5c2a,0x0f4d,
156
 
0x3ff0,0x0000,0x0000,0x0000,
157
 
};
158
 
static unsigned short AD[32] = {
159
 
0x3fe2,0x29bc,0x0262,0x4d31,
160
 
0x402d,0x8334,0x0533,0x2ca5,
161
 
0x4055,0x20e3,0xb04d,0x51a0,
162
 
0x4066,0x2a2d,0xc730,0xb7b0,
163
 
0x4064,0x8782,0x9a9f,0xfa61,
164
 
0x4051,0xde94,0xee91,0xd35f,
165
 
0x402c,0x311b,0x950d,0x9d81,
166
 
0x3ff0,0x0000,0x0000,0x0000,
167
 
};
168
 
#endif
169
 
 
170
 
#ifdef UNK
171
 
static double APN[8] = {
172
 
  6.13759184814035759225E-1,
173
 
  1.47454670787755323881E1,
174
 
  8.20584123476060982430E1,
175
 
  1.71184781360976385540E2,
176
 
  1.59317847137141783523E2,
177
 
  6.99778599330103016170E1,
178
 
  1.39470856980481566958E1,
179
 
  1.00000000000000000550E0,
180
 
};
181
 
static double APD[8] = {
182
 
  3.34203677749736953049E-1,
183
 
  1.11810297306158156705E1,
184
 
  7.11727352147859965283E1,
185
 
  1.58778084372838313640E2,
186
 
  1.53206427475809220834E2,
187
 
  6.86752304592780337944E1,
188
 
  1.38498634758259442477E1,
189
 
  9.99999999999999994502E-1,
190
 
};
191
 
#endif
192
 
#ifdef DEC
193
 
static unsigned short APN[32] = {
194
 
0040035,0017522,0065145,0054755,
195
 
0041153,0166556,0161471,0057174,
196
 
0041644,0016750,0034445,0046462,
197
 
0042053,0027515,0152316,0046717,
198
 
0042037,0050536,0067023,0023264,
199
 
0041613,0172252,0007240,0131055,
200
 
0041137,0023503,0052472,0002305,
201
 
0040200,0000000,0000000,0000000,
202
 
};
203
 
static unsigned short APD[32] = {
204
 
0037653,0016276,0112106,0126625,
205
 
0041062,0162577,0067111,0111761,
206
 
0041616,0054160,0140004,0137455,
207
 
0042036,0143460,0104626,0157206,
208
 
0042031,0032330,0067131,0114260,
209
 
0041611,0054667,0147207,0134564,
210
 
0041135,0114412,0070653,0146015,
211
 
0040200,0000000,0000000,0000000,
212
 
};
213
 
#endif
214
 
#ifdef IBMPC
215
 
static unsigned short APN[32] = {
216
 
0xab3e,0x4d4c,0xa3ea,0x3fe3,
217
 
0x2bcf,0xdc67,0x7dad,0x402d,
218
 
0xa9a6,0x0724,0x83bd,0x4054,
219
 
0xc9ba,0xba99,0x65e9,0x4065,
220
 
0x64d7,0xcdc2,0xea2b,0x4063,
221
 
0x1646,0x41d4,0x7e95,0x4051,
222
 
0x4099,0x6aa7,0xe4e8,0x402b,
223
 
0x0000,0x0000,0x0000,0x3ff0,
224
 
};
225
 
static unsigned short APD[32] = {
226
 
0xd5b3,0xd288,0x6397,0x3fd5,
227
 
0x327e,0xedc9,0x5caf,0x4026,
228
 
0x97e6,0x1800,0xcb0e,0x4051,
229
 
0xdbd1,0x1132,0xd8e6,0x4063,
230
 
0x3316,0x0dcb,0x269b,0x4063,
231
 
0xf72f,0xf9d0,0x2b36,0x4051,
232
 
0x7982,0x4e35,0xb321,0x402b,
233
 
0x0000,0x0000,0x0000,0x3ff0,
234
 
};
235
 
#endif
236
 
#ifdef MIEEE
237
 
static unsigned short APN[32] = {
238
 
0x3fe3,0xa3ea,0x4d4c,0xab3e,
239
 
0x402d,0x7dad,0xdc67,0x2bcf,
240
 
0x4054,0x83bd,0x0724,0xa9a6,
241
 
0x4065,0x65e9,0xba99,0xc9ba,
242
 
0x4063,0xea2b,0xcdc2,0x64d7,
243
 
0x4051,0x7e95,0x41d4,0x1646,
244
 
0x402b,0xe4e8,0x6aa7,0x4099,
245
 
0x3ff0,0x0000,0x0000,0x0000,
246
 
};
247
 
static unsigned short APD[32] = {
248
 
0x3fd5,0x6397,0xd288,0xd5b3,
249
 
0x4026,0x5caf,0xedc9,0x327e,
250
 
0x4051,0xcb0e,0x1800,0x97e6,
251
 
0x4063,0xd8e6,0x1132,0xdbd1,
252
 
0x4063,0x269b,0x0dcb,0x3316,
253
 
0x4051,0x2b36,0xf9d0,0xf72f,
254
 
0x402b,0xb321,0x4e35,0x7982,
255
 
0x3ff0,0x0000,0x0000,0x0000,
256
 
};
257
 
#endif
258
 
 
259
 
#ifdef UNK
260
 
static double BN16[5] = {
261
 
-2.53240795869364152689E-1,
262
 
 5.75285167332467384228E-1,
263
 
-3.29907036873225371650E-1,
264
 
 6.44404068948199951727E-2,
265
 
-3.82519546641336734394E-3,
266
 
};
267
 
static double BD16[5] = {
268
 
/* 1.00000000000000000000E0,*/
269
 
-7.15685095054035237902E0,
270
 
 1.06039580715664694291E1,
271
 
-5.23246636471251500874E0,
272
 
 9.57395864378383833152E-1,
273
 
-5.50828147163549611107E-2,
274
 
};
275
 
#endif
276
 
#ifdef DEC
277
 
static unsigned short BN16[20] = {
278
 
0137601,0124307,0010213,0035210,
279
 
0040023,0042743,0101621,0016031,
280
 
0137650,0164623,0036056,0074511,
281
 
0037203,0174525,0000473,0142474,
282
 
0136172,0130041,0066726,0064324,
283
 
};
284
 
static unsigned short BD16[20] = {
285
 
/*0040200,0000000,0000000,0000000,*/
286
 
0140745,0002354,0044335,0055276,
287
 
0041051,0124717,0170130,0104013,
288
 
0140647,0070135,0046473,0103501,
289
 
0040165,0013745,0033324,0127766,
290
 
0137141,0117204,0076164,0033107,
291
 
};
292
 
#endif
293
 
#ifdef IBMPC
294
 
static unsigned short BN16[20] = {
295
 
0x6751,0xe211,0x3518,0xbfd0,
296
 
0x2383,0x7072,0x68bc,0x3fe2,
297
 
0xcf29,0x6785,0x1d32,0xbfd5,
298
 
0x78a8,0xa027,0x7f2a,0x3fb0,
299
 
0xcd1b,0x2dba,0x5604,0xbf6f,
300
 
};
301
 
static unsigned short BD16[20] = {
302
 
/*0x0000,0x0000,0x0000,0x3ff0,*/
303
 
0xab58,0x891b,0xa09d,0xc01c,
304
 
0x1101,0xfe0b,0x3539,0x4025,
305
 
0x70e8,0xa9a7,0xee0b,0xc014,
306
 
0x95ff,0xa6da,0xa2fc,0x3fee,
307
 
0x86c9,0x8f8e,0x33d0,0xbfac,
308
 
};
309
 
#endif
310
 
#ifdef MIEEE
311
 
static unsigned short BN16[20] = {
312
 
0xbfd0,0x3518,0xe211,0x6751,
313
 
0x3fe2,0x68bc,0x7072,0x2383,
314
 
0xbfd5,0x1d32,0x6785,0xcf29,
315
 
0x3fb0,0x7f2a,0xa027,0x78a8,
316
 
0xbf6f,0x5604,0x2dba,0xcd1b,
317
 
};
318
 
static unsigned short BD16[20] = {
319
 
/*0x3ff0,0x0000,0x0000,0x0000,*/
320
 
0xc01c,0xa09d,0x891b,0xab58,
321
 
0x4025,0x3539,0xfe0b,0x1101,
322
 
0xc014,0xee0b,0xa9a7,0x70e8,
323
 
0x3fee,0xa2fc,0xa6da,0x95ff,
324
 
0xbfac,0x33d0,0x8f8e,0x86c9,
325
 
};
326
 
#endif
327
 
 
328
 
#ifdef UNK
329
 
static double BPPN[5] = {
330
 
 4.65461162774651610328E-1,
331
 
-1.08992173800493920734E0,
332
 
 6.38800117371827987759E-1,
333
 
-1.26844349553102907034E-1,
334
 
 7.62487844342109852105E-3,
335
 
};
336
 
static double BPPD[5] = {
337
 
/* 1.00000000000000000000E0,*/
338
 
-8.70622787633159124240E0,
339
 
 1.38993162704553213172E1,
340
 
-7.14116144616431159572E0,
341
 
 1.34008595960680518666E0,
342
 
-7.84273211323341930448E-2,
343
 
};
344
 
#endif
345
 
#ifdef DEC
346
 
static unsigned short BPPN[20] = {
347
 
0037756,0050354,0167531,0135731,
348
 
0140213,0101216,0032767,0020375,
349
 
0040043,0104147,0106312,0177632,
350
 
0137401,0161574,0032015,0043714,
351
 
0036371,0155035,0143165,0142262,
352
 
};
353
 
static unsigned short BPPD[20] = {
354
 
/*0040200,0000000,0000000,0000000,*/
355
 
0141013,0046265,0115005,0161053,
356
 
0041136,0061631,0072445,0156131,
357
 
0140744,0102145,0001127,0065304,
358
 
0040253,0103757,0146453,0102513,
359
 
0137240,0117200,0155402,0113500,
360
 
};
361
 
#endif
362
 
#ifdef IBMPC
363
 
static unsigned short BPPN[20] = {
364
 
0x377b,0x9deb,0xca1d,0x3fdd,
365
 
0xe420,0xc6be,0x7051,0xbff1,
366
 
0x5ff3,0xf199,0x710c,0x3fe4,
367
 
0xa8fa,0x8681,0x3c6f,0xbfc0,
368
 
0xb896,0xb8ce,0x3b43,0x3f7f,
369
 
};
370
 
static unsigned short BPPD[20] = {
371
 
/*0x0000,0x0000,0x0000,0x3ff0,*/
372
 
0xbc45,0xb340,0x6996,0xc021,
373
 
0xbb8b,0x2ea4,0xcc73,0x402b,
374
 
0xed59,0xa04a,0x908c,0xc01c,
375
 
0x70a9,0xf9a5,0x70fd,0x3ff5,
376
 
0x52e8,0x1b60,0x13d0,0xbfb4,
377
 
};
378
 
#endif
379
 
#ifdef MIEEE
380
 
static unsigned short BPPN[20] = {
381
 
0x3fdd,0xca1d,0x9deb,0x377b,
382
 
0xbff1,0x7051,0xc6be,0xe420,
383
 
0x3fe4,0x710c,0xf199,0x5ff3,
384
 
0xbfc0,0x3c6f,0x8681,0xa8fa,
385
 
0x3f7f,0x3b43,0xb8ce,0xb896,
386
 
};
387
 
static unsigned short BPPD[20] = {
388
 
/*0x3ff0,0x0000,0x0000,0x0000,*/
389
 
0xc021,0x6996,0xb340,0xbc45,
390
 
0x402b,0xcc73,0x2ea4,0xbb8b,
391
 
0xc01c,0x908c,0xa04a,0xed59,
392
 
0x3ff5,0x70fd,0xf9a5,0x70a9,
393
 
0xbfb4,0x13d0,0x1b60,0x52e8,
394
 
};
395
 
#endif
396
 
 
397
 
#ifdef UNK
398
 
static double AFN[9] = {
399
 
-1.31696323418331795333E-1,
400
 
-6.26456544431912369773E-1,
401
 
-6.93158036036933542233E-1,
402
 
-2.79779981545119124951E-1,
403
 
-4.91900132609500318020E-2,
404
 
-4.06265923594885404393E-3,
405
 
-1.59276496239262096340E-4,
406
 
-2.77649108155232920844E-6,
407
 
-1.67787698489114633780E-8,
408
 
};
409
 
static double AFD[9] = {
410
 
/* 1.00000000000000000000E0,*/
411
 
 1.33560420706553243746E1,
412
 
 3.26825032795224613948E1,
413
 
 2.67367040941499554804E1,
414
 
 9.18707402907259625840E0,
415
 
 1.47529146771666414581E0,
416
 
 1.15687173795188044134E-1,
417
 
 4.40291641615211203805E-3,
418
 
 7.54720348287414296618E-5,
419
 
 4.51850092970580378464E-7,
420
 
};
421
 
#endif
422
 
#ifdef DEC
423
 
static unsigned short AFN[36] = {
424
 
0137406,0155546,0124127,0033732,
425
 
0140040,0057564,0141263,0041222,
426
 
0140061,0071316,0013674,0175754,
427
 
0137617,0037522,0056637,0120130,
428
 
0137111,0075567,0121755,0166122,
429
 
0136205,0020016,0043317,0002201,
430
 
0135047,0001565,0075130,0002334,
431
 
0133472,0051700,0165021,0131551,
432
 
0131620,0020347,0132165,0013215,
433
 
};
434
 
static unsigned short AFD[36] = {
435
 
/*0040200,0000000,0000000,0000000,*/
436
 
0041125,0131131,0025627,0067623,
437
 
0041402,0135342,0021703,0154315,
438
 
0041325,0162305,0016671,0120175,
439
 
0041022,0177101,0053114,0141632,
440
 
0040274,0153131,0147364,0114306,
441
 
0037354,0166545,0120042,0150530,
442
 
0036220,0043127,0000727,0130273,
443
 
0034636,0043275,0075667,0034733,
444
 
0032762,0112715,0146250,0142474,
445
 
};
446
 
#endif
447
 
#ifdef IBMPC
448
 
static unsigned short AFN[36] = {
449
 
0xe6fb,0xd50a,0xdb6c,0xbfc0,
450
 
0x6852,0x9856,0x0bee,0xbfe4,
451
 
0x9f7d,0xc2f7,0x2e59,0xbfe6,
452
 
0xf40b,0x4bb3,0xe7ea,0xbfd1,
453
 
0xbd8a,0xf47d,0x2f6e,0xbfa9,
454
 
0xe090,0xc8d9,0xa401,0xbf70,
455
 
0x009c,0xaf4b,0xe06e,0xbf24,
456
 
0x366d,0x1d42,0x4a78,0xbec7,
457
 
0xa2d2,0xf68e,0x041c,0xbe52,
458
 
};
459
 
static unsigned short AFD[36] = {
460
 
/*0x0000,0x0000,0x0000,0x3ff0,*/
461
 
0xedf2,0x2572,0xb64b,0x402a,
462
 
0x7b1a,0x4478,0x575c,0x4040,
463
 
0x3410,0xa3b7,0xbc98,0x403a,
464
 
0x9873,0x2ac9,0x5fc8,0x4022,
465
 
0x9319,0x39de,0x9acb,0x3ff7,
466
 
0x5a2b,0xb404,0x9dac,0x3fbd,
467
 
0xf617,0xe03a,0x08ca,0x3f72,
468
 
0xe73b,0xaf76,0xc8d7,0x3f13,
469
 
0x18a7,0xb995,0x52b9,0x3e9e,
470
 
};
471
 
#endif
472
 
#ifdef MIEEE
473
 
static unsigned short AFN[36] = {
474
 
0xbfc0,0xdb6c,0xd50a,0xe6fb,
475
 
0xbfe4,0x0bee,0x9856,0x6852,
476
 
0xbfe6,0x2e59,0xc2f7,0x9f7d,
477
 
0xbfd1,0xe7ea,0x4bb3,0xf40b,
478
 
0xbfa9,0x2f6e,0xf47d,0xbd8a,
479
 
0xbf70,0xa401,0xc8d9,0xe090,
480
 
0xbf24,0xe06e,0xaf4b,0x009c,
481
 
0xbec7,0x4a78,0x1d42,0x366d,
482
 
0xbe52,0x041c,0xf68e,0xa2d2,
483
 
};
484
 
static unsigned short AFD[36] = {
485
 
/*0x3ff0,0x0000,0x0000,0x0000,*/
486
 
0x402a,0xb64b,0x2572,0xedf2,
487
 
0x4040,0x575c,0x4478,0x7b1a,
488
 
0x403a,0xbc98,0xa3b7,0x3410,
489
 
0x4022,0x5fc8,0x2ac9,0x9873,
490
 
0x3ff7,0x9acb,0x39de,0x9319,
491
 
0x3fbd,0x9dac,0xb404,0x5a2b,
492
 
0x3f72,0x08ca,0xe03a,0xf617,
493
 
0x3f13,0xc8d7,0xaf76,0xe73b,
494
 
0x3e9e,0x52b9,0xb995,0x18a7,
495
 
};
496
 
#endif
497
 
 
498
 
#ifdef UNK
499
 
static double AGN[11] = {
500
 
  1.97339932091685679179E-2,
501
 
  3.91103029615688277255E-1,
502
 
  1.06579897599595591108E0,
503
 
  9.39169229816650230044E-1,
504
 
  3.51465656105547619242E-1,
505
 
  6.33888919628925490927E-2,
506
 
  5.85804113048388458567E-3,
507
 
  2.82851600836737019778E-4,
508
 
  6.98793669997260967291E-6,
509
 
  8.11789239554389293311E-8,
510
 
  3.41551784765923618484E-10,
511
 
};
512
 
static double AGD[10] = {
513
 
/*  1.00000000000000000000E0,*/
514
 
  9.30892908077441974853E0,
515
 
  1.98352928718312140417E1,
516
 
  1.55646628932864612953E1,
517
 
  5.47686069422975497931E0,
518
 
  9.54293611618961883998E-1,
519
 
  8.64580826352392193095E-2,
520
 
  4.12656523824222607191E-3,
521
 
  1.01259085116509135510E-4,
522
 
  1.17166733214413521882E-6,
523
 
  4.91834570062930015649E-9,
524
 
};
525
 
#endif
526
 
#ifdef DEC
527
 
static unsigned short AGN[44] = {
528
 
0036641,0124456,0167175,0157354,
529
 
0037710,0037250,0001441,0136671,
530
 
0040210,0066031,0150401,0123532,
531
 
0040160,0066545,0003570,0153133,
532
 
0037663,0171516,0072507,0170345,
533
 
0037201,0151011,0007510,0045702,
534
 
0036277,0172317,0104572,0101030,
535
 
0035224,0045663,0000160,0136422,
536
 
0033752,0074753,0047702,0135160,
537
 
0032256,0052225,0156550,0107103,
538
 
0030273,0142443,0166277,0071720,
539
 
};
540
 
static unsigned short AGD[40] = {
541
 
/*0040200,0000000,0000000,0000000,*/
542
 
0041024,0170537,0117253,0055003,
543
 
0041236,0127256,0003570,0143240,
544
 
0041171,0004333,0172476,0160645,
545
 
0040657,0041161,0055716,0157161,
546
 
0040164,0046226,0006257,0063431,
547
 
0037261,0010357,0065445,0047563,
548
 
0036207,0034043,0057434,0116732,
549
 
0034724,0055416,0130035,0026377,
550
 
0033235,0041056,0154071,0023502,
551
 
0031250,0177071,0167254,0047242,
552
 
};
553
 
#endif
554
 
#ifdef IBMPC
555
 
static unsigned short AGN[44] = {
556
 
0xbbde,0xddcf,0x3525,0x3f94,
557
 
0x37b7,0x0064,0x07d5,0x3fd9,
558
 
0x34eb,0x3a20,0x0d83,0x3ff1,
559
 
0x1acb,0xa0ef,0x0dac,0x3fee,
560
 
0xfe1d,0xcea8,0x7e69,0x3fd6,
561
 
0x0978,0x21e9,0x3a41,0x3fb0,
562
 
0x5043,0xf12f,0xfe99,0x3f77,
563
 
0x17a2,0x600e,0x8976,0x3f32,
564
 
0x574e,0x69f8,0x4f3d,0x3edd,
565
 
0x11c8,0xbbad,0xca92,0x3e75,
566
 
0xee7a,0x7d97,0x78a4,0x3df7,
567
 
};
568
 
static unsigned short AGD[40] = {
569
 
/*0x0000,0x0000,0x0000,0x3ff0,*/
570
 
0x6b40,0xf3d5,0x9e2b,0x4022,
571
 
0x18d4,0xc0ef,0xd5d5,0x4033,
572
 
0xdc35,0x7ea7,0x211b,0x402f,
573
 
0xdbce,0x2b79,0xe84e,0x4015,
574
 
0xece3,0xc195,0x8992,0x3fee,
575
 
0xa9ee,0xed64,0x221d,0x3fb6,
576
 
0x93bb,0x6be3,0xe704,0x3f70,
577
 
0xa5a0,0xd603,0x8b61,0x3f1a,
578
 
0x24e8,0xdb07,0xa845,0x3eb3,
579
 
0x89d4,0x3dd5,0x1fc7,0x3e35,
580
 
};
581
 
#endif
582
 
#ifdef MIEEE
583
 
static unsigned short AGN[44] = {
584
 
0x3f94,0x3525,0xddcf,0xbbde,
585
 
0x3fd9,0x07d5,0x0064,0x37b7,
586
 
0x3ff1,0x0d83,0x3a20,0x34eb,
587
 
0x3fee,0x0dac,0xa0ef,0x1acb,
588
 
0x3fd6,0x7e69,0xcea8,0xfe1d,
589
 
0x3fb0,0x3a41,0x21e9,0x0978,
590
 
0x3f77,0xfe99,0xf12f,0x5043,
591
 
0x3f32,0x8976,0x600e,0x17a2,
592
 
0x3edd,0x4f3d,0x69f8,0x574e,
593
 
0x3e75,0xca92,0xbbad,0x11c8,
594
 
0x3df7,0x78a4,0x7d97,0xee7a,
595
 
};
596
 
static unsigned short AGD[40] = {
597
 
/*0x3ff0,0x0000,0x0000,0x0000,*/
598
 
0x4022,0x9e2b,0xf3d5,0x6b40,
599
 
0x4033,0xd5d5,0xc0ef,0x18d4,
600
 
0x402f,0x211b,0x7ea7,0xdc35,
601
 
0x4015,0xe84e,0x2b79,0xdbce,
602
 
0x3fee,0x8992,0xc195,0xece3,
603
 
0x3fb6,0x221d,0xed64,0xa9ee,
604
 
0x3f70,0xe704,0x6be3,0x93bb,
605
 
0x3f1a,0x8b61,0xd603,0xa5a0,
606
 
0x3eb3,0xa845,0xdb07,0x24e8,
607
 
0x3e35,0x1fc7,0x3dd5,0x89d4,
608
 
};
609
 
#endif
610
 
 
611
 
#ifdef UNK
612
 
static double APFN[9] = {
613
 
  1.85365624022535566142E-1,
614
 
  8.86712188052584095637E-1,
615
 
  9.87391981747398547272E-1,
616
 
  4.01241082318003734092E-1,
617
 
  7.10304926289631174579E-2,
618
 
  5.90618657995661810071E-3,
619
 
  2.33051409401776799569E-4,
620
 
  4.08718778289035454598E-6,
621
 
  2.48379932900442457853E-8,
622
 
};
623
 
static double APFD[9] = {
624
 
/*  1.00000000000000000000E0,*/
625
 
  1.47345854687502542552E1,
626
 
  3.75423933435489594466E1,
627
 
  3.14657751203046424330E1,
628
 
  1.09969125207298778536E1,
629
 
  1.78885054766999417817E0,
630
 
  1.41733275753662636873E-1,
631
 
  5.44066067017226003627E-3,
632
 
  9.39421290654511171663E-5,
633
 
  5.65978713036027009243E-7,
634
 
};
635
 
#endif
636
 
#ifdef DEC
637
 
static unsigned short APFN[36] = {
638
 
0037475,0150174,0071752,0166651,
639
 
0040142,0177621,0164246,0101757,
640
 
0040174,0142670,0106760,0006573,
641
 
0037715,0067570,0116274,0022404,
642
 
0037221,0074157,0053341,0117207,
643
 
0036301,0104257,0015075,0004777,
644
 
0035164,0057502,0164034,0001313,
645
 
0033611,0022254,0176000,0112565,
646
 
0031725,0055523,0025153,0166057,
647
 
};
648
 
static unsigned short APFD[36] = {
649
 
/*0040200,0000000,0000000,0000000,*/
650
 
0041153,0140334,0130506,0061402,
651
 
0041426,0025551,0024440,0070611,
652
 
0041373,0134750,0047147,0176702,
653
 
0041057,0171532,0105430,0017674,
654
 
0040344,0174416,0001726,0047754,
655
 
0037421,0021207,0020167,0136264,
656
 
0036262,0043621,0151321,0124324,
657
 
0034705,0001313,0163733,0016407,
658
 
0033027,0166702,0150440,0170561,
659
 
};
660
 
#endif
661
 
#ifdef IBMPC
662
 
static unsigned short APFN[36] = {
663
 
0x5db5,0x8e7d,0xba0f,0x3fc7,
664
 
0xd07e,0x3d14,0x5ff2,0x3fec,
665
 
0x01af,0x11be,0x98b7,0x3fef,
666
 
0x84a1,0x1397,0xadef,0x3fd9,
667
 
0x33d1,0xeadc,0x2f0d,0x3fb2,
668
 
0xa140,0xe347,0x3115,0x3f78,
669
 
0x8059,0x5d03,0x8be8,0x3f2e,
670
 
0x12af,0x9f80,0x2495,0x3ed1,
671
 
0x7d86,0x654d,0xab6a,0x3e5a,
672
 
};
673
 
static unsigned short APFD[36] = {
674
 
/*0x0000,0x0000,0x0000,0x3ff0,*/
675
 
0xcc60,0x9628,0x781b,0x402d,
676
 
0x0e31,0x2524,0xc56d,0x4042,
677
 
0xffb8,0x09cc,0x773d,0x403f,
678
 
0x03f7,0x5163,0xfe6b,0x4025,
679
 
0xc9fd,0xc07a,0x9f21,0x3ffc,
680
 
0xf796,0xe40e,0x2450,0x3fc2,
681
 
0x351a,0x3a5a,0x48f2,0x3f76,
682
 
0x63a1,0x7cfb,0xa059,0x3f18,
683
 
0x1e2e,0x5a24,0xfdb8,0x3ea2,
684
 
};
685
 
#endif
686
 
#ifdef MIEEE
687
 
static unsigned short APFN[36] = {
688
 
0x3fc7,0xba0f,0x8e7d,0x5db5,
689
 
0x3fec,0x5ff2,0x3d14,0xd07e,
690
 
0x3fef,0x98b7,0x11be,0x01af,
691
 
0x3fd9,0xadef,0x1397,0x84a1,
692
 
0x3fb2,0x2f0d,0xeadc,0x33d1,
693
 
0x3f78,0x3115,0xe347,0xa140,
694
 
0x3f2e,0x8be8,0x5d03,0x8059,
695
 
0x3ed1,0x2495,0x9f80,0x12af,
696
 
0x3e5a,0xab6a,0x654d,0x7d86,
697
 
};
698
 
static unsigned short APFD[36] = {
699
 
/*0x3ff0,0x0000,0x0000,0x0000,*/
700
 
0x402d,0x781b,0x9628,0xcc60,
701
 
0x4042,0xc56d,0x2524,0x0e31,
702
 
0x403f,0x773d,0x09cc,0xffb8,
703
 
0x4025,0xfe6b,0x5163,0x03f7,
704
 
0x3ffc,0x9f21,0xc07a,0xc9fd,
705
 
0x3fc2,0x2450,0xe40e,0xf796,
706
 
0x3f76,0x48f2,0x3a5a,0x351a,
707
 
0x3f18,0xa059,0x7cfb,0x63a1,
708
 
0x3ea2,0xfdb8,0x5a24,0x1e2e,
709
 
};
710
 
#endif
711
 
 
712
 
#ifdef UNK
713
 
static double APGN[11] = {
714
 
-3.55615429033082288335E-2,
715
 
-6.37311518129435504426E-1,
716
 
-1.70856738884312371053E0,
717
 
-1.50221872117316635393E0,
718
 
-5.63606665822102676611E-1,
719
 
-1.02101031120216891789E-1,
720
 
-9.48396695961445269093E-3,
721
 
-4.60325307486780994357E-4,
722
 
-1.14300836484517375919E-5,
723
 
-1.33415518685547420648E-7,
724
 
-5.63803833958893494476E-10,
725
 
};
726
 
static double APGD[11] = {
727
 
/*  1.00000000000000000000E0,*/
728
 
  9.85865801696130355144E0,
729
 
  2.16401867356585941885E1,
730
 
  1.73130776389749389525E1,
731
 
  6.17872175280828766327E0,
732
 
  1.08848694396321495475E0,
733
 
  9.95005543440888479402E-2,
734
 
  4.78468199683886610842E-3,
735
 
  1.18159633322838625562E-4,
736
 
  1.37480673554219441465E-6,
737
 
  5.79912514929147598821E-9,
738
 
};
739
 
#endif
740
 
#ifdef DEC
741
 
static unsigned short APGN[44] = {
742
 
0137021,0124372,0176075,0075331,
743
 
0140043,0023330,0177672,0161655,
744
 
0140332,0131126,0010413,0171112,
745
 
0140300,0044263,0175560,0054070,
746
 
0140020,0044206,0142603,0073324,
747
 
0137321,0015130,0066144,0144033,
748
 
0136433,0061243,0175542,0103373,
749
 
0135361,0053721,0020441,0053203,
750
 
0134077,0141725,0160277,0130612,
751
 
0132417,0040372,0100363,0060200,
752
 
0130432,0175052,0171064,0034147,
753
 
};
754
 
static unsigned short APGD[40] = {
755
 
/*0040200,0000000,0000000,0000000,*/
756
 
0041035,0136420,0030124,0140220,
757
 
0041255,0017432,0034447,0162256,
758
 
0041212,0100456,0154544,0006321,
759
 
0040705,0134026,0127154,0123414,
760
 
0040213,0051612,0044470,0172607,
761
 
0037313,0143362,0053273,0157051,
762
 
0036234,0144322,0054536,0007264,
763
 
0034767,0146170,0054265,0170342,
764
 
0033270,0102777,0167362,0073631,
765
 
0031307,0040644,0167103,0021763,
766
 
};
767
 
#endif
768
 
#ifdef IBMPC
769
 
static unsigned short APGN[44] = {
770
 
0xaf5b,0x5f87,0x351f,0xbfa2,
771
 
0x5c76,0x1ff7,0x64db,0xbfe4,
772
 
0x7e49,0xc221,0x564a,0xbffb,
773
 
0x0b07,0x7f6e,0x0916,0xbff8,
774
 
0x6edb,0xd8b0,0x0910,0xbfe2,
775
 
0x9903,0x0d8c,0x234b,0xbfba,
776
 
0x50df,0x7f6c,0x6c54,0xbf83,
777
 
0x2ad0,0x2424,0x2afa,0xbf3e,
778
 
0xf631,0xbc17,0xf87a,0xbee7,
779
 
0x6c10,0x501e,0xe81f,0xbe81,
780
 
0x870d,0x5e46,0x5f45,0xbe03,
781
 
};
782
 
static unsigned short APGD[40] = {
783
 
/*0x0000,0x0000,0x0000,0x3ff0,*/
784
 
0x9812,0x060a,0xb7a2,0x4023,
785
 
0xfc96,0x4724,0xa3e3,0x4035,
786
 
0x819a,0xdb2c,0x5025,0x4031,
787
 
0x94e2,0xd5cd,0xb702,0x4018,
788
 
0x1eb1,0x4927,0x6a71,0x3ff1,
789
 
0x7bc5,0x4ad7,0x78de,0x3fb9,
790
 
0xc1d7,0x4b2b,0x991a,0x3f73,
791
 
0xbe1c,0x0b16,0xf98f,0x3f1e,
792
 
0x4ef3,0xfdde,0x10bf,0x3eb7,
793
 
0x647e,0x9dc8,0xe834,0x3e38,
794
 
};
795
 
#endif
796
 
#ifdef MIEEE
797
 
static unsigned short APGN[44] = {
798
 
0xbfa2,0x351f,0x5f87,0xaf5b,
799
 
0xbfe4,0x64db,0x1ff7,0x5c76,
800
 
0xbffb,0x564a,0xc221,0x7e49,
801
 
0xbff8,0x0916,0x7f6e,0x0b07,
802
 
0xbfe2,0x0910,0xd8b0,0x6edb,
803
 
0xbfba,0x234b,0x0d8c,0x9903,
804
 
0xbf83,0x6c54,0x7f6c,0x50df,
805
 
0xbf3e,0x2afa,0x2424,0x2ad0,
806
 
0xbee7,0xf87a,0xbc17,0xf631,
807
 
0xbe81,0xe81f,0x501e,0x6c10,
808
 
0xbe03,0x5f45,0x5e46,0x870d,
809
 
};
810
 
static unsigned short APGD[40] = {
811
 
/*0x3ff0,0x0000,0x0000,0x0000,*/
812
 
0x4023,0xb7a2,0x060a,0x9812,
813
 
0x4035,0xa3e3,0x4724,0xfc96,
814
 
0x4031,0x5025,0xdb2c,0x819a,
815
 
0x4018,0xb702,0xd5cd,0x94e2,
816
 
0x3ff1,0x6a71,0x4927,0x1eb1,
817
 
0x3fb9,0x78de,0x4ad7,0x7bc5,
818
 
0x3f73,0x991a,0x4b2b,0xc1d7,
819
 
0x3f1e,0xf98f,0x0b16,0xbe1c,
820
 
0x3eb7,0x10bf,0xfdde,0x4ef3,
821
 
0x3e38,0xe834,0x9dc8,0x647e,
822
 
};
823
 
#endif
824
 
 
825
 
#ifdef ANSIPROT
826
 
extern double fabs ( double );
827
 
extern double exp ( double );
828
 
extern double sqrt ( double );
829
 
extern double polevl ( double, void *, int );
830
 
extern double p1evl ( double, void *, int );
831
 
extern double sin ( double );
832
 
extern double cos ( double );
833
 
#else
834
 
double fabs(), exp(), sqrt();
835
 
double polevl(), p1evl(), sin(), cos();
836
 
#endif
837
 
 
838
 
int airy( x, ai, aip, bi, bip )
839
 
double x, *ai, *aip, *bi, *bip;
840
 
{
841
 
double z, zz, t, f, g, uf, ug, k, zeta, theta;
842
 
int domflg;
843
 
 
844
 
domflg = 0;
845
 
if( x > MAXAIRY )
846
 
        {
847
 
        *ai = 0;
848
 
        *aip = 0;
849
 
        *bi = MAXNUM;
850
 
        *bip = MAXNUM;
851
 
        return(-1);
852
 
        }
853
 
 
854
 
if( x < -2.09 )
855
 
        {
856
 
        domflg = 15;
857
 
        t = sqrt(-x);
858
 
        zeta = -2.0 * x * t / 3.0;
859
 
        t = sqrt(t);
860
 
        k = sqpii / t;
861
 
        z = 1.0/zeta;
862
 
        zz = z * z;
863
 
        uf = 1.0 + zz * polevl( zz, AFN, 8 ) / p1evl( zz, AFD, 9 );
864
 
        ug = z * polevl( zz, AGN, 10 ) / p1evl( zz, AGD, 10 );
865
 
        theta = zeta + 0.25 * PI;
866
 
        f = sin( theta );
867
 
        g = cos( theta );
868
 
        *ai = k * (f * uf - g * ug);
869
 
        *bi = k * (g * uf + f * ug);
870
 
        uf = 1.0 + zz * polevl( zz, APFN, 8 ) / p1evl( zz, APFD, 9 );
871
 
        ug = z * polevl( zz, APGN, 10 ) / p1evl( zz, APGD, 10 );
872
 
        k = sqpii * t;
873
 
        *aip = -k * (g * uf + f * ug);
874
 
        *bip = k * (f * uf - g * ug);
875
 
        return(0);
876
 
        }
877
 
 
878
 
if( x >= 2.09 ) /* cbrt(9) */
879
 
        {
880
 
        domflg = 5;
881
 
        t = sqrt(x);
882
 
        zeta = 2.0 * x * t / 3.0;
883
 
        g = exp( zeta );
884
 
        t = sqrt(t);
885
 
        k = 2.0 * t * g;
886
 
        z = 1.0/zeta;
887
 
        f = polevl( z, AN, 7 ) / polevl( z, AD, 7 );
888
 
        *ai = sqpii * f / k;
889
 
        k = -0.5 * sqpii * t / g;
890
 
        f = polevl( z, APN, 7 ) / polevl( z, APD, 7 );
891
 
        *aip = f * k;
892
 
 
893
 
        if( x > 8.3203353 )     /* zeta > 16 */
894
 
                {
895
 
                f = z * polevl( z, BN16, 4 ) / p1evl( z, BD16, 5 );
896
 
                k = sqpii * g;
897
 
                *bi = k * (1.0 + f) / t;
898
 
                f = z * polevl( z, BPPN, 4 ) / p1evl( z, BPPD, 5 );
899
 
                *bip = k * t * (1.0 + f);
900
 
                return(0);
901
 
                }
902
 
        }
903
 
 
904
 
f = 1.0;
905
 
g = x;
906
 
t = 1.0;
907
 
uf = 1.0;
908
 
ug = x;
909
 
k = 1.0;
910
 
z = x * x * x;
911
 
while( t > MACHEP )
912
 
        {
913
 
        uf *= z;
914
 
        k += 1.0;
915
 
        uf /=k;
916
 
        ug *= z;
917
 
        k += 1.0;
918
 
        ug /=k;
919
 
        uf /=k;
920
 
        f += uf;
921
 
        k += 1.0;
922
 
        ug /=k;
923
 
        g += ug;
924
 
        t = fabs(uf/f);
925
 
        }
926
 
uf = c1 * f;
927
 
ug = c2 * g;
928
 
if( (domflg & 1) == 0 )
929
 
        *ai = uf - ug;
930
 
if( (domflg & 2) == 0 )
931
 
        *bi = sqrt3 * (uf + ug);
932
 
 
933
 
/* the deriviative of ai */
934
 
k = 4.0;
935
 
uf = x * x/2.0;
936
 
ug = z/3.0;
937
 
f = uf;
938
 
g = 1.0 + ug;
939
 
uf /= 3.0;
940
 
t = 1.0;
941
 
 
942
 
while( t > MACHEP )
943
 
        {
944
 
        uf *= z;
945
 
        ug /=k;
946
 
        k += 1.0;
947
 
        ug *= z;
948
 
        uf /=k;
949
 
        f += uf;
950
 
        k += 1.0;
951
 
        ug /=k;
952
 
        uf /=k;
953
 
        g += ug;
954
 
        k += 1.0;
955
 
        t = fabs(ug/g);
956
 
        }
957
 
 
958
 
uf = c1 * f;
959
 
ug = c2 * g;
960
 
if( (domflg & 4) == 0 )
961
 
        *aip = uf - ug;
962
 
if( (domflg & 8) == 0 )
963
 
        *bip = sqrt3 * (uf + ug);
964
 
return(0);
965
 
}