File Exchange

## Computation of Special Functions

version 1.0.0.0 (139 KB) by

MATLAB translation (via f2matlab) of the original FORTRAN of "Computation of Special Functions."

Updated

MATLAB routines for computation of Special Functions

These routines are a direct translation, performed using f2matlab, of the original FORTRAN-77 implementation of "Computation of Special Functions."

For detailed description of the algorithm of each program, please consult the book "Computation of Special Functions."
Also see Errata at:
http://ceta.mit.edu/comp_spec_func/

Bernoulli numbers
Euler numbers
Chebyshev, Laguerre, and Hermite polynomials
Gauss-Laguerre
Gauss-Hermite
gamma function.
logarithm of the gamma function.
gamma function with a complex argument.
beta function.
psi function.
psi function with a complex argument.
incomplete gamma function.
incomplete beta function.
Legendre polynomials
Legendre functions of the second kind
associated Legendre polynomials
Bessel functions of the first and second kinds
zeros of the Bessel functions of the first and second kinds
lambda functions
modified Bessel functions of the first and second kinds
Hankel functions of the first and second kinds
integral of Bessel functions J0(t) and Y0(t) from 0 to x
integral of [1-J0(t)]/t from 0 to x and Y0(t)/t from x to infinity
integral of modified Bessel functions I0(t) and K0(t) from 0 to x
integral of [1-I0(t)]/t from 0 to x and K0(t) from x to infinity
spherical Bessel functions of the first and second kinds
Riccati-Bessel functions of the first kind and second kind
modified spherical Bessel functions of the first kind and second kind
Kelvin functions
zeros of the Kelvin functions
Airy functions
integral of the Airy functions.
zeros of Airy functions
Struve functions with an arbitrary order
integral of Struve function H0(t) from 0 to x.
integral of H0(t)/t from x to infinity.
modified Struve function with an arbitrary order.
integral of modified Struve function L0(t) from 0 to x.
hypergeometric function
hypergeometric function M(a,b,z)
hypergeometric function U(a,b,x)
parabolic cylinder functions Dv(z)
parabolic cylinder functions Vv(x)
parabolic cylinder functions W(a,+/-x)
characteristic values for the Mathieu and modified Mathieu functions.
expansion coefficients for the Mathieu and modified Mathieu functions.
Mathieu functions
modified Mathieu functions of the first and second kinds
characteristic values for spheroidal wave functions.
angular spheroidal wave functions
error function.
Fresnel Integrals.
modified Fresnel integrals.
complex zeros of the error function.
complex zeros of the Fresnel Integrals.
cosine and sine integrals
complete and incomplete elliptic integrals of the first and second kinds.
complete and incomplete elliptic integrals of the third kind.
Jacobian elliptic functions.
exponential integral E1(x)
exponential integrals En(x)
exponential integral Ei(x)

Mazin Mustafa

mahesh singh

Liu Langtian

### Liu Langtian (view profile)

how to use this package

Liu Langtian

HAI

### HAI (view profile)

I believe it very useful, but how I can get the collection?

Marzieh

Marzieh

### Marzieh (view profile)

Great job,Really nice!

Beijing Jiaotong University

Thanks!

David Holdaway

### David Holdaway (view profile)

while useful these are extremely hard to read functions. I have been having problems with mchgu for vectorised inputs. This appears to be due to the logic choices for high and low arguments not working for vectorised x.

