Skip to main content
Log in

Efficient algorithms for the matrix cosine and sine

  • Published:
Numerical Algorithms Aims and scope Submit manuscript

Abstract

Several improvements are made to an algorithm of Higham and Smith for computing the matrix cosine. The original algorithm scales the matrix by a power of 2 to bring the ∞-norm to 1 or less, evaluates the [8/8] Padé approximant, then uses the double-angle formula cos (2A)=2cos 2AI to recover the cosine of the original matrix. The first improvement is to phrase truncation error bounds in terms of ‖A21/2 instead of the (no smaller and potentially much larger quantity) ‖A‖. The second is to choose the degree of the Padé approximant to minimize the computational cost subject to achieving a desired truncation error. A third improvement is to use an absolute, rather than relative, error criterion in the choice of Padé approximant; this allows the use of higher degree approximants without worsening an a priori error bound. Our theory and experiments show that each of these modifications brings a reduction in computational cost. Moreover, because the modifications tend to reduce the number of double-angle steps they usually result in a more accurate computed cosine in floating point arithmetic. We also derive an algorithm for computing both cos (A) and sin (A), by adapting the ideas developed for the cosine and intertwining the cosine and sine double angle recurrences.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. P.I. Davies and N.J. Higham, A Schur–Parlett algorithm for computing matrix functions, SIAM J. Matrix Anal. Appl. 25(2) (2003) 464–485.

    Article  Google Scholar 

  2. N.J. Higham, Functions of a Matrix: Theory and Computation, in preparation.

  3. N.J. Higham, The Matrix Computation Toolbox, http://www.ma.man.ac.uk/~higham/mctoolbox.

  4. N.J. Higham, Evaluating Padé approximants of the matrix logarithm, SIAM J. Matrix Anal. Appl. 22(4) (2001) 1126–1135.

    Article  Google Scholar 

  5. N.J. Higham, The scaling and squaring method for the matrix exponential revisited, SIAM J. Matrix Anal. Appl. 26(4) (2005) 1179–1193.

    Article  Google Scholar 

  6. N.J. Higham and M.I. Smith, Computing the matrix cosine, Numerical Algorithms 34 (2003) 13–26.

    Article  Google Scholar 

  7. C.S. Kenney and A.J. Laub, Condition estimates for matrix functions, SIAM J. Matrix Anal. Appl. 10(2) (1989) 191–209.

    Article  Google Scholar 

  8. A. Magnus and J. Wynn, On the Padé table of cos z, Proc. Amer. Math. Soc. 47(2) (1975) 361–367.

    Google Scholar 

  9. M.S. Paterson and L.J. Stockmeyer, On the number of nonscalar multiplications necessary to evaluate polynomials, SIAM J. Comput. 2(1) (1973) 60–66.

    Article  Google Scholar 

  10. S.M. Serbin, Rational approximations of trigonometric matrices with application to second-order systems of differential equations, Appl. Math. Comput. 5(1) (1979) 75–92.

    Article  Google Scholar 

  11. S.M. Serbin and S.A. Blalock, An algorithm for computing the matrix cosine, SIAM J. Sci. Statist. Comput. 1(2) (1980) 198–204.

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Gareth I. Hargreaves.

Additional information

Communicated by C. Brezinski

AMS subject classification

65F30

Numerical Analysis Report 461, Manchester Centre for Computational Mathematics, February 2005.

Gareth I. Hargreaves: This work was supported by an Engineering and Physical Sciences Research Council Ph.D. Studentship.

Nicholas J. Higham: This work was supported by Engineering and Physical Sciences Research Council grant GR/T08739 and by a Royal Society–Wolfson Research Merit Award.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Hargreaves, G.I., Higham, N.J. Efficient algorithms for the matrix cosine and sine. Numer Algor 40, 383–400 (2005). https://doi.org/10.1007/s11075-005-8141-0

Download citation

  • Received:

  • Accepted:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11075-005-8141-0

Keywords

Navigation