How to do it...

Airy and Bairy functions are used as follows:

  1. This equation has two linearly independent solutions, both of them defined as an improper integral for real values of the independent variable.
  2. The airy command computes both functions (Ai and Bi) as well as their corresponding derivatives (Aip and Bip, respectively).
  3. 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.
  4. We also offer this graph as a surface plot using the mplot3d module of mpl_toolkits as follows:
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)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset