File Exchange

image thumbnail

Mittag-Leffler function

version (2.74 KB) by Igor Podlubny
Calculates the Mittag-Leffler function with desired accuracy.


Updated 07 Sep 2012

View Version History

View License

This is a MATLAB routine for evaluating the Mittag-Leffler function with two parameters (sometimes also called generalized exponential function).

The Mittag-Leffler function with two parameters plays an important role and appears frequently in solutions of fractional differential equations (i.e. differential equations containing fractional derivatives).

MLF(alpha,beta,Z,P) is the Mittag-Leffler function E_{alpha,beta}(Z) evaluated with accuracy 10^(-P) for each element of Z.

Update 2009-03-25:
(1) Now Z can also be a two-dimensional array.
(2) Addressed the issue reported by Li Jackie. It was caused by rounding errors during computations.

Update 2012-09-07:
(1) Addressed the potential issue reported by Brian Bigler.
(2) Code clean up.

Cite As

Igor Podlubny (2021). Mittag-Leffler function (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (56)

Srivatsa Vasudevan

Why am I not able to run Mittag Leffler function on the online version? Is there some package I must download

@Mubashara Wali Did you tried with beta=1?

Mubashara Wali

what is the code for Mittag Leffler function with one paameter?

Thanks so much for this useful code. I am beginner at M-L functions and does not understand the oscilations that I've gotten when I put alf=0.95 and bet=1. .
I'd be very grateful if one could help me. Thank you.

志广 李

thank you

Takashi Ohe

Hao Qiu


Dai Lei

楼主thank you

Mikulas Klimko

suresh kumar

what is the input command


Thank you very much!

Fernando S. Silva

Wesley Carmo

Xuhuan Wang

Thank you very much!




Thanks for contributing this.

I think there is an issue for alpha<1 with beta=1.

I have only tested it for the above cases and for real z, but this code shows the problem:

z = linspace(0,10,100);

As a previous comment says, this code is based on a paper by Gorenflo et al. Direct evaluation of equation 23 using a numerical integration routine gives the correct results and is reasonably efficient.

ahmed elakhdar

Thank you for your useful contribution.

Pantelis Sopasakis

I would like to understand the math behind this implementation? Is there some reference for further information? Thank you in advance.

Pantelis Sopasakis


Thank you very much for your useful contribution.

Iphy kelvin

I need help urgently.i need the math-lab function name for Mainardi function and as for the Mittag-Leffler function name,when i used it in mathlab 2013.the software said undefined function 'mlf'.
what should i do??


jukkrit kluabwang

Thank you very much for your useful contribution.

Amr AbdelAty

Thanks professor igor for this valuable file.
I noticed a little discontinuity near t=12 when executing this code

>> t=0:0.001:50;
>> y=mlf(0.5,0.5,-t,5);
>> plot(t,y)

I will be very thankful for any advice.


Pritesh Shah

It is very useful function for implementation of fractional calculus in relativity.
Need small help, E^(3)(0.3,1.9)(-t^0.3).

How do I calculate this function?

qi xiang


very good.

Elias Wegert

Positive: The routine computes the function in regions where the Taylor series fails.
Negative: Computations are relatively slow and not completely reliable, for example, alpha=1/2, beta=1 and z near the imaginary axis (probably directly on the imaginary axis) yield completely wrong results (see the phase portrait at

Zhuo Li


I have one more remark. I found this article on internet:

and it seemed to me that your code is based on it. Probably a reference in your code to this paper (or the theory behind your code), can help other people understand your code.

Igor Podlubny

To Ondrej: : we assume alpha > 0, beta > 0. Thank you for the comment on the exception.


I am not sure, but there might be potential bugs in case a=0.

If a=0, code jumps to the end, at tries to evaluate variable "e"..which does not exist.
Also, as far as I know, case a=0, b=1, corresponds to sum of geometric progression (1/(1-z)), therefore a=0, should be allowed in the code.

wang xiao

Thank you!


Thank you Igor!


This function is excellent and exactly what I needed!

One potential bug:
The compound inequality on line 36 (1<=alf<2) always evaluates to true (1<=alf evaluates to a logical 0 or 1, which is always less than 2). I don't think this was the statement's intent.



Roberto Garrappa

It is a very robust code and is very useful in several applications. An excellent work. It is a reference for practical computation in Fractional Calculus.

udita katugampola

Thanks for the contribution to the field of Fractional Calculus.

Maxwelldemon ??

The code is very very helpful. Thanks a lot. However, there exists a problem:
When 1<alfa<2, beta>1, the returned value has a jump when the variable z is around -170. When alfa=1.5, I tried beta=1.5, 2.5, 3.5, the jump always happens around -170.
Furthermore, in the code, I can't find computations for the case 1<alfa<2, when z>floor(20/(2.1-alfa)^(5.5-2*alfa)).
I will be very thankful for any advice.

Haitao Qi

Thanks. It's the best.

Ivo Petras

Thanks. It works excellent.

tamer nabil

Li Jackie

Why there exists complex value in the numerical result of the Mittag-Leffler function when the variable (named z) is real?
Recently I used the programe MLF.m to compute the Mittag-Leffler function in Matlab. But I had a problem that there existed complex value in the numerical result of the Mittag-Leffler function. Since the interval of z (variable of function) I setted is a subset of real space, I can't explain why appearence of complex value of Mittag-Leffler function. Could someone give me some advice? Hope it will not delay you too much time. Thanks.

Assabaa Mohamed

can you send me a complete code for simulating the fractional oscillator,I need it urgently to confirm an idea. thanks a lot

Eduardo Cuesta

This function has been useful to me and taking an overview to the code, this seems to be vere, very fine.

Vamsi Krishna

That was very very helpful sir.Please let me know the algorithm you have used or any reference paper which contains the properties you have used.Please let me know if you have written the code for MLF with three parameters.

mervyn yian

may i know do u have a complete code for simulating the fractional oscillator........i need in urgently. thanks a lot

Enrico Scalas

It is a nice and useful algorithm.

saeed alavi

thank a lot .

Alvaro Cartea

It is great to have someone like Podlubny put the code out. This saves people in the field a great deal of time!!

Wang Shaowei

Thank Prof.Igor Podlubny!

Lingzao zeng

Excellent.Thanks a lot

YangQuan Chen

Thanks for the contribution.

MATLAB Release Compatibility
Created with R12
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!