version 1.3.0.0 (11.7 KB) by
Roberto Garrappa

Evaluation of the Mittag-Leffler function with 1, 2 or 3 parameters

Evaluation of the Mittag-Leffler (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 |E-Et|/(1+|E|) approx 1.0e-15

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 Mittag-Leffler functions, SIAM Journal of Numerical Analysis, 2015, 53(3), 1350-1369

Please, report any problem or comment to : roberto dot garrappa at uniba dot it

Roberto Garrappa (2021). The Mittag-Leffler function (https://www.mathworks.com/matlabcentral/fileexchange/48154-the-mittag-leffler-function), MATLAB Central File Exchange. Retrieved .

Created with
R2009b

Compatible with any release

**Inspired:**
Matrix Mittag-Leffler Function, Mittag-Leffler function with matrix arguments

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!Create scripts with code, output, and formatted text in a single executable document.

Chaoyu QUANSrivatsa VasudevanWhy am I not able to use this function in online Matlab software? Is there some package that I must download?

Joseph ArmstrongProfessor Garrappa, I've now used this algorithm extensively for multiple applications, even solving for its hessian to improve its application and I can't thank you enough! One question, will you ever extend this to gamma~=1 & alpha>1?

A AchbakProfessor Garrappa, thanks very much for making this available

David RoodmanProfessor Garrappa, thanks very much for making this available. I have just ported it to Stata/Mata. See https://github.com/droodman/Mittag-Leffler-for-Stata. I validated the implementation with Tran Quoc Viet's excellent set of test values.

Mata LaborSplendid!

Roberto GarrappaDear 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/66272-mittag-leffler-function-with-matrix-arguments and the related paper https://doi.org/10.1007/s10915-018-0699-5

Golan BelI 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 DuanTran Quoc VietDear 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/Mittag-Leffler-function-and-its-derivative

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 Mittag-Leffler 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 GarrappaDear 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 Mittag-Leffler functions, SIAM Journal of Numerical Analysis, 2015, 53(3), 1350-1369

Tran Quoc VietDear 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.0e-15 to 1.0e-8. 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 DuanGreat! 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 DespotovicHongguang SunJohn HollkampThanks 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 Mittag-Leffler function (output should be complex if alpha is complex)? Thanks!

Ivan MatychynRoberto GarrappaDear 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.

SamThanks 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 GarrappaThe algorithm implemented by this code is described in the paper:

R. Garrappa, Numerical Evaluation of two and three parameter Mittag-Leffler functions, SIAM Journal of Numerical Analysis, 2015, 53(3), 1350-1369 - doi: http://dx.doi.org/10.1137/140971191

Pantelis Sopasakisazurekim89Roberto GarrappaDear 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 AbdelAtyAmr AbdelAtyThis 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