Book Image

Learning SciPy for Numerical and Scientific Computing Second Edition

Book Image

Learning SciPy for Numerical and Scientific Computing Second Edition

Overview of this book

Table of Contents (15 chapters)
Learning SciPy for Numerical and Scientific Computing Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Airy and Bairy functions


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

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...