Julia package for Mathieu functions.

The updates to the old repository include the addition of the actual Mathieu functions
themselves, in addition to the calculations for the characteristic values. The code that
has been added here is also described in my own repository Mathieu function
package. I opted to incorporate my
code here, given that the package here is already installed in the Julia general
registry. In this contribution the characteristic values are computed by the original
code and employs the well-known algorithms featured in Morse & Feshbach's esteemed
textbook, as well as the *Digital Library of Mathematical
Functions*. Both sources offer essentially the same thing.

The functions available are `ce(n, q, x)`

for the Mathieu even function and `se(n, q, x)`

for the Mathieu odd function. Here, `n`

represents the index of the Mathieu function, and
`x`

is a range (e.g. `x = range(-pi, pi, length=500)`

). Plotting can be
easily done using commands like `plot(x, ce(n, q, x))`

, with the Plots package in Julia.

Mathieu functions are the eigenvalues and eigenfunction of *Mathieu's
equation* (for more details, see NIST's Digital Library of
Mathematical Functions).

This implementation is based on an algorithm described by Shirts, which revolves around an application of Floquet's theorem.

Interestingly, an equivalent description can be obtained by considering the eigenstates and eigenenergies of a particular type of artificial atom based on superconducting circuits (see Cotet's Ph.D. thesis for a discussion of this connection, or a recent paper by Koch et al.). In this physical picture, Mathieu functions can be approximated by computing the eigenvectors and eigenvalues of a Hamiltonian truncated to a sufficiently high dimension (this Hamiltonian corresponds to a symmetric tri-diagonal matrix, so this approximation is rather convenient for numerics).

The current tests consist of checks against a table generated by Mathematica (which, to our knowledge, has the most complete implementation of Mathieu functions amongst commonly accessible mathematical software packages).

The package can be installed from the Julia registries

```
(v1.x) pkg> add MathieuFunctions
```

We follow the notation used in NIST's Digital Library of Mathematical Functions,

DLMF | Julia call | Description |
---|---|---|

aⱼ(q) | `charA(q,j)` |
Integer order Mathieu characteristic value of even parity |

bⱼ(q) | `charB(q,j)` |
Integer order Mathieu characteristic value of odd parity |

λ₍ᵥ₊ⱼ₎(q) | `charλ(q,v,j)` |
Real-valued order Mathieu characteristic value |

For integer order characteristic values, our implementation yields

which should be contrasted with the corresponding plot in the DTMF @ NIST.

Similarly, for real-valued order, our implementation yields

which should be contrasted with the corresponding plot in the DTMF @ NIST.

Thanks to the way that the Mathieu characteristic values are computed, the order indexing convention used here is particularly convenient for computing the energy spectrum of a broad class of superconducting qubits including the quantronium and the transmon.

As an example of how this package may be used, here is the Julia code that reproduces the energy spectrum illustrated in Koch et al.

```
using MathieuFunctions, PyPlot
EJoverEC = 30;
EC = 0.35; # GHz
nLevels = 10;
nCharge = 2;
nData = 1001;
Nstart = 5;
q = -(1/2)*EJoverEC;
tol = 1e-12;
ng = LinRange(-nCharge,nCharge,nData);
nu = -2*ng;
a = zeros(nData,nLevels);
N = zeros(nData,1);
Err = zeros(nData,1);
for i=1:nData
#println(nu[i])
a[i,:] = charλ(q,nu[i],k=1:nLevels);
end
E = EC*a;
Eng_half = charλ(q,-1,k=1:nLevels);
Eng_0 = charλ(q, 0,k=1:nLevels);
E01 = Eng_half[2] - Eng_half[1];
plot(ng,(E .- Eng_0[1])/E01);xlabel(L"$n_g$");ylabel(L"$E$");
ylim(-.5,5)
```

- Some documentation with examples
- Support for characteristic values (integer and non-integer order)
- Unify order indexing, match DLMF conventions

- Support for characteristic function (integer and non-integer order)

MIT (See TLDR and "The MIT License, line by line". )

John Lapeyre, Daniel Greenbaum and Marcus P da Silva

This effort was partially supported by IARPA under the LogiQ program.

Raytheon BBN Technologies