Conference PaperPDF Available

## Abstract

Bernoulli polynomials and Bernoulli numbers have been extensively used in several areas of mathematics (especially in number theory) because they appear in many mathematical formulas: as in the residual term of the Euler-Maclaurian quadrature rule, in the Taylor series expansion of the trigonometric functions tan (x), csc (x) and cot (x), in the Taylor series expansion of the hyperbolic function tanh(x). They also appear in the well known exact expression of the even integer values of the Riemann zeta function.
Computing matrix functions by matrix Bernoulli series
Emilio Defez, Javier Ibáñez, Jesús Peinado, Pedro Alonso-Jordá, and José M. Alonso
Universitat Politècnica de València, Spain
Introduction
Computation of matrix functions has received attention in the last years because of its several applications in different
areas of science and technology. Of all matrix functions, the exponential matrix eA,ACn×n,stands out due to both
its applications in the resolution of systems of differential equations and the difﬁculty of its computation, see .
Among all the proposed methods to approximate the exponential matrix, there are two fundamental ones:
those based on rational Padé approximations , and
those based on polynomial approximations using either Taylor series developments  or serial developments of
Hermite matrix polynomials .
As demonstrated in the recent past years, polynomial approximations are generally more efﬁcient than approximations
based on the Padé algorithm since they are more accurate despite a slightly higher cost. Polynomial approximations
use the basic property of Scaling-Squaring, based on the relationship
eA=eA/2s2s
.
For a given a matrix A, the algorithm determines a scaling factor sto compute an approximation Pm(A/2s)for eA/2s, so
that
eA(Pm(A/2s))2s.
Bernoulli polynomials and Bernoulli numbers have been extensively used in several areas of mathematics, as number
theory, and they appear in many mathematical formulas, such as the residual term of the Euler-Maclaurian quadrature
rule [5, p. 63], the Taylor series expansion of the trigonometric functions tan (x),csc (x)and cot (x)[5, p. 116-117]
and in the Taylor series expansion of the hyperbolic function tanh (x)[5, p. 125]. They are also employed in the well
known exact expression of the even values of the Riemann zeta function:
ξ(2k) = X
i1
1
i2k=(1)k1B2k(2π)2k
2(2k)! , k 1.
Moreover, they are even used for solving other problems, such as initial value problem , boundary value
problem , etc. An excelent survey about Bernoulli polynomials and its applicacions can be found in .
This paper presents a new series development of the exponential matrix in terms of the
Bernoulli matrix polynomials which shows that the polynomial approximations of the
exponential matrix are more accurate and less computationally expensive in most cases than
Our proposal
On Bernoulli matrix polynomials
Bernoulli polynomials Bm(x)are deﬁned in [5, p.588] as the coefﬁcients of the generating function
g(x, t) = tetx
et1=X
m0
Bm(x)
m!tm,|t|<2π, (1)
where g(x, t)is an holomorphic function in Cfor the variable t, with an avoidable singularity in t= 0.
A Bernoulli polynomial Bm(x)has the explicit expression
Bm(x) =
m
X
k=0 m
kBkxmk.
where the Bernoulli numbers are deﬁned by Bm=Bm(0). Therefore, it follows that the Bernoulli numbers satisfy
z
ez1=X
k0
Bk
k!zk,|z|<2π,
where
Bk=
k1
X
i=0 k
iBi
k+ 1 i, k 1,
with B0= 1. Note that B3=B5=· · · =B2k+1 = 0, for k1. Thus, for a matrix ACn×n, we deﬁne the m-th Bernoulli
matrix polynomial by the expression
Bm(A) =
m
X
k=0 m
kBkAmk.
In this way, the exponential of matrix Acan be computed as
eAt =et1
tX
k0
Bk(A)tk
k!,|t|<2π, (2)
where Bk(A)is the k-th Bernoulli matrix polynomial. If we take sas the scaling value of matrix Aand t= 1 in (2),
then we can compute the matrix exponential approximation as
eA2s(e1)
m
X
k=0
Bk(A2s)
k!.(3)
To use this formula operatively for the approximation of the exponential matrix, we must determine, for a given matrix
A, the scaling factor sand the degree mof the approximation (3).
References
 C. VAN LOAN.A study of the matrix exponential, Numerical Analysis Report, Tech. rep., Manchester Institute for
Mathematical Sciences, Manchester University (2006).
 G. A. BAKER, P. R. GRAVES-MORRIS.Padé Approximants, Encyclopedia of Mathematics and its Applications
