Interface to MuPAD

AUTHOR:

  • Mike Hansen
  • William Stein

You must have the optional commercial MuPAD interpreter installed and available as the command code{mupkern} in your PATH in order to use this interface. You do not have to install any optional sage packages.

TESTS:

sage: mupad.package('"MuPAD-Combinat"')                        # optional - mupad
sage: combinat = mupad.combinat                                # optional - mupad
sage: examples = mupad.examples                                # optional - mupad
sage: S = examples.SymmetricFunctions()                        # optional - mupad
sage: S.s[2,1]^2                                               # optional - mupad
s[3, 3] + s[4, 2] + s[2, 2, 1, 1] + s[2, 2, 2] + 2 s[3, 2, 1] + s[4, 1, 1] +
s[3, 1, 1, 1]
sage: S.omega( S.s[3] )                                        # optional - mupad
s[1, 1, 1]
sage: s = S.s                                                  # optional - mupad
sage: p = S.p                                                  # optional - mupad
sage: s(s[2,1] + p[2,1])                                       # optional - mupad
s[2, 1] + s[3] - s[1, 1, 1]
sage: s(_)                                                     # optional - mupad
s[2, 1] + s[3] - s[1, 1, 1]

sage: combinat.tableaux.list(3)                                # optional - mupad # note: the order of the result seems to depend on the version of MuPAD / MuPAD-Combinat
            --                                      +---+ --
            |                                       | 3 |  |
            |                 +---+      +---+      +---+  |
            |                 | 3 |      | 2 |      | 2 |  |
            |  +---+---+---+  +---+---+  +---+---+  +---+  |
            |  | 1 | 2 | 3 |, | 1 | 2 |, | 1 | 3 |, | 1 |  |
            -- +---+---+---+  +---+---+  +---+---+  +---+ --
sage: three = mupad(3)                                        # optional - mupad
sage: three.combinat.tableaux.list()                          # optional - mupad
            --                                      +---+ --
            |                                       | 3 |  |
            |                 +---+      +---+      +---+  |
            |                 | 3 |      | 2 |      | 2 |  |
            |  +---+---+---+  +---+---+  +---+---+  +---+  |
            |  | 1 | 2 | 3 |, | 1 | 2 |, | 1 | 3 |, | 1 |  |
            -- +---+---+---+  +---+---+  +---+---+  +---+ --
sage: t = _[1]                                                # optional - mupad
sage: t                                                       # optional - mupad
                             +---+---+---+
                             | 1 | 2 | 3 |
                             +---+---+---+
sage: combinat.tableaux.conjugate(t)                          # optional - mupad
                                 +---+
                                 | 3 |
                                 +---+
                                 | 2 |
                                 +---+
                                 | 1 |
                                 +---+

sage: combinat.ribbonsTableaux.list([2,2],[1,1],2)           # optional - mupad
                       -- +---+---+  +---+---+ --
                       |  |   | 2 |  |     2 |  |
                       |  +   +   +, +---+---+  |
                       |  | 1 |   |  | 1     |  |
                       -- +---+---+  +---+---+ --
sage: combinat.tableaux.kAtom([2,1],3)                      # optional - mupad
                              -- +---+     --
                              |  | 2 |      |
                              |  +---+---+  |
                              |  | 1 | 1 |  |
                              -- +---+---+ --
sage: M = S.Macdonald()                                    # optional - mupad
sage: a = M.P[1]^2                                         # optional - mupad
sage: mupad.mapcoeffs(a, 'normal')                         # optional - mupad
                             q - t + q t - 1
                      P[2] + --------------- P[1, 1]
                                 q t - 1
class sage.interfaces.mupad.Mupad(maxread=1000, script_subdirectory=None, server=None, server_tmpdir=None, logfile=None)

Bases: sage.interfaces.expect.Expect

Interface to the MuPAD interpreter.

completions(string, strip=False)

EXAMPLES:

sage: mupad.completions('linal') # optional - mupad
['linalg']
console()

Spawn a new MuPAD command-line session.

EXAMPLES:

sage: mupad.console() #not tested

   *----*    MuPAD Pro 4.0.2 -- The Open Computer Algebra System
  /|   /|
 *----* |    Copyright (c)  1997 - 2007  by SciFace Software
 | *--|-*                   All rights reserved.
 |/   |/
 *----*      Licensed to:   ...
cputime(t=None)

EXAMPLES:

sage: t = mupad.cputime() #random, optional - MuPAD
0.11600000000000001
eval(code, strip=True, **kwds)

EXAMPLES:

sage: mupad.eval('2+2')   # optional - mupad
                                       4
expect()

EXAMPLES:

sage: a = mupad(1)   # optional - mupad
sage: mupad.expect() # optional - mupad
<pexpect.spawn instance at 0x...>
get(var)

Get the value of the variable var.

EXAMPLES:

sage: mupad.set('a', 4) # optional - mupad
sage: mupad.get('a').strip() # optional - mupad
'4'
set(var, value)

Set the variable var to the given value.

EXAMPLES:

sage: mupad.set('a', 4) # optional - mupad
sage: mupad.get('a').strip() # optional - mupad
'4'
trait_names(verbose=True, use_disk_cache=True)

EXAMPLES:

sage: names = mupad.trait_names() # optional - mupad
sage: len(names) > 100 # optional - mupad
True
sage: 'combinat' in names # optional - mupad
True
class sage.interfaces.mupad.MupadElement(parent, value, is_name=False, name=None)

Bases: sage.interfaces.expect.ExpectElement

trait_names()

EXAMPLES:

sage: mupad.package('"MuPAD-Combinat"')       # optional - mupad-Combinat
sage: S = mupad.examples.SymmetricFunctions() # optional - mupad-Combinat
sage: 'HallLittlewood' in S.trait_names()     # optional - mupad-Combinat
True
class sage.interfaces.mupad.MupadFunction(parent, name)

Bases: sage.interfaces.expect.ExpectFunction

trait_names()

EXAMPLES:

sage: mupad.linalg.trait_names() # optional - mupad
['addCol',
 'addRow',
 ...
 'wiedemann']
class sage.interfaces.mupad.MupadFunctionElement(obj, name)

Bases: sage.interfaces.expect.FunctionElement

trait_names()

EXAMPLES:

sage: three = mupad(3) # optional - mupad
sage: 'list' in three.combinat.tableaux.trait_names() # optional - mupad
True
sage.interfaces.mupad.mupad_console()

Spawn a new MuPAD command-line session.

EXAMPLES:

sage: from sage.interfaces.mupad import mupad_console
sage: mupad_console() #not tested

   *----*    MuPAD Pro 4.0.2 -- The Open Computer Algebra System
  /|   /|
 *----* |    Copyright (c)  1997 - 2007  by SciFace Software
 | *--|-*                   All rights reserved.
 |/   |/
 *----*      Licensed to:   ...
sage.interfaces.mupad.reduce_load_mupad()

EXAMPLES:

sage: from sage.interfaces.mupad import reduce_load_mupad
sage: reduce_load_mupad()
Mupad

Previous topic

Library interface to Maxima

Next topic

Interface to mwrank

This Page