# Relating Airy and Bessel functions

Reblogged from The Endeavour by J. D. Cook.

The Airy functions Ai(x) and Bi(x) are independent solutions to the differential equation

For negative x they act something like sin(x) and cos(x). For positive x they act something like exp(x) and exp(-x). This isn’t surprising if you look at the differential equation. If you replace xwith a negative constant, you sines and cosines, and if you replace it with a positive constant, you get positive and negative exponentials.

The Airy functions can be related to Bessel functions as follows:

and

Here J is a “Bessel function of the first kind” and I is a “modified Bessel function of the first kind.” Also

To verify the equations above, and to show how to compute these functions in Python, here’s some code.

The SciPy function airy computes both functions, and their first derivatives, at once. I assume that’s because it doesn’t take much longer to compute all four functions than to compute one. The code for Ai2 and Bi2 below uses np.where instead of if... else so that it can operate on NumPy vectors all at once. You can plot Ai and   Ai2 and see that the two curves lie on top of each other. The same holds for Bi and   Bi2 .

There is a problem with Ai2 and Bi2: they return nan at 0. A more careful implementation would avoid this problem, but that’s not necessary since these functions are only for illustration. In practice, you’d simply use airy and it does the right thing at 0.

This site uses Akismet to reduce spam. Learn how your comment data is processed.