Edition, Cambridge University Press, 1996.
 J. SASTRE, J. IBÁÑEZ, E. DEFEZ, P. RUIZ.New scaling-squaring taylor algorithms for computing the matrix expo-
nential, SIAM Journal on Scientiﬁc Computing 37 (1) (2015) A439–A455.
 J. SASTRE, J. IBÁÑEZ, E. DEFEZ, P. RUIZ.Efﬁcient orthogonal matrix polynomial based method for computing
matrix exponential, Applied Mathematics and Computation 217 (14) (2011) 6451–6463.
 F. W. OLVER, D. W. LOZIER, R. F. BOISVERT, C. W. CLARK.NIST handbook of mathematical functions hardback
and CD-ROM, Cambridge University Press, 2010.
 E. TOHIDI, K. ERFANI, M. GACHPAZAN, S. SHATEYI.A new Tau method for solving nonlinear Lane-Emden type
equations via Bernoulli operational matrix of differentiation, Journal of Applied Mathematics 2013 (2013).
 A. W. ISLAM, M. A. SHARIF, E. S. CARLSON.Numerical investigation of double diffusive natural convection of co2
in a brine saturated geothermal reservoir, Geothermics 48 (2013) 101–111.
 O. KOUBA. Lecture Notes, Bernoulli Polynomials and Applications, arXiv preprint arXiv:1309.7560 (2013).
 AWAD H. AL-MOHY AND NICHOLAS J. HIGHAM.A new scaling and squaring algorithm for the matrix exponential,
SIAM Journal on Matrix Analysis and Applications 31(3), 2009.
 P. RUIZ, J. SASTRE, J. IBÁÑEZ, E. DEFEZ.High perfomance computing of the matrix exponential. Journal of
Computational and Applied Mathematics, v. 291, 370–379, 2016.
 N. J. HIGHAM.The Test Matrix Toolbox for MATLAB. Numerical Analysis Report No. 237, Manchester, Eng., 1993.
 T. G. WRIGHT.Eigtool, version 2.1.web.comlab.ox.ac.uk/pseudospectra/eigtool, 2009.
 NICHOLAS J. HIGHAM.Functions of Matrices: Theory and Computation. SIAM, Philadelphia, PA, USA, 2008.
References
 C. VAN LOAN.A study of the matrix exponential, Numerical Analysis Report, Tech. rep., Manchester Institute for
Mathematical Sciences, Manchester University (2006).
 G. A. BAKER, P. R. GRAVES-MORRIS.Padé Approximants, Encyclopedia of Mathematics and its Applications
Edition, Cambridge University Press, 1996.
 J. SASTRE, J. IBÁÑEZ, E. DEFEZ, P. RUIZ.New scaling-squaring taylor algorithms for computing the matrix expo-
nential, SIAM Journal on Scientiﬁc Computing 37 (1) (2015) A439–A455.
 J. SASTRE, J. IBÁÑEZ, E. DEFEZ, P. RUIZ.Efﬁcient orthogonal matrix polynomial based method for computing
matrix exponential, Applied Mathematics and Computation 217 (14) (2011) 6451–6463.
 F. W. OLVER, D. W. LOZIER, R. F. BOISVERT, C. W. CLARK.NIST handbook of mathematical functions hardback
and CD-ROM, Cambridge University Press, 2010.
 E. TOHIDI, K. ERFANI, M. GACHPAZAN, S. SHATEYI.A new Tau method for solving nonlinear Lane-Emden type
equations via Bernoulli operational matrix of differentiation, Journal of Applied Mathematics 2013 (2013).
 A. W. ISLAM, M. A. SHARIF, E. S. CARLSON.Numerical investigation of double diffusive natural convection of co2
in a brine saturated geothermal reservoir, Geothermics 48 (2013) 101–111.
 O. KOUBA. Lecture Notes, Bernoulli Polynomials and Applications, arXiv preprint arXiv:1309.7560 (2013).
 AWAD H. AL-MOHY AND NICHOLAS J. HIGHAM.A new scaling and squaring algorithm for the matrix exponential,
SIAM Journal on Matrix Analysis and Applications 31(3), 2009.
 P. RUIZ, J. SASTRE, J. IBÁÑEZ, E. DEFEZ.High perfomance computing of the matrix exponential. Journal of
