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=None, script_subdirectory=None, server=None, server_tmpdir=None, logfile=None)¶ Bases:
sage.interfaces.tab_completion.ExtraTabCompletion
,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'
-
-
class
sage.interfaces.mupad.
MupadElement
(parent, value, is_name=False, name=None)¶ Bases:
sage.interfaces.tab_completion.ExtraTabCompletion
,sage.interfaces.expect.ExpectElement
-
class
sage.interfaces.mupad.
MupadFunction
(parent, name)¶ Bases:
sage.interfaces.tab_completion.ExtraTabCompletion
,sage.interfaces.expect.ExpectFunction
-
class
sage.interfaces.mupad.
MupadFunctionElement
(obj, name)¶ Bases:
sage.interfaces.tab_completion.ExtraTabCompletion
,sage.interfaces.expect.FunctionElement
-
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