Navigation

You must have Macaulay2 installed on your computer
for this interface to work. Macaulay2 is not included with Sage,
but you can obtain it from https://faculty.math.illinois.edu/Macaulay2/.
No additional optional Sage packages are required.

Sage provides an interface to the Macaulay2 computational algebra
system. This system provides extensive functionality for commutative
algebra. You do not have to install any optional packages.

The Macaulay2 interface offers three pieces of functionality:

macaulay2_console() – A function that dumps you
into an interactive command-line Macaulay2 session.

macaulay2.eval(expr) – Evaluation of arbitrary Macaulay2
expressions, with the result returned as a string.

macaulay2(expr) – Creation of a Sage object that wraps a
Macaulay2 object. This provides a Pythonic interface to Macaulay2. For
example, if f=macaulay2(10), then f.gcd(25) returns the
GCD of \(10\) and \(25\) computed using Macaulay2.

If this Macaulay2 element is a polynomial, return a string
representation of this polynomial that is suitable for
evaluation in Python. Thus * is used for multiplication
and ** for exponentiation. This function is primarily
used internally.

Returns: the input string with \(n\) symbols removed from the beginning of
each line, where \(n\) is the minimal number of spaces or symbols of
Macaulay2 output labels (looking like ‘o39 = ‘) present on every non-empty
line.

Return type: string

Note

If s consists of several outputs and their labels have
different width, it is possible that some strings will have leading
spaces (or maybe even pieces of output labels). However, this
function will try not cut any messages.