Evaluation of the MittagLeffler (ML) function with 1, 2 or 3 parameters by means of the OPC algorithm [1]. The routine evaluates an approximation Et of the ML function E such that EEt/(1+E) approx 1.0e15
E = ML(z,alpha) evaluates the ML function with one parameter alpha for the corresponding elements of z; alpha must be a real and positive scalar. The one parameter ML function is defined as
E = sum_{k=0}^{infty} z^k/Gamma(alpha*k+1)
with Gamma the Euler's gamma function.
E = ML(z,alpha,beta) evaluates the ML function with two parameters alpha and beta for the corresponding elements of z; alpha must be a real and positive scalar and beta a real scalar. The two parameters ML function is defined as
E = sum_{k=0}^{infty} z^k/Gamma(alpha*k+beta)
E = ML(z,alpha,beta,gama) evaluates the ML function with three parameters alpha, beta and gama for the corresponding elements of z; alpha must be a real scalar such that 0<alpha<1, beta any real scalar and gama a real and positive scalar; the arguments z must satisfy Arg(z) > alpha*pi. The three parameters ML function is defined as
E = sum_{k=0}^{infty} Gamma(gama+k)*z^k/Gamma(gama)/k!/Gamma(alpha*k+beta)
NOTE: This routine implements the optimal parabolic contour (OPC) algorithm described in [1] and based on the inversion of the Laplace transform on a parabolic contour suitably choosen in one of the regions of analyticity of the Laplace transform.
REFERENCES:
[1] R. Garrappa, Numerical evaluation of two and three parameter MittagLeffler functions, SIAM Journal of Numerical Analysis, 2015, 53(3), 13501369
Please, report any problem or comment to : roberto dot garrappa at uniba dot it
Roberto Garrappa (2020). The MittagLeffler function (https://www.mathworks.com/matlabcentral/fileexchange/48154themittaglefflerfunction), MATLAB Central File Exchange. Retrieved .
1.3.0.0  Description improved 

1.3.0.0  References updated 

1.2.0.0  References updated 

1.2.0.0  Some bugs fixed and accuracy improved in some cases 

1.1.0.0  Just the description of the code has been updated 
Inspired: Matrix MittagLeffler Function, MittagLeffler function with matrix arguments
Create scripts with code, output, and formatted text in a single executable document.
Ahdia Achabbak (view profile)
Professor Garrappa, thanks very much for making this available
David Roodman (view profile)
Professor Garrappa, thanks very much for making this available. I have just ported it to Stata/Mata. See https://github.com/droodman/MittagLefflerforStata. I validated the implementation with Tran Quoc Viet's excellent set of test values.
Mata Labor (view profile)
Splendid!
Roberto Garrappa (view profile)
Dear Golan Bel, thank you for your comment. My aim was to avoid the possibility of providing a matrix as input since the results could be confused with those from the evaluation of the ML function with a matrix argument, which is a completely different computation. I will modify the code in order to better clarify this point and give a warning when on tries to give a matrix as input. If you are interested in evaluating the matrix ML function I suggest the code http://www.mathworks.com/matlabcentral/fileexchange/66272mittaglefflerfunctionwithmatrixarguments and the related paper https://doi.org/10.1007/s1091501806995
Golan Bel (view profile)
I believe that there is a problem with the code when trying to provide a matrix as an input.
The line in the code where the loop runs from 1:length(z) should be modified to run from 1:(Number of elements in the input array). For example for a matrix it should be N*M where [N,M]=size(z);
Junsheng Duan (view profile)
Tran Quoc Viet (view profile)
Dear Prof. Roberto Garrappa,
Thank you very much.
Here is the place I put the Fortran module which was translated from your Matlab code:
https://github.com/tranqv/MittagLefflerfunctionanditsderivative
This version of code supports both scalar and array (1D, 2D, 3D) input. Therein I have also released 76 test cases for calculation of both the MittagLeffler function and it derivative. (Well tested with gfortran 4.9.2 and ifort 18.0.0.)
You know, it take a couple of days to separate this module out of my own library. That is the reason why I reply you quite late. From now on this module is portable and be able to work independently.
Best regards,
Viet.
Roberto Garrappa (view profile)
Dear Tran Quoc Viet, thank you very much for you comments and appreciation. A description of the code is available in the SIAM paper [1]. Since the algorithm is based on the numerical inversion of the Laplace transform, the variable t is the real value of the generalization of the ML function for which the LT is known. Anyway, in order to evaluate the ML function, and not its generalization, the variable t is conventionally put equal to 1 and therefore it could be eliminated from the code. You are very welcome to translate the code in Fortran and share it on public domains. Please, just insert in the code a reference to the paper [1] where the algorithm is described.
[1] R. Garrappa, Numerical evaluation of two and three parameter MittagLeffler functions, SIAM Journal of Numerical Analysis, 2015, 53(3), 13501369
Tran Quoc Viet (view profile)
Dear Prof. Roberto Garrappa,
Your code works excellently when compared with others, e.g. the one from Prof. Igor Podlubny. It runs fast and especially much more accurate than the others. When we increase the value of epilson, e.g. from 1.0e15 to 1.0e8. It runs faster than that of Prof. Igor Podlubny with a controllable and acceptable accuracy.
Could I ask you one question? What is the role of the "t" in function E = LTInversion(t,lambda,alpha,beta,gama,log_epsilon) ?
Recently I have translated your Matlab code into Fortran language. You know, performance of the Fortran code runs fantastically, like an intrinsic function. Could I share it on public domain?
Beiping Duan (view profile)
Great! Much faster and more accurate than mlf.m uploaded by Prof. Igor Podlubny, which can not reach the desired accuracy when alpha>0.6.
Thank you very much!
Tomas Skovranek, Vladimir Despotovic (view profile)
Hongguang Sun (view profile)
John Hollkamp (view profile)
Thanks for the .m file! One question about the order alpha though. The code requires that alpha must be a real and positive scalar. Is it possible to alter the code so that it can handle complex values of alpha and still accurately evaluate the MittagLeffler function (output should be complex if alpha is complex)? Thanks!
Ivan Matychyn (view profile)
Roberto Garrappa (view profile)
Dear Sam, this code is not devised for matrix arguments. Anyway, we are working on this subject and we should release a code of this kind in a couple of months.
Sam (view profile)
Thanks for this .m file. I would like to ask if this can be used for MLF where z is a matrix i.e MLF with matrix argument. If no, is there available source code to compute MLF with matrix argument.
Roberto Garrappa (view profile)
The algorithm implemented by this code is described in the paper:
R. Garrappa, Numerical Evaluation of two and three parameter MittagLeffler functions, SIAM Journal of Numerical Analysis, 2015, 53(3), 13501369  doi: http://dx.doi.org/10.1137/140971191
Pantelis Sopasakis (view profile)
azurekim89 (view profile)
Roberto Garrappa (view profile)
Dear Amr AndelAty, this function works for arguments on the whole complex plane. The paper in the reference is still under review. Thank you for your suggestion.
Amr AbdelAty (view profile)
Amr AbdelAty (view profile)
This paper "Evaluation of generalized Mittag–Leffler functions on the real line" says that the argument should be positive. Does this apply to this file?
I couldn't find the paper in the references.
Also I suggest removing the imaginary part of the output if the input is pure real.
Thanks in advance