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:
Chebyshev, Laguerre, and Hermite polynomials
logarithm of the gamma function.
gamma function with a complex argument.
psi function with a complex argument.
incomplete gamma function.
incomplete beta function.
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
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
zeros of the Kelvin 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 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.
modified Mathieu functions of the first and second kinds
characteristic values for spheroidal wave functions.
angular spheroidal wave functions
radial spheroidal wave functions
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)
Ben Barrowes (2020). Computation of Special Functions (https://www.mathworks.com/matlabcentral/fileexchange/6218-computation-of-special-functions), MATLAB Central File Exchange. Retrieved .
how to use this package
I believe it very useful, but how I can get the collection?
Great job,Really nice!
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.
1.0e-21 *[-0.4281 0.0320]
gives the correct answer, where as
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.
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.
very helpful but i have a little bit difficulty to find the function i need
very useful and good work!
I cannot understand how to use derivative of modified Mathieu function first and second kind.any one tell me.
Mathieu angle function is not correct. How to correct it? Thank you. I also need the spheroidal function.
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.
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
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.
great!thanks a lots.
it is very interesting for beginers and very useful
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.
it will be helpful
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!
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).
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
Cnnot be immediately unpacked
Great work!! Thanks!!
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!
i need this software for my research
can someone tell me if the mathieu function works for high orders? i found that it doesn't
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.
i don ont know whether it is suitable for large argument to gamma function with complex argument
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!