Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Abstract—We review the full spectrum of solutions to the Some high-level mathematical language contains Mathieu
Mathieu differential equation y 00 + [a − 2q cos(2z)]y = 0, and functions, but these are defined as black-box commands: then,
we describe a numerical algorithm which allows a flexible it is difficult to understand how these commands work and how
approach to the computation of all the Mathieu functions. We
use an elegant and compact matrix notation which can be to extend their use to other cases or specific applications. The
readily implemented on any computing platform. We give some present toolbox is the first implementation in the framework of
explicit examples (written in the programming language Scilab) an open-source software. This fact, together with the modular-
that provide a ready-to-use package for solving the Mathieu ity and simplicity of the code and some specific application-
differential equation and related applications in several fields. oriented functions, allows easy improvements, extensions and
applications to different specific cases.
Index Terms—Scilab, Mathieu Equation, Mathieu Functions
In this paper we want first to give a brief guide to orient the
I. I NTRODUCTION reader in the “forest” of solutions the ME can have, and then
show how with a few simple modules in the language Scilab
The Mathieu equation (ME) appears in several different it is possible to easily solve the ME in the various cases or to
situations in Physics: electromagnetic or elastic wave equa- calculate the different kinds of MFs.
tions with elliptical boundary conditions as in waveguides
This method was inspired by the remark by Fëdorov [14]
or resonators, the motion of particles in alternated-gradient
that the Mathieu equation is the Fourier transform of the
focussing or electromagnetic traps, the inverted pendulum,
Raman-Nath system of equations, and a matrix-based program
parametric oscillators, the motion of a quantum particle in
had been written for the latter [15].
a periodic potential, the eigenfunctions of the quantum pen-
dulum, are just few examples. Our program is composed of 2 modules, essentially based
Although Mathieu Functions (MFs) have a wide spectrum on the Scilab command “spec” for the diagonalization of
of applications, they are not commonly used and many books a matrix, one for MFs and one for non-periodic solutions
on “special functions” do not report them at all (but there are, of the ME, plus one for elliptical-to-cartesian coordinate
of course, many exceptions [1] [2] [3]). This is likely due to transformation, which turns out to be necessary when plotting
the complexity of the solutions of the ME. the results.
This is why, more than 100 years after their definition [4], As contrasted with polynomial approximations and Runge-
still many papers are written on specific technical aspects of Kutta methods, this one does not accumulate errors as it
MFs and their computational problems [5] [6] [7] [8] [9] [10]. is based on matrix diagonalization and Fourier transform.
The reader is invited to refer to the papers by Ruby [11] and Moreover, the modular form of the program makes it more
by Gutierrez-Vega et al. [12] for illustrations and examples of flexible, as different script programs can be made for specific
applications of MFs. The classic reference book is still the one problems using the same building blocks.
by McLachlan [13] who has defined the standard notation that This approach is efficient in determining a whole range of
we use throughout this paper. values rather than a single one.
II. S OLUTIONS TO THE M ATHIEU EQUATION TABLE I: Stability and periodicity of two independent
solutions of the Mathieu equation, at different values of the
In this Section we briefly review some known facts about the
characteristic exponent ν.
solutions of the Mathieu equation (for more details see [13],
[2]). The Mathieu equation is a second-order homogeneous STABILITY PERIOD of
VALUES of ν y2 (z)
of y1 y1
linear differential equation of the form
ν complex
d2 y and not real not bounded not periodic y1 (−z)
+ [a − 2q cos(2z)] y = 0 , (1) ν real and
dz 2
not rational bounded not periodic y1 (−z)
where the constants a, q are often referred as characteristic ν rational periodic
number and parameter, respectively. Most of the applications and not inte-
bounded (not π or 2π) y1 (−z)
ger
of eq. (1) deal only with real values of a and q, though one can
periodic π or
also consider the more general case where a, q are complex ν integer bounded
2π
τ z y1 (z) + f (z)
numbers.
By substituting the independent variable z → iz in eq. (1)
one obtains the so called modified Mathieu equation: and then the general solution may be periodic or not,
bounded or not depending on the corresponding ν val-
d2 y
− [a − 2q cosh(2z)] y = 0 . (2) ues, as shown in Table I. Such a ν value can be deter-
dz 2
mined by the following method [13]: by introducing in
Equation (2) describes, for instance, the radial component eq. (3) the Fourier representation of a periodic function
of the vibrations of an elliptic drum. with period π,
Let us first consider equation (1) (eq. (2) will be considered
+∞
at the end of this Section). The most general solution y(z) of
X
p(z) = ck e2ikz
eq. (1) can be written as a linear combination of two indepen- k=−∞
dent solutions y1 (z) and y2 (z), i.e. y(z) = Ay1 (z) + By2 (z)
with A, B arbitrary complex constants. According to Floquet’s and by inserting the result in eq. (1), one obtains the
theorem, it is possible to choose y1 (z) and y2 (z) in a very following recurrence equation for ck ’s
simple and convenient form: indeed, there always exists a
[(2k + ν)2 − a]ck + q[ck+1 + ck−1 ] = 0 (4)
solution of eq. (1) in the form (solutions of the first kind)
which can be written in matrix form,
y1 (z) = eiνz p(z) (3)
(Hν − aI) c =0 (5)
where the characteristic exponent ν depends on a and q, and
p(z) is a periodic function with period π. It is easy to check where I is the identity matrix and Hν is a symmetric
that a solution of the form in eq. (3) is bounded for z → ∞, tridiagonal matrix as in eq. (6) and c is a column vector
unless ν is a complex number, for which y1 (z) is unbounded. of the form c = (. . . , c−1 , c0 , c1 , . . .). The linear system
If ν is real but not a rational number then eq. (3) is non eq. (5) has non trivial solution only if det(Hv −aI) = 0,
periodic. If ν is a rational number, i.e. ν is a proper fraction which is an equation for ν. The solution is eq. (7), where
as ν = s/p, then eq. (3) is periodic of period at most 2πp ∆(ν) is written as eq. (8).
(and not π or 2π). Finally if ν is a real integer then y1 is a Then, given a, q, one obtains a corresponding ν value
periodic function with period π or 2π. by evaluating (7) and (8). Note that it is sufficient
Moreover if ν is not a real integer then a second independent to consider a solution of eq. (7) in the interval [0, 1]
solution is y2 (z) = y1 (−z) whereas if ν is a real integer then because, if ν̄ is a solution of eq. (7), then ν = ±ν̄ ± 2n
a second independent solution is always of the form y2 (z) = is a solution too (signs uncorrelated).
τ z y1 (z) + f (z) (Mathieu functions of the second kind) where It is very easy to write a SCILAB computer program to
τ is a constant and f (z) has the same periodicity properties evaluate (7) and (8); of course the matrix in (8) must
of y1 . The results stated above are collected in the table I. be truncated to some order, say N , then obtaining the
There are two ways of tackling the problem of solving eq. solution νN . It is sufficient to evaluate also νN 0 for
(1), according to the physical problem one is interested in: N 0 > N : if |νN − νN 0 | is less than a fixed-at will
1) The first case is when a, q are independently given precision parameter, then keep it, else go further by
constants (e.g. in the case of the parametric oscillator), increasing N .
··· ··· ··· ··· ··· ··· ···
.. ..
. (ν − 4)2 q 0 0 0 .
.. ..
(ν − 2)2
. q q 0 0 .
.. ..
Hν =
. 0 q ν2 q 0 .
(6)
.. ..
. 0 0 q (ν + 2)2 q
.
..
. 0 0 0 q (ν + 4)2 q
··· ··· ··· ··· ··· q ···
π√
q
2
∆(0) sin2
ν=
π arcsin 2 a for a 6= (2k)2
(7)
1
ν=
π arccos [2 ∆(1) − 1] for a = (2k)2
··· ··· ··· ··· ··· ··· ···
.. q
..
. 1 (ν−4)2 −a 0 0 0 .
.. q q
..
. (ν−2)2 −a 1 (ν−2)2 −a 0 0 .
.. ..
∆(ν) = det . 0 q
1 q
0 .
(8)
ν 2 −a ν 2 −a
.. q q
..
. 0 0 (ν+2)2 −a 1 (ν+2)2 −a
.
..
q
. 0 0 0 (ν+4)2 −a 1 ···
··· ··· ··· ··· ··· ··· ···
The coefficients ck can be obtained, up to an arbitrary with period π it has also period 2π, then by inserting
proportionality constant, by considering the eigenvector the Fourier representation of a 2π periodic function in
P+∞
corresponding to the zero eigenvalue of the symmetric (3), y1 (z) = k=−∞ ck eikz . One obtains the following
matrix Hν −aI. The constant is determined by imposing recurrence relation,
suitable normalization conditions.
2) The second case is when, from the very beginning, one is k 2 − a ck + q (ck+2 + ck−2 ) = 0
interested only to periodic solutions with period π or 2π or
(e.g. in the case of the angular part of the wave equation (H − aI)c =0
in elliptical coordinates). Then a and q cannot be given
independently: they must satisfy the equation (owing the where H is the symmetric pentadiagonal matrix as in
periodicity) of the form ν(a, q) = n, where n is an eq. (9).
integer number. All a’s values for which ν(a, q) = n, are The linear system (9) has non trivial solution only
called characteristic values: the corresponding periodic if det(H − aI) = 0, which is the equation for the
solutions (3) are called Mathieu functions (or Mathieu eigenvalues of H. By solving it one obtains all a’s value
functions of the first kind). In this case, the second we are looking for. If q is real then H is real symmetric
solution y2 (Mathieu function of the second kind) is and all the eigenvalues a’s are real. Then they can be
usually rejected since it is not bounded. ordered in increasing order: it is usual to call them an
It is easy to see from (3) that if ν(a, q) = n, then and bn by the eq. (10).
y1 is periodic with period π for even n and periodic In particular, notice that when q = 0 one has a0 = 0
with period 2π for odd n. Since a periodic function and ak = bk = k 2 , for k = 0, 1, . . .. The non-zero
··· ··· ··· ··· ··· ··· ···
2
..
··· (−2) 0 q 0 0 ···
.
··· 0 (−1)2 0 q 0 ···
c−1
H=
··· q 0 02 0 q ··· ; c = c0
(9)
2
··· 0 q 0 (1) 0 ···
c1
.
··· 0 0 q 0 (2)2 ···
..
··· ··· ··· ··· ··· ··· ···
(
a0 < a1 < b1 < b2 < a2 < a3 < b3 < · · · for q < 0
(10)
a0 < b1 ≤ a1 < b2 ≤ a2 < b3 ≤ a3 < · · · for q ≥ 0
solutions of eq. (9), corresponding to a fixed eigen- In the same way, one defines Cern , Cein , Sern , Sein ,
value ak or bk , are given by the eigenvectors (i.e. the Gen , F en corresponding to cern , cein , sern , sein , f en ,
columns of the orthogonal matrix V which diagonal- gen respectively.
izes H) of H = V DV + (D diagonal matrix). The The functions Cen and Sen can be written also in
Mathieu functions so obtained are defined as cen (z, q) terms of Bessel functions Jn (z), i.e
(even solutions corresponding to an eigenvalues: cosine-
∞
elliptic), sen (z, q) (odd solutions corresponding to bn X √
y1 (z) = cr Jr (2 q cosh z) (11)
eigenvalues: sine-elliptic). Moreover, ce2n and se2n+1
r=0
have period π, and ce2n+1 and se2n+2 have period 2π.
cen (z, q) and sen (z, q) functions are illustrated in Fig.1. Note that the Bessel expansion is equivalent to the
The second linearly independent solution (as we exponential expansion but it is slightly better for numer-
said before, necessarily not periodic) are referred as ical calculations. Moreover, an independent solution can
f en (z, q) for the cen (z, q) case, and as gen (z, q) for be obtained directly by substituting J-Bessel functions
the sen (z, q). with Y -Bessel functions, thus defining the functions
For the sake of completeness, let us mention that when q F eyn , Geyn . In the same way, by using K-Bessel func-
is negative imaginary, q = −is with s real and positive, tions one defines F ekn and Gekn functions.
in some book it is possible to find cern , cein , sern , sein
functions. They are defined by III. O RGANIZATION OF THE PROGRAM
The program is composed of four modules, two for the
cern (z, q) = <cen (z, −is)
calculation of periodic Mathieu functions (hence q is given
cein (z, q) = =cen (z, −is) as an input, and the a’s and b’s are calculated as output), and
sern (z, q) = <sen (z, −is) two for the general aperiodic case (both a and q are given as
sein (z, q) = =sen (z, −is) arbitrary input):
• [ab,c]=mathieuf(q,[mat_dimension])
The solutions of the modified Mathieu equation eq. (2), calculates the characteristic values ak , bk and the
can be easily obtained by the following way; for a-values coefficients ck of the expansion of Mathieu functions,
corresponding to cem (z, q), sem (z, q) the first solutions for a given matrix dimension (default 12).
of eq. (2) are derived by substituting iz for z, i.e.
• mathieu(’kind’,order,arg,q,[precision])
Cen (z, q) = cen (iz, q) uses the former program to calculate the Mathieu
Sen (z, q) = −isen (iz, q) functions with a given precision (default 10−3 ), by
starting with a matrix size (depending on the order n and
Cen and Sen are called modified Mathieu functions of the parameter q) which is increased until the required
the first kind (illustrated in Fig. 2). precision is reached. Some inputs can also be entered
Fig. 1: The ce functions (left) and se functions (right), for q=1. Our Scilab commands are:
plot(mathieu(’ce’,(0:3)’,0:.1:2*%pi,1)); plot(mathieu(’se’,(1:3)’,0:.1:2*%pi,1));
Fig. 2: The Ce functions (left) and Se functions (right), for q=1. Our Scilab commands are:
plot(mathieu(’Ce’,(0:3)’,0:.1:2*%pi,1)); plot(mathieu(’Se’,(1:3)’,0:.1:2*%pi,1));
IV. E XAMPLES
This section is a gallery of some output of our programs,
with the commands used to calculate and display them.
Figure 3 shows the well-known stability curves, where the
white areas show values of ”a” and ”q” with stable (periodic)
solutions, and the coloured contours indicate the unstable
solutions (the value expressed by the contour is the exponential
envelope factor of the diverging function). The equations in Fig. 4: The function ’se1’ or different values of ’q’; our
this case might describe a parametric oscillator, i.e. a harmonic Scilab commands are:
oscillator where the oscillating frequency ω0 is modulated at for q=[.1,1,5,20] plot(mathieu(’se’,
√
a frequency ωm = 1/ aω0 with a relative amplitude (max. 1,0:..2:%pi,q)); end
freq. deviation divided by ω0 ) 2q/a. The q = 0 axis represents
an unmodulated harmonic oscillator, with stable sinusoidal Fig. 5 is the 3-D plot of the field of a higher-order mode of
solutions for a > 0 and unstable hyperbolic solutions for an elliptical waveguide (or vibrating drum). For this a program
a < 0. The stable (white) area below the a=0 axis indicates has been written, ”elliptical.sci”, which determines
the conditions of stability of the ”inverted pendulum” (stability the zeros of the chosen radial function, in order to determine
of an otherwise unstable oscillator).The butterfly-like unstable the ellipse which satisfies the boundary conditions; then com-
Fig. 6: Comparison of a mode with circular and slightly
elliptical boundary; our Scilab commands are:
elliptical(’e’,3,2,0.1);
elliptical(’e’,3,2,8);
elliptical(’o’,3,2,0.1);
elliptical(’o’,3,2,8);
Fig. 5: A higher order mode of an elliptical waveguide (or
drum); our Scilab command is
elliptical("e",2,4,0.1);