Computational and Applied Mathematics, v. 291, 370–379, 2016.
 N. J. HIGHAM.The Test Matrix Toolbox for MATLAB. Numerical Analysis Report No. 237, Manchester, Eng., 1993.
 T. G. WRIGHT.Eigtool, version 2.1.web.comlab.ox.ac.uk/pseudospectra/eigtool, 2009.
 NICHOLAS J. HIGHAM.Functions of Matrices: Theory and Computation. SIAM, Philadelphia, PA, USA, 2008.
Numerical Experiments
We have compared the next three routines to compute the exponential of a matrix:
expade: a MATLAB function based on the Padé rational approximation for the matrix exponential ;
exptay: a MATLAB code based on the Taylor series evaluated by means of Paterson-Stockmeyer .
expber: the new MATLAB function based on Bernoulli series presented in this paper;
The test has consisted on 256 matrices of size 128 ×128 taken from the next 4 types:
100 diagonalizable matrices with real and complex eigenvalues.
100 non-diagonalizable complex matrices with eigenvalue multiplicity 1.
40 real matrices from the function matrix of the Matrix Computation Toolbox .
16 matrices taken from the Eigtool MATLAB package .
The “exact” matrix exponential has been computed using MATLAB symbolic versions a scaled Taylor Paterson-
Stockmeyer approximation, with 256 decimal digit arithmetic and trying several orders mand/or scaling parameters
s, all of them higher than the ones used by expade and exptay, respectively. We checked that their relative difference
was small enough. The algorithm accuracy was tested by computing the relative error
E=kexp(A)˜
Yk1
kexp(A)k1
,
where ˜
Yis the computed solution and exp(A)is the exact one. We also have used MATLAB function funm_condest1
to estimate the condition number of the matrix 1-norm.
Table 1 shows the percentage of cases in which the relative errors of expber are, respectively, lower than, greater
than, or equal to the relative errors of the other algorithms under test.
Table 1: Relative error comparison of expber with expade and exptay, respectively.
Figure 2 shows some results of this test:
Figure 2 a) shows the normwise relative errors. The solid line is the function kexpu, where kexp is the condition
number of matrix exponential function [13, Chapter 3] and u= 253 is the unit roundoff in the double precision
ﬂoating-point arithmetic.
In the performance proﬁle (Fig. 2 b)), the αcoordinate varies between 1 and 5 in steps equal to 0.1, and the p
coordinate is the probability that the considered algorithm has a relative error lower than or equal to α-times the
smallest error over all methods.
The ratios of relative errors (Fig. 2 c)) are presented in decreasing order with respect to E(expber)/E(exptay)
Figure 2 d) shows the ratio of the computational cost measured in the number of matrix products.
0 50 100 150 200 250 300
Matrix
10-20
10-15
10-10
10-5
100
Er
cond*u
expber
exptay
12345
0
0.2
0.4
0.6
0.8
1
p
expber
exptay
a) Normwise relative errors. b) Performance Proﬁle.
0 50 100 150 200 250 300
Matrix
10-10
10-5
100
105
1010
Ratio relative errors
E(expber)/E(exptay)
0 50 100 150 200 250 300
Matrix
0.5
1
1.5
Ratio matrix products
M(expber)/M(exptay)
c) Relative error ratio. d) Matrix product ratio.
Fig. 2: Results of the test.
We have taken advantage of the previous developments regarding the MEX ﬁles for the exptay code in the new one,
thus, both exptay and expber are able to exploit an existing NVIDIA GPU in the node.
Table 2 shows the performance of exptay and expber for large matrices in both the CPU and GPU.
The CPU is formed by two processors with 20 cores each (Intel Xeon CPU E5-2698 v4 @2.20GHz).
The GPU is an NVIDIA Tesla P100-SXM2.
n= 1000 1500 2000 2500 3000 3500 4000 4500 5000 5500 6000
exptay CPU 0.23 0.51 0.90 1.88 2.54 4.11 5.17 7.62 10.29 13.22 17.30
GPU 0.11 0.18 0.27 0.53 0.83 1.22 1.73 2.29 2.89 3.47 4.71
expber CPU 0.23 0.85 1.06 1.92 2.78 4.02 5.48 7.50 10.11 14.12 17.00
GPU 0.10 0.27 0.29 0.57 0.89 1.35 1.81 2.37 3.11 3.51 4.47
Table 2: Comparison in time (sec.) for large matrices in CPU and GPU.
Conclusions
All the three implementations, i.e. expade,exptay, and expber, have similar numerical stability. Functions based
on polynomial approximations are more accurate than the one based on Padé approximants, being the new function
expber slightly more accurate than our former code exptay.
In terms of matrix products, expber and exptay perform exactly the same and both have a 7% lower computational