# airy

Airy function

## Syntax

`airy(x)airy(0,x)airy(1,x)airy(2,x)airy(3,x)airy(n,x)`

## Description

`airy(x)` returns the Airy function of the first kind, Ai(x).

`airy(0,x)` is equivalent to `airy(x)`.

`airy(1,x)` returns the derivative of the Airy function of the first kind, Ai′(x).

`airy(2,x)` returns the Airy function of the second kind, Bi(x).

`airy(3,x)` returns the derivative of the Airy function of the second kind, Bi′(x).

`airy(n,x)` returns a vector or matrix of derivatives of the Airy function.

## Input Arguments

 `x` Symbolic number, variable, expression, or function, or a vector or matrix of symbolic numbers, variables, expressions, or functions. If `x` is a vector or matrix, `airy` returns the Airy functions for each element of `x`. `n` Vector or matrix of numbers `0`, `1`, `2`, and `3`.

## Examples

Solve this second-order differential equation. The solutions are the Airy functions of the first and the second kind.

```syms y(x) dsolve(diff(y, 2) - x*y == 0)```
```ans = C2*airy(0, x) + C3*airy(2, x)```

Verify that the Airy function of the first kind is a valid solution of the Airy differential equation:

```syms x isAlways(diff(airy(0, x), x, 2) - x*airy(0, x) == 0)```
```ans = 1```

Verify that the Airy function of the second kind is a valid solution of the Airy differential equation:

`isAlways(diff(airy(2, x), x, 2) - x*airy(2, x) == 0)`
```ans = 1```

Compute the Airy functions for these numbers. Because these numbers are not symbolic objects, you get floating-point results.

`[airy(1), airy(1, 3/2 + 2*i), airy(2, 2), airy(3, 1/101)]`
```ans = 0.1353 + 0.0000i 0.1641 + 0.1523i 3.2981 + 0.0000i 0.4483 + 0.0000i```

Compute the Airy functions for the numbers converted to symbolic objects. For most symbolic (exact) numbers, `airy` returns unresolved symbolic calls.

`[airy(sym(1)), airy(1, sym(3/2 + 2*i)), airy(2, sym(2)), airy(3, sym(1/101))]`
```ans = [ airy(0, 1), airy(1, 3/2 + 2i), airy(2, 2), airy(3, 1/101)]```

For symbolic variables and expressions, `airy` also returns unresolved symbolic calls:

```syms x y [airy(x), airy(1, x^2), airy(2, x - y), airy(3, x*y)]```
```ans = [ airy(0, x), airy(1, x^2), airy(2, x - y), airy(3, x*y)]```

Compute the Airy functions for x = 0. The Airy functions have special values for this parameter.

`airy(sym(0))`
```ans = 3^(1/3)/(3*gamma(2/3))```
`airy(1, sym(0))`
```ans = -(3^(1/6)*gamma(2/3))/(2*pi)```
`airy(2, sym(0))`
```ans = 3^(5/6)/(3*gamma(2/3))```
`airy(3, sym(0))`
```ans = (3^(2/3)*gamma(2/3))/(2*pi)```

If you do not use `sym`, you call the MATLAB® `airy` function that returns numeric approximations of these values:

`[airy(0), airy(1, 0), airy(2, 0), airy(3, 0)]`
```ans = 0.3550 -0.2588 0.6149 0.4483```

Differentiate the expressions involving the Airy functions:

```syms x y diff(airy(x^2)) diff(diff(airy(3, x^2 + x*y -y^2), x), y)```
```ans = 2*x*airy(1, x^2) ans = airy(2, x^2 + x*y - y^2)*(x^2 + x*y - y^2) +... airy(2, x^2 + x*y - y^2)*(x - 2*y)*(2*x + y) +... airy(3, x^2 + x*y - y^2)*(x - 2*y)*(2*x + y)*(x^2 + x*y - y^2) ```

Compute the Airy function of the first kind for the elements of matrix `A`:

```syms x A = [-1, 0; 0, x]; airy(A)```
```ans = [ airy(0, -1), 3^(1/3)/(3*gamma(2/3))] [ 3^(1/3)/(3*gamma(2/3)), airy(0, x)]```

Plot the Airy function Ai(x) and its derivative Ai'(x):

```syms x ezplot(airy(x)) hold on ezplot(airy(1,x)) title('Airy function Ai and its first derivative') hold off ```

collapse all

### Airy Functions

The Airy functions Ai(x) and Bi(x) are linearly independent solutions of this differential equation:

$\frac{{\partial }^{2}y}{\partial {x}^{2}}-xy=0$

### Tips

• Calling `airy` for a number that is not a symbolic object invokes the MATLAB `airy` function.

• When you call `airy` with two input arguments, at least one argument must be a scalar or both arguments must be vectors or matrices of the same size. If one input argument is a scalar and the other one is a vector or a matrix, `airy(n,x)` expands the scalar into a vector or matrix of the same size as the other argument with all elements equal to that scalar.

## References

Antosiewicz, H. A. "Bessel Functions of Fractional Order." Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. (M. Abramowitz and I. A. Stegun, eds.). New York: Dover, 1972.