Ask Your Question

Revision history [back]

There does not seem to be an implementation in Sage.

There is an implementation in R in the MittagLeffleR R package.

It might be possible to use it from within Sage.

There does not seem to be an implementation in Sage.

There is an implementation in R in the MittagLeffleR R package.

It can be used from Sage.

To install this R package for Sage's R, run this in a terminal:

$ sage --R

Then at the R prompt (>) type:

> install.packages('MittagLeffleR')

and choose a download mirror in the numbered list.

Once the installation is complete, quit R:

> q()

Next time you launch Sage:

$ sage

you can load the MittagLeffleR R package.

It might be possible to use it from within Sage.

package:

sage: r.library('MittagLeffleR')

Then you can run commands such as:

sage: r('mlf(2, 0.7)')
[1] 20.96643
sage: r('dml(1, 0.8)')
[1] 0.2557438
sage: r('dml(1, 0.6, second.type=TRUE)')
[1] 0.4832354
sage: r('pml(2, 0.7, 1.5)')
[1] 0.6597308
sage: r('qml(p = c(0.25, 0.5, 0.75), tail = 0.6, scale = 100)')
[1]  11.64327  60.56854 284.67928
sage: r('rml(10, 0.7, 1)')
 [1] 2.863445e-01 2.189476e+00 1.013715e+00 2.465789e+00 4.260511e-01
 [6] 4.568785e-01 7.676349e-02 6.497517e-05 5.912041e-01 5.403624e-01

There does not seem to be an implementation in Sage.

There is an implementation in R in the MittagLeffleR R package.

It can be used from Sage.

To install this R package for Sage's R, run this in a terminal:

$ sage --R

Then at the R prompt (>) type:

> install.packages('MittagLeffleR')

and choose a download mirror in the numbered list.

Once the installation is complete, quit R:

> q()

Next time you launch Sage:

$ sage

you can load the MittagLeffleR R package:

sage: r.library('MittagLeffleR')

Then you can run commands such as:

sage: r('mlf(2, 0.7)')
[1] 20.96643
sage: r('dml(1, 0.8)')
[1] 0.2557438
sage: r('dml(1, 0.6, second.type=TRUE)')
[1] 0.4832354
sage: r('pml(2, 0.7, 1.5)')
[1] 0.6597308
sage: r('qml(p = c(0.25, 0.5, 0.75), tail = 0.6, scale = 100)')
[1]  11.64327  60.56854 284.67928
sage: r('rml(10, 0.7, 1)')
 [1] 2.863445e-01 2.189476e+00 1.013715e+00 2.465789e+00 4.260511e-01
 [6] 4.568785e-01 7.676349e-02 6.497517e-05 5.912041e-01 5.403624e-01

Here is a Mittag-Leffler function based on that:

def mittag_leffler(z, a, b=1, g=1):
    r"""
    Return the Mittag-Leffler function for these arguments.
    """
    r.library('MittagLeffleR')
    return r(f'mlf({z}, {a}, b={b}, g={g})').sage()

Usage:

sage: mittag_leffler(2, 0.7)
20.966433131482