Airy and Bairy functions

These are solutions of the Stokes equation and are obtained by solving the following differential equation:

Airy and Bairy functions

This equation has two linearly independent solutions, both of them defined as an improper integral for real values of the independent variable. The airy command computes both functions (Ai and Bi) as well as their corresponding derivatives (Aip and Bip, respectively). In the following code, we take advantage of the contourf command in matplotlib.pyplot to present an image of the real part of the output of the Bairy function Bi for an array of 801 x 801 complex values uniformly spaced in the square from -4 - 4j to 4 + 4j. We also offer this graph as a surface plot using the mplot3d module of mpl_toolkits:

>>> import numpy
>>> import scipy.special
>>> import  matplotlib.pyplot as plt
>>> import mpl_toolkits.mplot3d
>>> x=numpy.mgrid[-4:4:100j,-4:4:100j]
>>> z=x[0]+1j*x[1]
>>> (Ai, Aip, Bi, Bip) = scipy.special.airy(z)
>>> steps = range(int(Bi.real.min()), int(Bi.real.max()),6)
>>> fig=plt.figure()
>>> subplot1=fig.add_subplot(121,aspect='equal')
>>> subplot1.contourf(x[0], x[1], Bi.real, steps)
>>> subplot2=fig.add_subplot(122,projection='3d')
>>> subplot2.plot_surface(x[0],x[1],Bi.real)
>>> plt.show()

The output is as follows:

Airy and Bairy functions