| 1 | ;; Airy functions |
|---|
| 2 | ;; Liam Healy, Fri Mar 17 2006 - 18:41 |
|---|
| 3 | ;; Time-stamp: <2008-02-16 17:57:19EST airy.lisp> |
|---|
| 4 | ;; $Id$ |
|---|
| 5 | |
|---|
| 6 | (in-package :gsl) |
|---|
| 7 | |
|---|
| 8 | ;;;;**************************************************************************** |
|---|
| 9 | ;;;; Airy functions |
|---|
| 10 | ;;;;**************************************************************************** |
|---|
| 11 | |
|---|
| 12 | (defmfun airy-Ai (x) |
|---|
| 13 | "gsl_sf_airy_Ai_e" ((x :double) :mode (ret sf-result)) |
|---|
| 14 | :documentation ; FDL |
|---|
| 15 | "The Airy function Ai(x).") |
|---|
| 16 | |
|---|
| 17 | (defmfun airy-Bi (x) |
|---|
| 18 | "gsl_sf_airy_Bi_e" ((x :double) :mode (ret sf-result)) |
|---|
| 19 | :documentation ; FDL |
|---|
| 20 | "The Airy function Bi(x).") |
|---|
| 21 | |
|---|
| 22 | (defmfun airy-Ai-scaled (x) |
|---|
| 23 | "gsl_sf_airy_Ai_scaled_e" ((x :double) :mode (ret sf-result)) |
|---|
| 24 | :documentation ; FDL |
|---|
| 25 | "The scaled Airy function S_A(x) Ai(x). |
|---|
| 26 | For x>0 the scaling factor S_A(x) is \exp(+(2/3) x^(3/2)), |
|---|
| 27 | and is 1 for x<0.") |
|---|
| 28 | |
|---|
| 29 | (defmfun airy-Bi-scaled (x) |
|---|
| 30 | "gsl_sf_airy_Bi_scaled_e" ((x :double) :mode (ret sf-result)) |
|---|
| 31 | :documentation ; FDL |
|---|
| 32 | "The scaled Airy function S_B(x) Bi(x). |
|---|
| 33 | For x>0 the scaling factor S_B(x) is exp(-(2/3) x^(3/2)), |
|---|
| 34 | and is 1 for x<0.") |
|---|
| 35 | |
|---|
| 36 | (defmfun airy-Ai-deriv (x) |
|---|
| 37 | "gsl_sf_airy_Ai_deriv_e" ((x :double) :mode (ret sf-result)) |
|---|
| 38 | :documentation ; FDL |
|---|
| 39 | "The Airy function derivative Ai'(x).") |
|---|
| 40 | |
|---|
| 41 | (defmfun airy-Bi-deriv (x) |
|---|
| 42 | "gsl_sf_airy_Bi_deriv_e" ((x :double) :mode (ret sf-result)) |
|---|
| 43 | :documentation "The Airy function derivative Bi'(x).") |
|---|
| 44 | |
|---|
| 45 | (defmfun airy-Ai-deriv-scaled (x) |
|---|
| 46 | "gsl_sf_airy_Ai_deriv_scaled_e" ((x :double) :mode (ret sf-result)) |
|---|
| 47 | :documentation ; FDL |
|---|
| 48 | "The scaled Airy function derivative S_A(x) Ai'(x). |
|---|
| 49 | For x>0 the scaling factor S_A(x) is exp(+(2/3) x^(3/2)), |
|---|
| 50 | and is 1 for x<0.") |
|---|
| 51 | |
|---|
| 52 | (defmfun airy-Bi-deriv-scaled (x) |
|---|
| 53 | "gsl_sf_airy_Bi_deriv_scaled_e" ((x :double) :mode (ret sf-result)) |
|---|
| 54 | :documentation ; FDL |
|---|
| 55 | "The scaled Airy function derivative S_B(x) Bi'(x). |
|---|
| 56 | For x>0 the scaling factor S_B(x) is |
|---|
| 57 | exp(-(2/3) x^(3/2)), and is 1 for x<0.") |
|---|
| 58 | |
|---|
| 59 | (defmfun airy-zero-Ai (s) |
|---|
| 60 | "gsl_sf_airy_zero_Ai_e" ((s size) (ret sf-result)) |
|---|
| 61 | :documentation ; FDL |
|---|
| 62 | "The location of the s-th zero of the Airy function Ai(x).") |
|---|
| 63 | |
|---|
| 64 | (defmfun airy-zero-Bi (s) |
|---|
| 65 | "gsl_sf_airy_zero_Bi_e" ((s size) (ret sf-result)) |
|---|
| 66 | :documentation ; FDL |
|---|
| 67 | "The location of the s-th zero of the Airy function Bi(x).") |
|---|
| 68 | |
|---|
| 69 | (defmfun airy-zero-Ai-deriv (s) |
|---|
| 70 | "gsl_sf_airy_zero_Ai_deriv_e" ((s size) (ret sf-result)) |
|---|
| 71 | :documentation ; FDL |
|---|
| 72 | "The location of the s-th zero of the Airy function derivative Ai'(x).") |
|---|
| 73 | |
|---|
| 74 | (defmfun airy-zero-Bi-deriv (s) |
|---|
| 75 | "gsl_sf_airy_zero_Bi_deriv_e" ((s size) (ret sf-result)) |
|---|
| 76 | :documentation ; FDL |
|---|
| 77 | "The location of the s-th zero of the Airy function derivative Bi'(x).") |
|---|
| 78 | |
|---|
| 79 | ;;;;**************************************************************************** |
|---|
| 80 | ;;;; Examples and unit test |
|---|
| 81 | ;;;;**************************************************************************** |
|---|
| 82 | |
|---|
| 83 | #| |
|---|
| 84 | (make-tests airy |
|---|
| 85 | (airy-ai 2.5d0) |
|---|
| 86 | (airy-bi 2.5d0) |
|---|
| 87 | (airy-ai-scaled 2.5d0) |
|---|
| 88 | (airy-bi-scaled 2.5d0) |
|---|
| 89 | (airy-ai-deriv 2.5d0) |
|---|
| 90 | (airy-bi-deriv 2.5d0) |
|---|
| 91 | (airy-ai-deriv-scaled 2.5d0) |
|---|
| 92 | (airy-bi-deriv-scaled 2.5d0) |
|---|
| 93 | (airy-zero-ai 1) |
|---|
| 94 | (airy-zero-bi 1) |
|---|
| 95 | (airy-zero-ai-deriv 1) |
|---|
| 96 | (airy-zero-bi-deriv 1)) |
|---|
| 97 | |# |
|---|
| 98 | |
|---|
| 99 | (LISP-UNIT:DEFINE-TEST AIRY |
|---|
| 100 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 101 | '(0.01572592338047048d0 2.1573014423586447d-17) |
|---|
| 102 | (MULTIPLE-VALUE-LIST (AIRY-AI 2.5d0))) |
|---|
| 103 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 104 | '(6.48166073846058d0 8.77836191730236d-15) |
|---|
| 105 | (MULTIPLE-VALUE-LIST (AIRY-BI 2.5d0))) |
|---|
| 106 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 107 | '(0.21932220512871203d0 5.966864198455728d-17) |
|---|
| 108 | (MULTIPLE-VALUE-LIST (AIRY-AI-SCALED 2.5d0))) |
|---|
| 109 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 110 | '(0.4647504801960925d0 1.1831869152362144d-16) |
|---|
| 111 | (MULTIPLE-VALUE-LIST (AIRY-BI-SCALED 2.5d0))) |
|---|
| 112 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 113 | '(-0.02625088103590322d0 4.306971270221159d-17) |
|---|
| 114 | (MULTIPLE-VALUE-LIST (AIRY-AI-DERIV 2.5d0))) |
|---|
| 115 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 116 | '(9.421423317334305d0 1.5213125884867257d-14) |
|---|
| 117 | (MULTIPLE-VALUE-LIST (AIRY-BI-DERIV 2.5d0))) |
|---|
| 118 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 119 | '(-0.36610893847516224d0 1.167515239400716d-16) |
|---|
| 120 | (MULTIPLE-VALUE-LIST (AIRY-AI-DERIV-SCALED 2.5d0))) |
|---|
| 121 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 122 | '(0.6755384441644995d0 1.978922049880242d-16) |
|---|
| 123 | (MULTIPLE-VALUE-LIST (AIRY-BI-DERIV-SCALED 2.5d0))) |
|---|
| 124 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 125 | '(-2.338107410459767d0 5.19164136227827d-16) |
|---|
| 126 | (MULTIPLE-VALUE-LIST (AIRY-ZERO-AI 1))) |
|---|
| 127 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 128 | '(-1.173713222709128d0 2.606166888317336d-16) |
|---|
| 129 | (MULTIPLE-VALUE-LIST (AIRY-ZERO-BI 1))) |
|---|
| 130 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 131 | '(-1.018792971647471d0 2.2621748288986134d-16) |
|---|
| 132 | (MULTIPLE-VALUE-LIST (AIRY-ZERO-AI-DERIV 1))) |
|---|
| 133 | (LISP-UNIT::ASSERT-NUMERICAL-EQUAL |
|---|
| 134 | '(-2.294439682614123d0 5.094679528503672d-16) |
|---|
| 135 | (MULTIPLE-VALUE-LIST (AIRY-ZERO-BI-DERIV 1)))) |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | #| |
|---|
| 139 | ;;; Mathematica results |
|---|
| 140 | In[4]:= AiryAi[2.5] |
|---|
| 141 | Out[4]= 0.01572592338047049 |
|---|
| 142 | In[5]:= AiryBi[2.5] |
|---|
| 143 | Out[5]= 6.481660738460579 |
|---|
| 144 | In[6]:= AiryAiPrime[2.5] |
|---|
| 145 | Out[6]= -0.02625088103590323 |
|---|
| 146 | In[7]:= AiryBiPrime[2.5] |
|---|
| 147 | Out[7]= 9.4214233173343 |
|---|
| 148 | |# |
|---|