Elementary Operations

In this page, we will see how to perform basic operations with polynomials and rational functions in Macaulay2. We will also learn how to create basic functions and loops.

Polynomials

Macaulay page on manipulating polynomials

Evaluating a polynomial on elements of your ring: given a polynomial h(x, y, z) in the ring QQ[x,y,z,t] for instance, and you want to evaluate it on the tuple {a_1 * t + b_1, a_2 * t + b_2, a_3 * t + b_3} where each a_i, b_i are elements of $\mathbb{Q}$, you can use the sub command as follows:

sub(h, {x => a_1 * t + b_1, y => a_2 * t + b_2, z => a_3 * t + b_3})

Substitution

Computing the Jacobian:

Jacobian Docs

Fractions

Given a polynomial ring R over a domain, we can work on its field of fractions simply by S = frac R. One issue with this operation is that the Jacobian and differentials will not work over the field of rational functions, as far as I can understand (which is not much)

Loops

For loops doc

Creating your own functions

Macaulay Language

Remark: to create a function with options, the option names need to start with a captial letter. This is not explicitly stated in the documentation, but it is the case.

Printing LaTeX output

To print a particular output of your Macaulay code in LaTeX, you can use the following command:

tex << your M2 output here >>
Previous
Next