📄 airy.c
字号:
/* airy.c * * Airy function * * * * SYNOPSIS: * * double x, ai, aip, bi, bip; * int airy(); * * airy( x, _&ai, _&aip, _&bi, _&bip ); * * * * DESCRIPTION: * * Solution of the differential equation * * y"(x) = xy. * * The function returns the two independent solutions Ai, Bi * and their first derivatives Ai'(x), Bi'(x). * * Evaluation is by power series summation for small x, * by rational minimax approximations for large x. * * * * ACCURACY: * Error criterion is absolute when function <= 1, relative * when function > 1, except * denotes relative error criterion. * For large negative x, the absolute error increases as x^1.5. * For large positive x, the relative error increases as x^1.5. * * Arithmetic domain function # trials peak rms * IEEE -10, 0 Ai 10000 1.6e-15 2.7e-16 * IEEE 0, 10 Ai 10000 2.3e-14* 1.8e-15* * IEEE -10, 0 Ai' 10000 4.6e-15 7.6e-16 * IEEE 0, 10 Ai' 10000 1.8e-14* 1.5e-15* * IEEE -10, 10 Bi 30000 4.2e-15 5.3e-16 * IEEE -10, 10 Bi' 30000 4.9e-15 7.3e-16 * DEC -10, 0 Ai 5000 1.7e-16 2.8e-17 * DEC 0, 10 Ai 5000 2.1e-15* 1.7e-16* * DEC -10, 0 Ai' 5000 4.7e-16 7.8e-17 * DEC 0, 10 Ai' 12000 1.8e-15* 1.5e-16* * DEC -10, 10 Bi 10000 5.5e-16 6.8e-17 * DEC -10, 10 Bi' 7000 5.3e-16 8.7e-17 * *//* airy.c *//*Cephes Math Library Release 2.8: June, 2000Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier*/#include <math.h>static double c1 = 0.35502805388781723926;static double c2 = 0.258819403792806798405;static double sqrt3 = 1.732050807568877293527;static double sqpii = 5.64189583547756286948E-1;extern double PI;extern double MAXNUM, MACHEP;#ifdef UNK#define MAXAIRY 25.77#endif#ifdef DEC#define MAXAIRY 25.77#endif#ifdef IBMPC#define MAXAIRY 103.892#endif#ifdef MIEEE#define MAXAIRY 103.892#endif#ifdef UNKstatic double AN[8] = { 3.46538101525629032477E-1, 1.20075952739645805542E1, 7.62796053615234516538E1, 1.68089224934630576269E2, 1.59756391350164413639E2, 7.05360906840444183113E1, 1.40264691163389668864E1, 9.99999999999999995305E-1,};static double AD[8] = { 5.67594532638770212846E-1, 1.47562562584847203173E1, 8.45138970141474626562E1, 1.77318088145400459522E2, 1.64234692871529701831E2, 7.14778400825575695274E1, 1.40959135607834029598E1, 1.00000000000000000470E0,};#endif#ifdef DECstatic unsigned short AN[32] = {0037661,0066561,0024675,0131301,0041100,0017434,0034324,0101466,0041630,0107450,0067427,0007430,0042050,0013327,0071000,0034737,0042037,0140642,0156417,0167366,0041615,0011172,0075147,0051165,0041140,0066152,0160520,0075146,0040200,0000000,0000000,0000000,};static unsigned short AD[32] = {0040021,0046740,0011422,0064606,0041154,0014640,0024631,0062450,0041651,0003435,0101152,0106401,0042061,0050556,0034605,0136602,0042044,0036024,0152377,0151414,0041616,0172247,0072216,0115374,0041141,0104334,0124154,0166007,0040200,0000000,0000000,0000000,};#endif#ifdef IBMPCstatic unsigned short AN[32] = {0xb658,0x2537,0x2dae,0x3fd6,0x9067,0x871a,0x03e3,0x4028,0xe1e3,0x0de2,0x11e5,0x4053,0x073c,0xee40,0x02da,0x4065,0xfddf,0x5ba1,0xf834,0x4063,0xea4f,0x4f4c,0xa24f,0x4051,0x0f4d,0x5c2a,0x0d8d,0x402c,0x0000,0x0000,0x0000,0x3ff0,};static unsigned short AD[32] = {0x4d31,0x0262,0x29bc,0x3fe2,0x2ca5,0x0533,0x8334,0x402d,0x51a0,0xb04d,0x20e3,0x4055,0xb7b0,0xc730,0x2a2d,0x4066,0xfa61,0x9a9f,0x8782,0x4064,0xd35f,0xee91,0xde94,0x4051,0x9d81,0x950d,0x311b,0x402c,0x0000,0x0000,0x0000,0x3ff0,};#endif#ifdef MIEEEstatic unsigned short AN[32] = {0x3fd6,0x2dae,0x2537,0xb658,0x4028,0x03e3,0x871a,0x9067,0x4053,0x11e5,0x0de2,0xe1e3,0x4065,0x02da,0xee40,0x073c,0x4063,0xf834,0x5ba1,0xfddf,0x4051,0xa24f,0x4f4c,0xea4f,0x402c,0x0d8d,0x5c2a,0x0f4d,0x3ff0,0x0000,0x0000,0x0000,};static unsigned short AD[32] = {0x3fe2,0x29bc,0x0262,0x4d31,0x402d,0x8334,0x0533,0x2ca5,0x4055,0x20e3,0xb04d,0x51a0,0x4066,0x2a2d,0xc730,0xb7b0,0x4064,0x8782,0x9a9f,0xfa61,0x4051,0xde94,0xee91,0xd35f,0x402c,0x311b,0x950d,0x9d81,0x3ff0,0x0000,0x0000,0x0000,};#endif#ifdef UNKstatic double APN[8] = { 6.13759184814035759225E-1, 1.47454670787755323881E1, 8.20584123476060982430E1, 1.71184781360976385540E2, 1.59317847137141783523E2, 6.99778599330103016170E1, 1.39470856980481566958E1, 1.00000000000000000550E0,};static double APD[8] = { 3.34203677749736953049E-1, 1.11810297306158156705E1, 7.11727352147859965283E1, 1.58778084372838313640E2, 1.53206427475809220834E2, 6.86752304592780337944E1, 1.38498634758259442477E1, 9.99999999999999994502E-1,};#endif#ifdef DECstatic unsigned short APN[32] = {0040035,0017522,0065145,0054755,0041153,0166556,0161471,0057174,0041644,0016750,0034445,0046462,0042053,0027515,0152316,0046717,0042037,0050536,0067023,0023264,0041613,0172252,0007240,0131055,0041137,0023503,0052472,0002305,0040200,0000000,0000000,0000000,};static unsigned short APD[32] = {0037653,0016276,0112106,0126625,0041062,0162577,0067111,0111761,0041616,0054160,0140004,0137455,0042036,0143460,0104626,0157206,0042031,0032330,0067131,0114260,0041611,0054667,0147207,0134564,0041135,0114412,0070653,0146015,0040200,0000000,0000000,0000000,};#endif#ifdef IBMPCstatic unsigned short APN[32] = {0xab3e,0x4d4c,0xa3ea,0x3fe3,0x2bcf,0xdc67,0x7dad,0x402d,0xa9a6,0x0724,0x83bd,0x4054,0xc9ba,0xba99,0x65e9,0x4065,0x64d7,0xcdc2,0xea2b,0x4063,0x1646,0x41d4,0x7e95,0x4051,0x4099,0x6aa7,0xe4e8,0x402b,0x0000,0x0000,0x0000,0x3ff0,};static unsigned short APD[32] = {0xd5b3,0xd288,0x6397,0x3fd5,0x327e,0xedc9,0x5caf,0x4026,0x97e6,0x1800,0xcb0e,0x4051,0xdbd1,0x1132,0xd8e6,0x4063,0x3316,0x0dcb,0x269b,0x4063,0xf72f,0xf9d0,0x2b36,0x4051,0x7982,0x4e35,0xb321,0x402b,0x0000,0x0000,0x0000,0x3ff0,};#endif#ifdef MIEEEstatic unsigned short APN[32] = {0x3fe3,0xa3ea,0x4d4c,0xab3e,0x402d,0x7dad,0xdc67,0x2bcf,0x4054,0x83bd,0x0724,0xa9a6,0x4065,0x65e9,0xba99,0xc9ba,0x4063,0xea2b,0xcdc2,0x64d7,0x4051,0x7e95,0x41d4,0x1646,0x402b,0xe4e8,0x6aa7,0x4099,0x3ff0,0x0000,0x0000,0x0000,};static unsigned short APD[32] = {0x3fd5,0x6397,0xd288,0xd5b3,0x4026,0x5caf,0xedc9,0x327e,0x4051,0xcb0e,0x1800,0x97e6,0x4063,0xd8e6,0x1132,0xdbd1,0x4063,0x269b,0x0dcb,0x3316,0x4051,0x2b36,0xf9d0,0xf72f,0x402b,0xb321,0x4e35,0x7982,0x3ff0,0x0000,0x0000,0x0000,};#endif#ifdef UNKstatic double BN16[5] = {-2.53240795869364152689E-1, 5.75285167332467384228E-1,-3.29907036873225371650E-1, 6.44404068948199951727E-2,-3.82519546641336734394E-3,};static double BD16[5] = {/* 1.00000000000000000000E0,*/-7.15685095054035237902E0, 1.06039580715664694291E1,-5.23246636471251500874E0, 9.57395864378383833152E-1,-5.50828147163549611107E-2,};#endif#ifdef DECstatic unsigned short BN16[20] = {0137601,0124307,0010213,0035210,0040023,0042743,0101621,0016031,0137650,0164623,0036056,0074511,0037203,0174525,0000473,0142474,0136172,0130041,0066726,0064324,};static unsigned short BD16[20] = {/*0040200,0000000,0000000,0000000,*/0140745,0002354,0044335,0055276,0041051,0124717,0170130,0104013,0140647,0070135,0046473,0103501,0040165,0013745,0033324,0127766,0137141,0117204,0076164,0033107,};#endif#ifdef IBMPCstatic unsigned short BN16[20] = {0x6751,0xe211,0x3518,0xbfd0,0x2383,0x7072,0x68bc,0x3fe2,0xcf29,0x6785,0x1d32,0xbfd5,0x78a8,0xa027,0x7f2a,0x3fb0,0xcd1b,0x2dba,0x5604,0xbf6f,};static unsigned short BD16[20] = {/*0x0000,0x0000,0x0000,0x3ff0,*/0xab58,0x891b,0xa09d,0xc01c,0x1101,0xfe0b,0x3539,0x4025,0x70e8,0xa9a7,0xee0b,0xc014,0x95ff,0xa6da,0xa2fc,0x3fee,0x86c9,0x8f8e,0x33d0,0xbfac,};#endif#ifdef MIEEEstatic unsigned short BN16[20] = {0xbfd0,0x3518,0xe211,0x6751,0x3fe2,0x68bc,0x7072,0x2383,0xbfd5,0x1d32,0x6785,0xcf29,0x3fb0,0x7f2a,0xa027,0x78a8,0xbf6f,0x5604,0x2dba,0xcd1b,};static unsigned short BD16[20] = {/*0x3ff0,0x0000,0x0000,0x0000,*/0xc01c,0xa09d,0x891b,0xab58,0x4025,0x3539,0xfe0b,0x1101,0xc014,0xee0b,0xa9a7,0x70e8,0x3fee,0xa2fc,0xa6da,0x95ff,0xbfac,0x33d0,0x8f8e,0x86c9,};#endif#ifdef UNKstatic double BPPN[5] = { 4.65461162774651610328E-1,-1.08992173800493920734E0, 6.38800117371827987759E-1,-1.26844349553102907034E-1, 7.62487844342109852105E-3,};static double BPPD[5] = {/* 1.00000000000000000000E0,*/-8.70622787633159124240E0, 1.38993162704553213172E1,-7.14116144616431159572E0, 1.34008595960680518666E0,-7.84273211323341930448E-2,};#endif#ifdef DECstatic unsigned short BPPN[20] = {0037756,0050354,0167531,0135731,0140213,0101216,0032767,0020375,0040043,0104147,0106312,0177632,0137401,0161574,0032015,0043714,0036371,0155035,0143165,0142262,};static unsigned short BPPD[20] = {/*0040200,0000000,0000000,0000000,*/0141013,0046265,0115005,0161053,0041136,0061631,0072445,0156131,0140744,0102145,0001127,0065304,0040253,0103757,0146453,0102513,0137240,0117200,0155402,0113500,};#endif#ifdef IBMPCstatic unsigned short BPPN[20] = {0x377b,0x9deb,0xca1d,0x3fdd,0xe420,0xc6be,0x7051,0xbff1,0x5ff3,0xf199,0x710c,0x3fe4,0xa8fa,0x8681,0x3c6f,0xbfc0,0xb896,0xb8ce,0x3b43,0x3f7f,};static unsigned short BPPD[20] = {/*0x0000,0x0000,0x0000,0x3ff0,*/0xbc45,0xb340,0x6996,0xc021,0xbb8b,0x2ea4,0xcc73,0x402b,0xed59,0xa04a,0x908c,0xc01c,0x70a9,0xf9a5,0x70fd,0x3ff5,0x52e8,0x1b60,0x13d0,0xbfb4,};#endif#ifdef MIEEEstatic unsigned short BPPN[20] = {0x3fdd,0xca1d,0x9deb,0x377b,0xbff1,0x7051,0xc6be,0xe420,0x3fe4,0x710c,0xf199,0x5ff3,0xbfc0,0x3c6f,0x8681,0xa8fa,0x3f7f,0x3b43,0xb8ce,0xb896,};static unsigned short BPPD[20] = {/*0x3ff0,0x0000,0x0000,0x0000,*/0xc021,0x6996,0xb340,0xbc45,0x402b,0xcc73,0x2ea4,0xbb8b,0xc01c,0x908c,0xa04a,0xed59,0x3ff5,0x70fd,0xf9a5,0x70a9,0xbfb4,0x13d0,0x1b60,0x52e8,};#endif#ifdef UNKstatic double AFN[9] = {-1.31696323418331795333E-1,-6.26456544431912369773E-1,-6.93158036036933542233E-1,-2.79779981545119124951E-1,-4.91900132609500318020E-2,-4.06265923594885404393E-3,-1.59276496239262096340E-4,-2.77649108155232920844E-6,-1.67787698489114633780E-8,};static double AFD[9] = {/* 1.00000000000000000000E0,*/ 1.33560420706553243746E1, 3.26825032795224613948E1, 2.67367040941499554804E1, 9.18707402907259625840E0, 1.47529146771666414581E0, 1.15687173795188044134E-1, 4.40291641615211203805E-3, 7.54720348287414296618E-5, 4.51850092970580378464E-7,};#endif#ifdef DECstatic unsigned short AFN[36] = {0137406,0155546,0124127,0033732,0140040,0057564,0141263,0041222,0140061,0071316,0013674,0175754,0137617,0037522,0056637,0120130,0137111,0075567,0121755,0166122,0136205,0020016,0043317,0002201,0135047,0001565,0075130,0002334,0133472,0051700,0165021,0131551,0131620,0020347,0132165,0013215,};static unsigned short AFD[36] = {/*0040200,0000000,0000000,0000000,*/0041125,0131131,0025627,0067623,0041402,0135342,0021703,0154315,0041325,0162305,0016671,0120175,0041022,0177101,0053114,0141632,0040274,0153131,0147364,0114306,0037354,0166545,0120042,0150530,0036220,0043127,0000727,0130273,0034636,0043275,0075667,0034733,0032762,0112715,0146250,0142474,};#endif#ifdef IBMPCstatic unsigned short AFN[36] = {0xe6fb,0xd50a,0xdb6c,0xbfc0,0x6852,0x9856,0x0bee,0xbfe4,0x9f7d,0xc2f7,0x2e59,0xbfe6,0xf40b,0x4bb3,0xe7ea,0xbfd1,0xbd8a,0xf47d,0x2f6e,0xbfa9,0xe090,0xc8d9,0xa401,0xbf70,0x009c,0xaf4b,0xe06e,0xbf24,0x366d,0x1d42,0x4a78,0xbec7,0xa2d2,0xf68e,0x041c,0xbe52,};static unsigned short AFD[36] = {/*0x0000,0x0000,0x0000,0x3ff0,*/0xedf2,0x2572,0xb64b,0x402a,0x7b1a,0x4478,0x575c,0x4040,0x3410,0xa3b7,0xbc98,0x403a,0x9873,0x2ac9,0x5fc8,0x4022,0x9319,0x39de,0x9acb,0x3ff7,0x5a2b,0xb404,0x9dac,0x3fbd,0xf617,0xe03a,0x08ca,0x3f72,0xe73b,0xaf76,0xc8d7,0x3f13,0x18a7,0xb995,0x52b9,0x3e9e,};#endif#ifdef MIEEEstatic unsigned short AFN[36] = {0xbfc0,0xdb6c,0xd50a,0xe6fb,0xbfe4,0x0bee,0x9856,0x6852,0xbfe6,0x2e59,0xc2f7,0x9f7d,0xbfd1,0xe7ea,0x4bb3,0xf40b,0xbfa9,0x2f6e,0xf47d,0xbd8a,0xbf70,0xa401,0xc8d9,0xe090,0xbf24,0xe06e,0xaf4b,0x009c,0xbec7,0x4a78,0x1d42,0x366d,0xbe52,0x041c,0xf68e,0xa2d2,};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -