Things I wish Macaulay2 could do WF2012

From Macaulay2
Jump to: navigation, search

polynomial I/O

I would like the most efficient, quick way to input a large file of polynomials (either produced by M2 or by something else) into M2 for computation. So, either better parsing, or a suggestion what kind of file to write so that reading later becomes quick.

Currently a 23MB file of polynomials listed as if they had come from toString might take 30 minutes to read into a fresh M2 session :-(




Methods with more than four arguments. - Zach


nextPartition, for looping over partitions of an integer without storing all of them. Similarly, nextPermutation. - Zach


You could use something like:

permutationByIndex = (L,i) -> (

if #L <= 1 then return L;

k := (#L - 1)!;

j := i % k;

l := round((i - j)/k); -- i = l * #L! + j

prepend(L#l, permutationByIndex(drop(L, {l,l}), j))


This picks out the ith permutation of a list L (modulo |L|!). I'd bet you could do something similar for partitions. -Gwyn


Implemented and added to Wake Forest SVN directory, see also File:NextPartition.m2 - zach

Sum of partitions

Could we please add a method for sum of partitions, e.g.,

 sum Partition := P -> sum toList P


check package

It would be nice if checking a package would, after all tests, say which tests had errors (not only how many errors there were). - zach

Return to the main WF2012 page

autoComplete information on method/function inputs

If I begin to type a command in Macaulay2, I can type tab to autocomplete it. If there is more than one option, it gives me a list. I'd like the following:

Suppose I type a method followed by a parenthesis, and then hit tab (or another key/combo)


I would like Macaulay2 to tell me the list of valid inputs for myMethod(


Primary decomposition over QQBar

For the obvious reason. Well, even +, *, / in QQBar is not trivial..., say, I wish M2 could do this:

R = QQBar[x];

xx = roots x^5+x^2+3*x+1;

yy = roots x^7+x^3+1;

zz = xx_0+yy_0;


o1 = 4*t^3+3*t^2+14 in QQ[t]/(t^35+blah blah blah)

o1: QQBar


Matrix % Ideal

This currently works for matrices having a single row. A workaround:

Matrix % Ideal := (M,I) -> (
    S := source M;
    T := target M;
    map(T,S,apply(entries M,i->(i / (j-> j%I))))


Direct product of rings

Given rings R,S output a new ring with addition and multiplication defined componentwise.


Packages and namespaces

I have the feeling that things exported from packages should have descriptive names, whether those happen to be short or long, and if something has a long name, the package should simply export it, without trying to also export an abbreviation. For example, if a package has a method called "multiplierIdealDeterminantal", a reasonable abbreviation would be "mid", but exporting seems pretty irresponsible, as many people might want to use the name "mid" for something else. I think it might be better style for the package to just export the long name and leave it up to users to choose what abbreviation they want. (After all, some users might not care about that method, and are using other things in the package, so there's no point for them having an abbreviation, it just uses up namespace; other users might intend to use "multiplierIdealDeterminantal" and they can choose to give it an abbreviation.) Is this a reasonable thing to think? (Am I making a big deal out of a minor issue?) - Zach.