CoCalc Public FilesPublic / M2.sagewsOpen with one click!
Author: Hal Snyder
Views : 133
Description: example Macaulay2 with Matroids package
Compute Environment: Ubuntu 18.04 (Deprecated)

Macaulay2 using Matroids package

About Macaulay2

Using the Matroids package

%default_mode macaulay2
-- check that we are in macaulay2 mode 22/15+1/22
499 --- 330 QQ
-- show where M2 packages will be found path
{./, .Macaulay2/code/, .Macaulay2/local/share/Macaulay2/, .Macaulay2/local/common/share/Macaulay2/, /usr/share/Macaulay2/} List
%sh # fetch Matroids package if it's not already installed # running M2 from .term or starting sagews %macaulay2 mode creates ~/.Macaulay2/code test -f $HOME/.Macaulay2/code/Matroids.m2 || { test -d $HOME/.Macaulay2/code || M2 < /dev/null cd $HOME/.Macaulay2/code wget https://raw.githubusercontent.com/jchen419/Matroids-M2/master/Matroids.m2 }
-- now we are ready to use the package and run examples from package docs needsPackage "Matroids"
--loading configuration for package "Graphs" from file /home/user/.Macaulay2/init-Graphs.m2 --loading configuration for package "FourTiTwo" from file /home/user/.Macaulay2/init-FourTiTwo.m2 --loading configuration for package "Posets" from file /home/user/.Macaulay2/init-Posets.m2 o1000000003 = Matroids o1000000003 : Package
M = matroid({a, matrix{{-1.2},{3.78}}, x, set{4,6}, -9}, {{a, x}, {x, -9}})
a matroid of rank 2 on 5 elements Matroid
peek M
Matroid{bases => {set {0, 2}, set {2, 4}}} cache => CacheTable{...2...} groundSet => set {0, 1, 2, 3, 4} rank => 2
M_{0,1,4}
{a, | -1.2 |, -9} | 3.78 | List