For instance
mchgu(11,1/2,[-100,100]) =
1.0e-21 *[-0.4281 0.0320]
gives the correct answer, where as
mchgu(11,1/2,[-100,0,100] =
1.0e+46 * [5.3505 - 4.4981i 0.0000 -4.9590 ]
is wrong by many many orders of magnitude.
Essentially it works fine for single arguments but not vectors.

shahin Eskandari

MLM

### MLM (view profile)

I tried the Associated Legendre Function for complex arguments and it is helpful, thanks.
But it seems to have a little flaw. When displaying the calculated values, it just displays only the real part of the answer, although the answer is complex. It might be helpful if you alter it, so that others can use it without checking it. Please let me know, if I have missed or misunderstood anything regarding that answer being complex.
Anyway Great work.

Chih-Ying Hsiao

Chamane

Dorra

### Dorra (view profile)

very helpful but i have a little bit difficulty to find the function i need

Da Ma

### Da Ma (view profile)

very useful and good work!

yogendra prajapati

I cannot understand how to use derivative of modified Mathieu function first and second kind.any one tell me.

Ellips Wang

Mathieu angle function is not correct. How to correct it? Thank you. I also need the spheroidal function.

Eduardo Kausel

This collection of special mathematical functions originated in Fortran programs by S. Zhang & J. Jin, which accompany their book "Computation of Special Functions" (Wiley, 1996). The Matlab versions are direct machine conversions of the Fortran sources via an automatic translation program.

These functions provide a valuable base from which to build a useful library of advanced mathematical functions, but users should exercise caution in their use. First, the machine translations are not particularly pretty, for the code has no indented nested statements, and none of the routines is vectorized (i.e. vector arguments, loops, initializations, and the like). Also, the code is chock-full with magic numbers at the local level of the statements (decision flags, transition values, etc) that are neither explained nor defined. Furthermore, the codes are completely devoid of comments, and all input arguments are needlessly returned as output arguments. In summary, these functions constitute so-called spaghetti code.

More importantly --and unfortunately-- the routines are also rather buggy and suffer from miscellaneous intrinsic errors. For example, the code for Struve functions gives erroneous values for complex and negative numbers. This is because no careful attention was paid to analytic continuation relations in the complex plane. In my work, I have used several of these functions, and in every case I have found errors of some sort. Thus, every time I adopt one of these functions for some purpose, I begin by closely examining in detail what it does (the Handbook of Mathematical Functions by Abramovitz and Stegun is an invaluable resource for this purpose), completely re-writing the code in good Matlab style (including indentation, vectorization and comments) and then thoroughly checking the results for a range of values (small, large, complex, negative, integers, etc). You should do the same.

sepp sepp

Many of the functions do not work.
see for example mclqn.m
The reason herefore is the conversion
from fortran code. Would be nice if the author could try the conversion once again with a newer version of f2matlab

Quan Hieu Huynh

It is helpful, but incomplete. Have you done a Meijer G function? If yes, please send it to me. I need it.
Thank you a lot.

Nicolas Marchand

Essential !

arthur cao

great!thanks a lots.

jason tharmaraj

it is very interesting for beginers and very useful

Igor Moiseev

The package has to be improved. The multidimensional arrays support should be added. For elliptic function please consult mine subscription. If you have any idea about it, please concact me.

sajida malik

Ellips Wang

I tested spheroidal functions and found that mrswfp.m mrswfo.m didn't work correctly changing the values of parameters. Though I tried to the errors, the results I got had low precision especially with the small parameter. How to correct the errors, and improve the precision? Thank you very much!

Joan Baiges

I used only the gauss laguerre and gauss hermite quadratures. The functions calculate everything correctly but do not return the values. They only require a little modification and they work correctly (you can specify the number of points of integration and the function returns the vector correctly calculated).

Sumeet Gupta

Can anyone please tell me the that routine MTU12 which is used for calculating modied Mathieu functions of first and second kind also works for complex arguments (to be specific for complex q).
Also does it take into account the change in functions from radial to evanescent radial functions as q moves from positive to negative values. By this point I mean that does it take into account the fact that different second kind functions are evaluated when q is negative or positive

bruining hans

Cnnot be immediately unpacked

John Wu

Great work!! Thanks!!

hafedh gaha

Juan Pablo Carbajal

I was looking for the half-integer legendre functions of the second kind but this pack has the hypergoemetric function, that should be enough. Thanks!

Abdul Mufid

i need this software for my research

zubin jacob

can someone tell me if the mathieu function works for high orders? i found that it doesn't

bibhuti sahu

Dear Sir,
i do not know whether it is suitable for large argument to bessel functions (of first and second kind) with complex argument.

your suggestion regarding this will most welcome.

li wang

i don ont know whether it is suitable for large argument to gamma function with complex argument

 14 Apr 2005 1.0.0.0 updated files 12 Apr 2005 Modified decription 28 Jan 2005 new keywords 5 Jan 2005 Updated conversion. 16 Nov 2004 spelling fix in description
##### MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
##### Platform Compatibility
Windows macOS Linux