MCD: Matlab programs for computing the Macdonald function for complex orders

Listed in Datasets

By Walter Gautschi

Purdue University

A collection of FORTRAN and Matlab codes and their outputs to compute the Macdonald function for complex orders by numerical quadrature.

Version 1.0 - published on 23 Apr 2014 doi:10.4231/R7B8562S - cite this Archived on 25 Oct 2016

Licensed under CC0 1.0 Universal


The use of Gaussian quadrature formulae is explored for the computation of the Macdonald function (modified Bessel function) of complex orders and positive arguments. It is shown that for arguments larger than one, Gaussian quadrature applied to the integral representation of this function is a viable approach, provided the (nonclassical) weight function is suitably chosen. In combination with Gauss–Legendre quadrature the approach works also for arguments smaller than one. For very small arguments, power series can be used. A Matlab routine is provided that implements this approach.

Cite this work

Researchers should cite this work as follows:



Matlab codes:

  • macdonald.m.txt

FORTRAN codes:

  • qmcd.f
  • qmacdonald.f.txt
  • qmcd.txt

Data Files:

  • abmacdonald.txt
  • qabmacdonald.txt
  • xwmacdonald.txt
  • xwleg01.txt
  • qxwmcdleg.txt

These serve as a companion piece to the paper "Numerical quadrature computation of the Macdonald function for complex orders," BIT 45 (2005), 593-603. (DOI: 10.1007/s10543-005-0020-5).

The Purdue University Research Repository (PURR) is a university core research facility provided by the Purdue University Libraries, the Office of the Executive Vice President for Research and Partnerships, and Information Technology at Purdue (ITaP).