...one of the most highly
regarded and expertly designed C++ library projects in the
world.

— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards

#include <boost/math/special_functions/airy.hpp>

namespace boost { namespace math { template <class T>calculated-result-typeairy_ai(T x); template <class T, class Policy>calculated-result-typeairy_ai(T x, const Policy&); }} // namespaces

The function airy_ai calculates the Airy function Ai which is the first solution to the differential equation:

See Weisstein, Eric W. "Airy Functions." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/AiryFunctions.html;

The final Policy argument is optional and can be used to control the behaviour of the function: how it handles errors, what level of precision to use etc. Refer to the policy documentation for more details.

The following graph illustrates how this function changes as *x*
changes: for negative *x* the function is cyclic, while
for positive *x* the value tends to zero:

This function is implemented entirely in terms of the Bessel functions cyl_bessel_j and cyl_bessel_k - refer to those functions for detailed accuracy information.

In general though, the relative error is low (less than 100 ε) for *x
> 0* while only the absolute error is low for *x <
0*.

Since this function is implemented in terms of other special functions, there are only a few basic sanity checks, using test values from Wolfram Airy Functions.

This function is implemented in terms of the Bessel functions using the relations: