Ticket #12455: trac_12455-symbolic_airy2.patch

File trac_12455-symbolic_airy2.patch, 22.0 KB (added by olazo, 7 years ago)
  • new file sage/functions/airy.py

    # HG changeset patch
    # User Oscar Gerardo Lazo Arjona <algebraicamente@gmail.com>
    # Date 1329612862 21600
    # Node ID d6faed1b6b7941fbd68218d623779d7dfcdbb6e7
    # Parent  2a2abbcad325ccca9399981ceddf5897eb467e64
    #12455: Make Airy functions symbolic
    
    diff -r 2a2abbcad325 -r d6faed1b6b79 sage/functions/airy.py
    - +  
     1#*****************************************************************************
     2#       Copyright (C) 2010 Oscar Gerardo Lazo Arjona algebraicamente@gmail.com
     3#
     4#  Distributed under the terms of the GNU General Public License (GPL)
     5#
     6#    but WITHOUT ANY WARRANTY; without even the implied warranty of
     7#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     8#    General Public License for more details.
     9#
     10#  The full text of the GPL is available at:
     11#
     12#                  http://www.gnu.org/licenses/
     13#*****************************************************************************
     14
     15from sage.symbolic.function import BuiltinFunction
     16from sage.symbolic.expression import Expression
     17from sage.symbolic.function import is_inexact
     18from sage.structure.coerce import parent
     19
     20from sage.functions.other import gamma
     21from mpmath import airyai as airy_ai_mpmath
     22from mpmath import airybi as airy_bi_mpmath
     23from sage.libs.mpmath import utils as mpmath_utils
     24
     25from sage.calculus.var import var
     26from sage.calculus.functional import derivative
     27
     28from sage.rings.real_mpfr import RR
     29from sage.rings.rational import Rational as R
     30
     31class FunctionAiryAiSimple(BuiltinFunction):
     32    """
     33    The class for the Airy Ai function.
     34
     35    Examples::
     36
     37        sage: airy_ai_simple= FunctionAiryAiSimple()
     38        sage: f=airy_ai_simple(x); f
     39        airy_ai(x)
     40    """
     41    def __init__(self):
     42        BuiltinFunction.__init__(self, "airy_ai", latex_name=r'\operatorname{Ai}',
     43                conversions=dict(mathematica='AiryAi'))
     44
     45    def _derivative_(self, x, diff_param=None):
     46        """
     47        Examples::
     48       
     49            sage: derivative(airy_ai(x),x)
     50            airy_ai_prime(x)
     51        """
     52        return airy_ai_prime(x)
     53
     54    def _eval_(self, x):
     55        """
     56        Examples::
     57       
     58            sage: airy_ai(0)
     59            1/3*3^(1/3)/gamma(2/3)
     60            sage: airy_ai(0.0)
     61            0.355028053887817
     62            sage: airy_ai(I)
     63            airy_ai(I)
     64            sage: airy_ai(1.0*I)
     65            0.331493305432141 - 0.317449858968444*I
     66        """
     67
     68        if not isinstance(x,Expression):
     69            if is_inexact(x):
     70                return self._evalf_(x, parent(x))
     71            elif x==0:
     72                r=R('2/3')
     73                return 1/(3**(r)*gamma(r))
     74        else:
     75            return None
     76
     77    def _evalf_(self, x, parent=None):
     78        """
     79        Examples::
     80       
     81            sage: airy_ai(0.0)
     82            0.355028053887817
     83            sage: airy_ai(1.0*I)
     84            0.331493305432141 - 0.317449858968444*I
     85        """
     86        return mpmath_utils.call(airy_ai_mpmath, x, parent=RR)
     87
     88class FunctionAiryAiPrime(BuiltinFunction):
     89    """
     90    The derivative of the Airy Ai function.
     91
     92    Examples::
     93
     94        sage: x,n=var('x n')
     95        sage: airy_ai_prime(x)
     96        airy_ai_prime(x)
     97        sage: airy_ai_prime(0)
     98        -1/3*3^(2/3)/gamma(1/3)
     99    """
     100    def __init__(self):
     101        BuiltinFunction.__init__(self, "airy_ai_prime",
     102                latex_name=r"\operatorname{Ai}'",
     103                conversions=dict(mathematica='AiryAiPrime'))
     104
     105    def _derivative_(self, x, diff_param=None):
     106        """
     107        Examples::
     108
     109            sage: derivative(airy_ai_prime(x),x)
     110            x*airy_ai(x)
     111        """
     112        return x*airy_ai_simple(x)
     113
     114    def _eval_(self, x):
     115        """
     116        Examples::
     117
     118            sage: airy_ai(1,0)
     119            -1/3*3^(2/3)/gamma(1/3)
     120            sage: airy_ai(1,0.0)
     121            -0.258819403792807
     122        """
     123        if not isinstance(x,Expression):
     124            if is_inexact(x):
     125                return self._evalf_(x, parent(x))
     126            elif x==0:
     127                r=R('1/3')
     128                return -1/(3**(r)*gamma(r))
     129        else:
     130            return None
     131
     132    def _evalf_(self, x, parent=None):
     133        """
     134        Examples::
     135       
     136            sage: airy_ai(1,0.0)
     137            -0.258819403792807
     138        """
     139        return mpmath_utils.call(airy_ai_mpmath, x, derivative=1, parent=RR)
     140
     141class FunctionAiryAiGeneral(BuiltinFunction):
     142    """
     143    The generalized derivative of the Airy Ai function
     144
     145    INPUT:
     146   
     147    - ``alpha``.- Return the `\alpha`-th order fractional derivative with respect to `z`. For `\alpha = n = 1,2,3,\ldots` this gives the derivative `\operatorname{Ai}^{(n)}(z)`, and for `\alpha = -n = -1,-2,-3,\ldots` this gives the `n`-fold iterated integral
     148     
     149    .. math ::
     150     
     151        f_0(z) = \operatorname{Ai}(z)
     152     
     153        f_n(z) = \int_0^z f_{n-1}(t) dt.
     154
     155    - ``x``.- The argument of the function.
     156
     157    - ``hold``.- Whether or not to stop from returning higher derivatives in terms of `\operatorname{Ai}(x)` and `\operatorname{Ai}'(x)`.
     158   
     159    Examples::
     160
     161        sage: x,n=var('x n')
     162        sage: airy_ai(-2,x)
     163        airy_ai(-2, x)
     164        sage: derivative(airy_ai(-2,x),x)
     165        airy_ai(-1, x)
     166        sage: airy_ai(n,x)
     167        airy_ai(n, x)
     168        sage: derivative(airy_ai(n,x),x)
     169        airy_ai(n + 1, x)
     170        sage: airy_ai(2,x,True)
     171        airy_ai(2, x)
     172        sage: derivative(airy_ai(2,x,hold_derivative=True),x)
     173        airy_ai(3, x)
     174    """
     175    def __init__(self):
     176        BuiltinFunction.__init__(self, "airy_ai", nargs=2,
     177            latex_name=r"\operatorname{Ai}")
     178
     179    def _derivative_(self, alpha, *args, **kwds):
     180        """
     181        Examples::
     182
     183            sage: x,n=var('x n')
     184            sage: derivative(airy_ai(n,x),x)
     185            airy_ai(n + 1, x)
     186        """
     187
     188        x=args[0]
     189        return airy_ai_general(alpha+1,x)
     190
     191    def _eval_(self, alpha, *args):
     192        """
     193        Examples::
     194
     195            sage: x,n=var('x n')
     196            sage: airy_ai(-2,1.0)
     197            0.136645379421096
     198            sage: airy_ai(n,1.0)
     199            airy_ai(n, 1.00000000000000)
     200        """
     201
     202       
     203        x=args[0]
     204        if not isinstance(x,Expression) and not isinstance(alpha,Expression):
     205            if is_inexact(x):
     206                return self._evalf_(alpha,x, parent(x))
     207        else:
     208            return None
     209
     210    def _evalf_(self, alpha, x, parent=None):
     211        """
     212        Examples::
     213            sage: airy_ai(-2,1.0)
     214            0.136645379421096           
     215        """
     216        return mpmath_utils.call(airy_ai_mpmath, x, derivative=alpha, parent=RR)
     217
     218airy_ai_simple= FunctionAiryAiSimple()
     219airy_ai_prime=  FunctionAiryAiPrime()
     220airy_ai_general=FunctionAiryAiGeneral()
     221
     222def airy_ai(alpha,x=None, hold_derivative=False, *args, **kwds):
     223    r"""
     224    The Airy Ai function `\operatorname{Ai}(x)` is one of the two
     225    linearly independent solutions the Airy differental equation `f''(z) +f(z)x=0`,
     226    defined by the initial conditions:
     227
     228    .. math ::
     229        \operatorname{Ai}(0)=\frac{1}{2^{2/3} \Gamma(\frac{2}{3})},
     230
     231        \operatorname{Ai}'(0)=-\frac{1}{2^{1/3} \Gamma(\frac{1}{3})}.
     232
     233    Another way to define the Airy Ai function is:
     234
     235    .. math::
     236        \operatorname{Ai}(x)=\frac{1}{\pi}\int_0^\infty
     237        \cos\left(\frac{1}{3}t^3+xt\right) dt.
     238
     239    INPUT:
     240   
     241    - ``alpha``.- Return the `\alpha`-th order fractional derivative with respect to `z`. For `\alpha = n = 1,2,3,\ldots` this gives the derivative `\operatorname{Ai}^{(n)}(z)`, and for `\alpha = -n = -1,-2,-3,\ldots` this gives the `n`-fold iterated integral
     242     
     243    .. math ::
     244     
     245        f_0(z) = \operatorname{Ai}(z)
     246     
     247        f_n(z) = \int_0^z f_{n-1}(t) dt.
     248
     249    - ``x``.- The argument of the function.
     250
     251    - ``hold_derivative``.- Whether or not to stop from returning higher derivatives in terms of `\operatorname{Ai}(x)` and `\operatorname{Ai}'(x)`.
     252   
     253
     254    EXAMPLES::
     255
     256        sage: n,x=var('n x')
     257        sage: airy_ai(x)
     258        airy_ai(x)
     259
     260    It can return derivatives or integrals::
     261   
     262        sage: airy_ai(1,x)
     263        airy_ai_prime(x)
     264        sage: airy_ai(2,x)
     265        x*airy_ai(x)
     266        sage: airy_ai(2,x,True)
     267        airy_ai(2, x)
     268        sage: airy_ai(-2,x)
     269        airy_ai(-2, x)
     270        sage: airy_ai(n, x)
     271        airy_ai(n, x)
     272
     273    It can be evaluated symbolically or numerically for real or complex values::
     274
     275        sage: airy_ai(0)
     276        1/3*3^(1/3)/gamma(2/3)
     277        sage: airy_ai(0.0)
     278        0.355028053887817
     279        sage: airy_ai(I)
     280        airy_ai(I)
     281        sage: airy_ai(1.0*I)
     282        0.331493305432141 - 0.317449858968444*I
     283
     284    And the derivatives can be evaluated::
     285
     286        sage: airy_ai(1,0)
     287        -1/3*3^(2/3)/gamma(1/3)
     288        sage: airy_ai(1,0.0)
     289        -0.258819403792807
     290
     291    Plots::
     292
     293        sage: plot(airy_ai(x),(x,-10,5))+plot(airy_ai_prime(x),(x,-10,5),color='red')
     294       
     295    **References**
     296     
     297    - Abramowitz, Milton; Stegun, Irene A., eds. (1965), "Chapter 10"
     298
     299    - http://en.wikipedia.org/wiki/Airy_function
     300    """
     301
     302    #We catch the case with no alpha
     303    if x==None:
     304        x=alpha
     305        return airy_ai_simple(x, **kwds)
     306    #We raise an error if there are too many arguments
     307    if len(args) > 0:
     308        raise TypeError, "Symbolic function airy_ai takes at most 3 arguments (%s given)"%(len(args)+3)
     309
     310    #We take care of all other cases.
     311    if hold_derivative:
     312        return airy_ai_general(alpha,x,**kwds)
     313    elif alpha==0:
     314        return airy_ai_simple(x, **kwds)
     315    elif alpha==1:
     316        return airy_ai_prime(x, **kwds)
     317    elif alpha>1:
     318        #we use a different variable here because if x is a
     319        #particular value, we would be differentiating a constant
     320        #which would return 0. What we want is the value of
     321        #the derivative at the value and not the derivative of
     322        #a particular value of the function.
     323        v=var('v')
     324        return derivative(airy_ai_simple(v,**kwds),v,alpha).subs(v=x)
     325    else:
     326        return airy_ai_general(alpha,x,**kwds)
     327
     328########################################################################
     329########################################################################
     330
     331class FunctionAiryBiSimple(BuiltinFunction):
     332    """
     333    The class for the Airy Bi function.
     334
     335    Examples::
     336
     337        sage: airy_bi_simple= FunctionAiryBiSimple()
     338        sage: f=airy_bi_simple(x); f
     339        airy_bi(x)
     340    """
     341    def __init__(self):
     342        BuiltinFunction.__init__(self, "airy_bi", latex_name=r'\operatorname{Bi}',
     343                conversions=dict(mathematica='AiryBi'))
     344
     345    def _derivative_(self, x, diff_param=None):
     346        """
     347        Examples::
     348       
     349            sage: derivative(airy_bi(x),x)
     350            airy_bi_prime(x)
     351        """
     352        return airy_bi_prime(x)
     353
     354    def _eval_(self, x):
     355        """
     356        Examples::
     357       
     358            sage: airy_bi(0)
     359            1/3*3^(5/6)/gamma(1/3)
     360            sage: airy_bi(0.0)
     361            0.614926627446001
     362            sage: airy_bi(I)
     363            airy_bi(I)
     364            sage: airy_bi(1.0*I)
     365            0.648858208330395 + 0.344958634768048*I
     366        """
     367
     368        if not isinstance(x,Expression):
     369            if is_inexact(x):
     370                return self._evalf_(x, parent(x))
     371            elif x==0:
     372                return 1/(3**(R('1/6'))*gamma(R('2/6')))
     373        else:
     374            return None
     375
     376    def _evalf_(self, x, parent=None):
     377        """
     378        Examples::
     379       
     380            sage: airy_bi(0.0)
     381            0.614926627446001
     382            sage: airy_bi(1.0*I)
     383            0.648858208330395 + 0.344958634768048*I
     384        """
     385        return mpmath_utils.call(airy_bi_mpmath, x, parent=RR)
     386
     387class FunctionAiryBiPrime(BuiltinFunction):
     388    """
     389    The derivative of the Airy Bi function.
     390
     391    Examples::
     392
     393        sage: x,n=var('x n')
     394        sage: airy_bi_prime(x)
     395        airy_bi_prime(x)
     396        sage: airy_bi_prime(0)
     397        3^(1/6)/gamma(1/3)
     398    """
     399    def __init__(self):
     400        BuiltinFunction.__init__(self, "airy_bi_prime",
     401                latex_name=r"\operatorname{Bi}'",
     402                conversions=dict(mathematica='AiryBiPrime'))
     403
     404    def _derivative_(self, x, diff_param=None):
     405        """
     406        Examples::
     407
     408            sage: derivative(airy_bi_prime(x),x)
     409            x*airy_bi(x)
     410        """
     411        return x*airy_bi_simple(x)
     412
     413    def _eval_(self, x):
     414        """
     415        Examples::
     416
     417            sage: airy_bi(1,0)
     418            3^(1/6)/gamma(1/3)
     419            sage: airy_bi(1,0.0)
     420            0.448288357353826
     421        """
     422        if not isinstance(x,Expression):
     423            if is_inexact(x):
     424                return self._evalf_(x, parent(x))
     425            elif x==0:
     426                return 3**(R('1/6'))/gamma(R('1/3'))
     427        else:
     428            return None
     429
     430    def _evalf_(self, x, parent=None):
     431        """
     432        Examples::
     433       
     434            sage: airy_bi(1,0.0)
     435            0.448288357353826
     436        """
     437        return mpmath_utils.call(airy_bi_mpmath, x, derivative=1, parent=RR)
     438
     439class FunctionAiryBiGeneral(BuiltinFunction):
     440    """
     441    The generalized derivative of the Airy Bi function
     442
     443    INPUT:
     444   
     445    - ``alpha``.- Return the `\alpha`-th order fractional derivative with respect to `z`. For `\alpha = n = 1,2,3,\ldots` this gives the derivative `\operatorname{Bi}^{(n)}(z)`, and for `\alpha = -n = -1,-2,-3,\ldots` this gives the `n`-fold iterated integral
     446     
     447    .. math ::
     448     
     449        f_0(z) = \operatorname{Bi}(z)
     450     
     451        f_n(z) = \int_0^z f_{n-1}(t) dt.
     452
     453    - ``x``.- The argument of the function.
     454
     455    - ``hold``.- Whether or not to stop from returning higher derivatives in terms of `\operatorname{Bi}(x)` and `\operatorname{Bi}'(x)`.
     456   
     457    Examples::
     458
     459        sage: x,n=var('x n')
     460        sage: airy_bi(-2,x)
     461        airy_bi(-2, x)
     462        sage: derivative(airy_bi(-2,x),x)
     463        airy_bi(-1, x)
     464        sage: airy_bi(n,x)
     465        airy_bi(n, x)
     466        sage: derivative(airy_bi(n,x),x)
     467        airy_bi(n + 1, x)
     468        sage: airy_bi(2,x,True)
     469        airy_bi(2, x)
     470        sage: derivative(airy_bi(2,x,hold_derivative=True),x)
     471        airy_bi(3, x)
     472    """
     473    def __init__(self):
     474        BuiltinFunction.__init__(self, "airy_bi", nargs=2,
     475            latex_name=r"\operatorname{Bi}")
     476
     477    def _derivative_(self, alpha, *args, **kwds):
     478        """
     479        Examples::
     480
     481            sage: x,n=var('x n')
     482            sage: derivative(airy_bi(n,x),x)
     483            airy_bi(n + 1, x)
     484        """
     485
     486        x=args[0]
     487        return airy_bi_general(alpha+1,x)
     488
     489    def _eval_(self, alpha, *args):
     490        """
     491        Examples::
     492
     493            sage: x,n=var('x n')
     494            sage: airy_bi(-2,1.0)
     495            0.388621540699059
     496            sage: airy_bi(n,1.0)
     497            airy_bi(n, 1.00000000000000)
     498        """
     499
     500       
     501        x=args[0]
     502        if not isinstance(x,Expression) and not isinstance(alpha,Expression):
     503            if is_inexact(x):
     504                return self._evalf_(alpha,x, parent(x))
     505        else:
     506            return None
     507
     508    def _evalf_(self, alpha, x, parent=None):
     509        """
     510        Examples::
     511            sage: airy_bi(-2,1.0)
     512            0.388621540699059
     513        """
     514        return mpmath_utils.call(airy_bi_mpmath, x, derivative=alpha, parent=RR)
     515
     516airy_bi_simple= FunctionAiryBiSimple()
     517airy_bi_prime=  FunctionAiryBiPrime()
     518airy_bi_general=FunctionAiryBiGeneral()
     519
     520def airy_bi(alpha,x=None, hold_derivative=False, *args, **kwds):
     521    r"""
     522    The Airy Bi function `\operatorname{Bi}(x)` is one of the two
     523    linearly independent solutions the Airy differental equation `f''(z) +f(z)x=0`,
     524    defined by the initial conditions:
     525
     526    .. math ::
     527        \operatorname{Bi}(0)=\frac{1}{3^{1/6} \Gamma(\frac{2}{3})},
     528
     529        \operatorname{Bi}'(0)=\frac{3^{1/6}}{ \Gamma(\frac{1}{3})}.
     530
     531    Another way to define the Airy Bi function is:
     532
     533    .. math::
     534        \operatorname{Bi}(x)=\frac{1}{\pi}\int_0^\infty
     535        \left[ \exp\left( xt -\frac{t^3}{3} \right)
     536        +\sin\left(xt + \frac{1}{3}t^3\right) \right ] dt.
     537
     538    INPUT:
     539   
     540    - ``alpha``.- Return the `\alpha`-th order fractional derivative with respect to `z`. For `\alpha = n = 1,2,3,\ldots` this gives the derivative `\operatorname{Bi}^{(n)}(z)`, and for `\alpha = -n = -1,-2,-3,\ldots` this gives the `n`-fold iterated integral
     541     
     542    .. math ::
     543     
     544        f_0(z) = \operatorname{Bi}(z)
     545     
     546        f_n(z) = \int_0^z f_{n-1}(t) dt.
     547
     548    - ``x``.- The argument of the function.
     549
     550    - ``hold_derivative``.- Whether or not to stop from returning higher derivatives in terms of `\operatorname{Bi}(x)` and `\operatorname{Bi}'(x)`.
     551   
     552
     553    EXAMPLES::
     554
     555        sage: n,x=var('n x')
     556        sage: airy_bi(x)
     557        airy_bi(x)
     558
     559    It can return derivatives or integrals::
     560   
     561        sage: airy_bi(1,x)
     562        airy_bi_prime(x)
     563        sage: airy_bi(2,x)
     564        x*airy_bi(x)
     565        sage: airy_bi(2,x,True)
     566        airy_bi(2, x)
     567        sage: airy_bi(-2,x)
     568        airy_bi(-2, x)
     569        sage: airy_bi(n, x)
     570        airy_bi(n, x)
     571
     572    It can be evaluated symbolically or numerically for real or complex values::
     573
     574        sage: airy_bi(0)
     575        1/3*3^(5/6)/gamma(1/3)
     576        sage: airy_bi(0.0)
     577        0.614926627446001
     578        sage: airy_bi(I)
     579        airy_bi(I)
     580        sage: airy_bi(1.0*I)
     581        0.648858208330395 + 0.344958634768048*I
     582
     583    And the derivatives can be evaluated::
     584
     585        sage: airy_bi(1,0)
     586        3^(1/6)/gamma(1/3)
     587        sage: airy_bi(1,0.0)
     588        0.448288357353826
     589
     590    Plots::
     591
     592        sage: plot(airy_bi(x),(x,-10,5))+plot(airy_bi_prime(x),(x,-10,5),color='red')
     593       
     594    **References**
     595     
     596    - Abramowitz, Milton; Stegun, Irene A., eds. (1965), "Chapter 10"
     597
     598    - http://en.wikipedia.org/wiki/Airy_function
     599    """
     600
     601    #We catch the case with no alpha
     602    if x==None:
     603        x=alpha
     604        return airy_bi_simple(x, **kwds)
     605    #We raise an error if there are too many arguments
     606    if len(args) > 0:
     607        raise TypeError, "Symbolic function airy_ai takes at most 3 arguments (%s given)"%(len(args)+3)
     608
     609    #We take care of all other cases.
     610    if hold_derivative:
     611        return airy_bi_general(alpha,x,**kwds)
     612    elif alpha==0:
     613        return airy_bi_simple(x, **kwds)
     614    elif alpha==1:
     615        return airy_bi_prime(x, **kwds)
     616    elif alpha>1:
     617        #we use a different variable here because if x is a
     618        #particular value, we would be differentiating a constant
     619        #which would return 0. What we want is the value of
     620        #the derivative at the value and not the derivative of
     621        #a particular value of the function.
     622        v=var('v')
     623        return derivative(airy_bi_simple(v,**kwds),v,alpha).subs(v=x)
     624    else:
     625        return airy_bi_general(alpha,x,**kwds)
     626
  • sage/functions/all.py

    diff -r 2a2abbcad325 -r d6faed1b6b79 sage/functions/all.py
    a b  
     1from airy import airy_ai, airy_bi
     2
    13from piecewise import piecewise, Piecewise
    24
    35from trig import ( sin, cos, sec, csc, cot, tan,
     
    3739                     inverse_jacobi, log_gamma,
    3840                     lngamma, exp_int, error_fcn, elliptic_e,
    3941                     elliptic_f, elliptic_ec, elliptic_eu,
    40                      elliptic_kc, elliptic_pi, elliptic_j,
    41                      airy_ai, airy_bi)
     42                     elliptic_kc, elliptic_pi, elliptic_j)
    4243                       
    4344from orthogonal_polys import (chebyshev_T,
    4445                              chebyshev_U,
  • sage/functions/special.py

    diff -r 2a2abbcad325 -r d6faed1b6b79 sage/functions/special.py
    a b  
    586586    return NewMaximaFunction()
    587587
    588588
    589 def airy_ai(x):
    590    r"""
    591    The function `Ai(x)` and the related function `Bi(x)`,
    592    which is also called an *Airy function*, are
    593    solutions to the differential equation
    594 
    595    .. math::
    596 
    597       y'' - xy = 0,
    598 
    599    known as the *Airy equation*. The initial conditions
    600    `Ai(0) = (\Gamma(2/3)3^{2/3})^{-1}`,
    601    `Ai'(0) = -(\Gamma(1/3)3^{1/3})^{-1}` define `Ai(x)`.
    602    The initial conditions `Bi(0) = 3^{1/2}Ai(0)`,
    603    `Bi'(0) = -3^{1/2}Ai'(0)` define `Bi(x)`.
    604 
    605    They are named after the British astronomer George Biddell Airy.
    606    They belong to the class of "Bessel functions of fractional order".
    607 
    608    EXAMPLES::
    609    
    610        sage: airy_ai(1.0)        # last few digits are random
    611        0.135292416312881400
    612        sage: airy_bi(1.0)        # last few digits are random
    613        1.20742359495287099
    614 
    615    REFERENCE:
    616 
    617    - Abramowitz and Stegun: Handbook of Mathematical Functions,
    618      http://www.math.sfu.ca/~cbm/aands/
    619 
    620    - http://en.wikipedia.org/wiki/Airy_function
    621    """
    622    _init()
    623    return RDF(meval("airy_ai(%s)"%RDF(x)))
    624 
    625 def airy_bi(x):
    626    r"""
    627    The function `Ai(x)` and the related function `Bi(x)`,
    628    which is also called an *Airy function*, are
    629    solutions to the differential equation
    630 
    631    .. math::
    632 
    633       y'' - xy = 0,
    634 
    635    known as the *Airy equation*. The initial conditions
    636    `Ai(0) = (\Gamma(2/3)3^{2/3})^{-1}`,
    637    `Ai'(0) = -(\Gamma(1/3)3^{1/3})^{-1}` define `Ai(x)`.
    638    The initial conditions `Bi(0) = 3^{1/2}Ai(0)`,
    639    `Bi'(0) = -3^{1/2}Ai'(0)` define `Bi(x)`.
    640 
    641    They are named after the British astronomer George Biddell Airy.
    642    They belong to the class of "Bessel functions of fractional order".
    643 
    644    EXAMPLES::
    645    
    646        sage: airy_ai(1)        # last few digits are random
    647        0.135292416312881400
    648        sage: airy_bi(1)        # last few digits are random
    649        1.20742359495287099
    650 
    651    REFERENCE:
    652 
    653    - Abramowitz and Stegun: Handbook of Mathematical Functions,
    654      http://www.math.sfu.ca/~cbm/aands/
    655 
    656    - http://en.wikipedia.org/wiki/Airy_function
    657    """
    658    _init()
    659    return RDF(meval("airy_bi(%s)"%RDF(x)))
    660 
    661 
    662589def bessel_I(nu,z,algorithm = "pari",prec=53):
    663590    r"""
    664591    Implements the "I-Bessel function", or "modified Bessel function,