Ask Your Question
1

Mittag-Leffler

asked 2022-07-20 14:12:22 +0200

Cyrille gravatar image

Are Mittag-Leffler function implemented in Sagemath ?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2022-07-22 20:26:42 +0200

slelievre gravatar image

updated 2022-07-24 07:55:27 +0200

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
edit flag offensive delete link more

Comments

In the same vein :

sage: mathematica.MittagLefflerE?
Signature:   mathematica.MittagLefflerE(*args, **kwds)
Type:        MathematicaFunction
String form: MittagLefflerE
File:        /usr/local/sage-9/src/sage/interfaces/mathematica.py
Docstring:  
MittagLefflerE[α, z] gives the Mittag–Leffler function E  (z).
   α

MittagLefflerE[α, β, z] gives the generalized Mittag–Leffler function
   E      (z).
      α, β

which uses either a local Mathematica install or the (gratis, if not free) Wolfram engine.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2022-07-23 17:52:24 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-07-20 14:12:22 +0200

Seen: 69 times

Last updated: Jul 24