using macaulay2 from within r the m2r package
play

Using Macaulay2 from within R : the m2r package Christopher ONeill - PowerPoint PPT Presentation

Using Macaulay2 from within R : the m2r package Christopher ONeill University of California Davis coneill@math.ucdavis.edu Joint with David Kahle and Jeff Sommars Mathematics Research Communities on Algebraic Statistics August 3, 2017


  1. Under the hood: sockets wait for input from client m2("1+1") send "1+1" to server wait for response receive "1+1" from client evaluate "1+1" to "2" send "2" to client Christopher O’Neill (UC Davis) The m2r package August 3, 2017 6 / 20

  2. Under the hood: sockets wait for input from client m2("1+1") send "1+1" to server wait for response receive "1+1" from client evaluate "1+1" to "2" send "2" to client wait for input from client Christopher O’Neill (UC Davis) The m2r package August 3, 2017 6 / 20

  3. Under the hood: sockets wait for input from client m2("1+1") send "1+1" to server wait for response receive "1+1" from client evaluate "1+1" to "2" send "2" to client wait for input from client receive "2" from server Christopher O’Neill (UC Davis) The m2r package August 3, 2017 6 / 20

  4. Under the hood: sockets wait for input from client m2("1+1") send "1+1" to server wait for response receive "1+1" from client evaluate "1+1" to "2" send "2" to client wait for input from client receive "2" from server return "2" from m2() Christopher O’Neill (UC Davis) The m2r package August 3, 2017 6 / 20

  5. Under the hood: sockets Christopher O’Neill (UC Davis) The m2r package August 3, 2017 7 / 20

  6. Under the hood: sockets > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 7 / 20

  7. Under the hood: sockets > m2("a = 5") [1] "5" > m2("a") [1] "5" > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 7 / 20

  8. Under the hood: sockets > m2("a = 5") [1] "5" > m2("a") [1] "5" > m2("1+") Error: Macaulay2 Error! > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 7 / 20

  9. Under the hood: sockets > m2("a = 5") [1] "5" > m2("a") [1] "5" > m2("1+") Error: Macaulay2 Error! > m2("2+1") [1] "3" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 7 / 20

  10. Under the hood: sockets > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 8 / 20

  11. Under the hood: sockets > start_m2() Starting M2... done. > m2("1+1") [1] "2" > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 8 / 20

  12. Under the hood: sockets > start_m2() Starting M2... done. > m2("1+1") [1] "2" > So. . . now what? Christopher O’Neill (UC Davis) The m2r package August 3, 2017 8 / 20

  13. Under the hood: sockets > start_m2() Starting M2... done. > m2("1+1") [1] "2" > So. . . now what? New features since creation: Lots of convenience functions High-level parser Cloud computing Christopher O’Neill (UC Davis) The m2r package August 3, 2017 8 / 20

  14. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 9 / 20

  15. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > m2("R = QQ[x,y,z]") [1] "QQ(monoid[x..z, Degrees => {3:1}, Heft => {1}, MonomialOrder => VerticalList{MonomialSize => 32, GRevLex => {3:1}, Position => Up}, DegreeRank => 1])" > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 9 / 20

  16. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > m2("R = QQ[x,y,z]") [1] "QQ(monoid[x..z, Degrees => {3:1}, Heft => {1}, MonomialOrder => VerticalList{MonomialSize => 32, GRevLex => {3:1}, Position => Up}, DegreeRank => 1])" > m2("I = ideal(xˆ2, x*y, xˆ3*yˆ2)") [1] "ideal map((R)ˆ1,(R)ˆ{{-2},{-2},{-5}},{{xˆ2, x*y, xˆ3*yˆ2}})" > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 9 / 20

  17. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > m2("R = QQ[x,y,z]") [1] "QQ(monoid[x..z, Degrees => {3:1}, Heft => {1}, MonomialOrder => VerticalList{MonomialSize => 32, GRevLex => {3:1}, Position => Up}, DegreeRank => 1])" > m2("I = ideal(xˆ2, x*y, xˆ3*yˆ2)") [1] "ideal map((R)ˆ1,(R)ˆ{{-2},{-2},{-5}},{{xˆ2, x*y, xˆ3*yˆ2}})" > m2("gens gb I") [1] "map((R)ˆ1,(R)ˆ{{-2},{-2}},{{x*y, xˆ2}})" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 9 / 20

  18. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > m2("R = QQ[x,y,z]") [1] "QQ(monoid[x..z, Degrees => {3:1}, Heft => {1}, MonomialOrder => VerticalList{MonomialSize => 32, GRevLex => {3:1}, Position => Up}, DegreeRank => 1])" > m2("I = ideal(xˆ2, x*y, xˆ3*yˆ2)") [1] "ideal map((R)ˆ1,(R)ˆ{{-2},{-2},{-5}},{{xˆ2, x*y, xˆ3*yˆ2}})" > m2("gens gb I") [1] "map((R)ˆ1,(R)ˆ{{-2},{-2}},{{x*y, xˆ2}})" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 9 / 20

  19. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 10 / 20

  20. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > (R <- ring("x", "y", "z", coefring = "QQ")) M2 Ring: QQ[x,y,z], grevlex order > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 10 / 20

  21. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > (R <- ring("x", "y", "z", coefring = "QQ")) M2 Ring: QQ[x,y,z], grevlex order > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 10 / 20

  22. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > (R <- ring("x", "y", "z", coefring = "QQ")) M2 Ring: QQ[x,y,z], grevlex order > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > (mygens <- gb(I)) x y xˆ2 > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 10 / 20

  23. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > (R <- ring("x", "y", "z", coefring = "QQ")) M2 Ring: QQ[x,y,z], grevlex order > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > (mygens <- gb(I)) x y xˆ2 > mygens[[2]] xˆ2 Christopher O’Neill (UC Davis) The m2r package August 3, 2017 10 / 20

  24. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > (R <- ring("x", "y", "z", coefring = "QQ")) M2 Ring: QQ[x,y,z], grevlex order > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > (mygens <- gb(I)) x y xˆ2 > mygens[[2]] − mpoly ← xˆ2 Christopher O’Neill (UC Davis) The m2r package August 3, 2017 10 / 20

  25. Convenience functions > m2("a = 5") [1] "5" > m2("a") [1] "5" > (R <- ring("x", "y", "z", coefring = "QQ")) M2 Ring: QQ[x,y,z], grevlex order > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > (mygens <- gb(I)) − mpolylist ← x y xˆ2 > mygens[[2]] − mpoly ← xˆ2 Christopher O’Neill (UC Davis) The m2r package August 3, 2017 10 / 20

  26. Convenience functions > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 11 / 20

  27. Convenience functions > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > radical(I) M2 Ideal of ring QQ[x,y,z] (grevlex) with generator : < x > > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 11 / 20

  28. Convenience functions > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > radical(I) M2 Ideal of ring QQ[x,y,z] (grevlex) with generator : < x > > saturate(I,ideal("xˆ5")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generator : < 1 > > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 11 / 20

  29. Convenience functions > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > radical(I) M2 Ideal of ring QQ[x,y,z] (grevlex) with generator : < x > > saturate(I,ideal("xˆ5")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generator : < 1 > > I+I M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2, xˆ2, x y, xˆ3 yˆ2 > > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 11 / 20

  30. Convenience functions > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > radical(I) M2 Ideal of ring QQ[x,y,z] (grevlex) with generator : < x > > saturate(I,ideal("xˆ5")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generator : < 1 > > I+I M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2, xˆ2, x y, xˆ3 yˆ2 > > gb(I+I) x y xˆ2 Christopher O’Neill (UC Davis) The m2r package August 3, 2017 11 / 20

  31. Convenience functions > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 12 / 20

  32. Convenience functions > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > primary_decomposition(I) M2 List of ideals of QQ[x,y,z] (grevlex) : < x > < xˆ2, y > > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 12 / 20

  33. Convenience functions > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > primary_decomposition(I) M2 List of ideals of QQ[x,y,z] (grevlex) : < x > < xˆ2, y > > dimension(I) [1] 2 > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 12 / 20

  34. Convenience functions > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > primary_decomposition(I) M2 List of ideals of QQ[x,y,z] (grevlex) : < x > < xˆ2, y > > dimension(I) [1] 2 > ring("x", "y", "z", coefring = "QQ", code = TRUE) m2rintring00000002 = QQ[x,y,z,MonomialOrder=>{GRevLex=>3}] > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 12 / 20

  35. Convenience functions > (I <- ideal("xˆ2", "x*y", "xˆ3*yˆ2")) M2 Ideal of ring QQ[x,y,z] (grevlex) with generators : < xˆ2, x y, xˆ3 yˆ2 > > primary_decomposition(I) M2 List of ideals of QQ[x,y,z] (grevlex) : < x > < xˆ2, y > > dimension(I) [1] 2 > ring("x", "y", "z", coefring = "QQ", code = TRUE) m2rintring00000002 = QQ[x,y,z,MonomialOrder=>{GRevLex=>3}] > dimension(I, code = TRUE) dim(m2rintideal00000001) Christopher O’Neill (UC Davis) The m2r package August 3, 2017 12 / 20

  36. The parser > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 13 / 20

  37. The parser > m2_matrix(matrix(c(1,2,3,4), nrow = 2, ncol = 2)) [,1] [,2] [1,] 1 3 [2,] 2 4 M2 Matrix over ZZ[] > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 13 / 20

  38. The parser > m2_matrix(matrix(c(1,2,3,4), nrow = 2, ncol = 2)) [,1] [,2] [1,] 1 3 [2,] 2 4 M2 Matrix over ZZ[] > m2_matrix(matrix(c(1,2,3,4), nrow = 2, ncol = 2), code = TRUE) m2rintmatrix00000002 = matrix {{(1),(3)},{(2),(4)}} > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 13 / 20

  39. The parser > m2_matrix(matrix(c(1,2,3,4), nrow = 2, ncol = 2)) [,1] [,2] [1,] 1 3 [2,] 2 4 M2 Matrix over ZZ[] > m2_matrix(matrix(c(1,2,3,4), nrow = 2, ncol = 2), code = TRUE) m2rintmatrix00000002 = matrix {{(1),(3)},{(2),(4)}} > m2("m2rintmatrix00000002 = matrix {{(1),(3)},{(2),(4)}}") [1] "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 13 / 20

  40. The parser > m2_matrix(matrix(c(1,2,3,4), nrow = 2, ncol = 2)) [,1] [,2] [1,] 1 3 [2,] 2 4 M2 Matrix over ZZ[] > m2_matrix(matrix(c(1,2,3,4), nrow = 2, ncol = 2), code = TRUE) m2rintmatrix00000002 = matrix {{(1),(3)},{(2),(4)}} > m2("m2rintmatrix00000002 = matrix {{(1),(3)},{(2),(4)}}") [1] "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" > m2_parse("map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})") [,1] [,2] [1,] 1 3 [2,] 2 4 M2 Matrix over ZZ[] Christopher O’Neill (UC Davis) The m2r package August 3, 2017 13 / 20

  41. The parser Parsing "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 14 / 20

  42. The parser Parsing "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" > m2_tokenize("map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})") [1] "map" "(" "(" "ZZ" ")" "ˆ" "2" "," "(" "ZZ" [11] ")" "ˆ" "2" "," "{" "{" "1" "," "3" "}" [21] "," "{" "2" "," "4" "}" "}" ")" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 14 / 20

  43. The parser Parsing "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" > m2_tokenize("map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})") [1] "map" "(" "(" "ZZ" ")" "ˆ" "2" "," "(" "ZZ" [11] ")" "ˆ" "2" "," "{" "{" "1" "," "3" "}" [21] "," "{" "2" "," "4" "}" "}" ")" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 14 / 20

  44. The parser Parsing "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" > m2_tokenize("map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})") [1] "map" "(" "(" "ZZ" ")" "ˆ" "2" "," "(" "ZZ" [11] ")" "ˆ" "2" "," "{" "{" "1" "," "3" "}" [21] "," "{" "2" "," "4" "}" "}" ")" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 14 / 20

  45. The parser Parsing "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" > m2_tokenize("map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})") [1] "map" "(" "(" "ZZ" ")" "ˆ" "2" "," "(" "ZZ" [11] ")" "ˆ" "2" "," "{" "{" "1" "," "3" "}" [21] "," "{" "2" "," "4" "}" "}" ")" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 14 / 20

  46. The parser Parsing "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" > m2_tokenize("map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})") [1] "map" "(" "(" "ZZ" ")" "ˆ" "2" "," "(" "ZZ" [11] ")" "ˆ" "2" "," "{" "{" "1" "," "3" "}" [21] "," "{" "2" "," "4" "}" "}" ")" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 14 / 20

  47. The parser Parsing "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" > m2_tokenize("map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})") [1] "map" "(" "(" "ZZ" ")" "ˆ" "2" "," "(" "ZZ" [11] ")" "ˆ" "2" "," "{" "{" "1" "," "3" "}" [21] "," "{" "2" "," "4" "}" "}" ")" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 14 / 20

  48. The parser Parsing "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" > m2_tokenize("map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})") [1] "map" "(" "(" "ZZ" ")" "ˆ" "2" "," "(" "ZZ" [11] ")" "ˆ" "2" "," "{" "{" "1" "," "3" "}" [21] "," "{" "2" "," "4" "}" "}" ")" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 14 / 20

  49. The parser Parsing "map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})" > m2_tokenize("map((ZZ)ˆ2,(ZZ)ˆ2,{{1, 3}, {2, 4}})") [1] "map" "(" "(" "ZZ" ")" "ˆ" "2" "," "(" "ZZ" [11] ")" "ˆ" "2" "," "{" "{" "1" "," "3" "}" [21] "," "{" "2" "," "4" "}" "}" ")" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 14 / 20

  50. The parser > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 15 / 20

  51. The parser > m2_parse(m2("x")) M2 Symbol: x > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 15 / 20

  52. The parser > m2_parse(m2("x")) M2 Symbol: x > m2_parse(m2("ZZ")) M2 Ring: ZZ[], grevlex order > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 15 / 20

  53. The parser > m2_parse(m2("x")) M2 Symbol: x > m2_parse(m2("ZZ")) M2 Ring: ZZ[], grevlex order > m2("m2rintring00000002 = QQ[x,y,z,MonomialOrder=>{GRevLex=>3}]") [1] "QQ(monoid[x..z, Degrees => {3:1}, Heft => {1}, MonomialOrder => VerticalList{MonomialSize => 32, GRevLex => {3:1}, Position => Up}, DegreeRank => 1])" > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 15 / 20

  54. The parser > m2_parse(m2("x")) M2 Symbol: x > m2_parse(m2("ZZ")) M2 Ring: ZZ[], grevlex order > m2("m2rintring00000002 = QQ[x,y,z,MonomialOrder=>{GRevLex=>3}]") [1] "QQ(monoid[x..z, Degrees => {3:1}, Heft => {1}, MonomialOrder => VerticalList{MonomialSize => 32, GRevLex => {3:1}, Position => Up}, DegreeRank => 1])" > m2_parse(m2("m2rintring00000002")) M2 Ring: QQ[x,y,z], grevlex order > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 15 / 20

  55. The parser > m2_parse(m2("x")) M2 Symbol: x > m2_parse(m2("ZZ")) M2 Ring: ZZ[], grevlex order > m2("m2rintring00000002 = QQ[x,y,z,MonomialOrder=>{GRevLex=>3}]") [1] "QQ(monoid[x..z, Degrees => {3:1}, Heft => {1}, MonomialOrder => VerticalList{MonomialSize => 32, GRevLex => {3:1}, Position => Up}, DegreeRank => 1])" > m2_parse(m2("m2rintring00000002")) M2 Ring: QQ[x,y,z], grevlex order > m2("ideal({xˆ2+2*x,2*x+3})") [1] "ideal map((m2rintring00000002)ˆ1,(m2rintring00000002)ˆ{{-2}, {-1}},{{xˆ2+2*x, 2*x+3}})" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 15 / 20

  56. Parser “extensibility” > m2("ideal({xˆ2+2*x,2*x+3})") [1] "ideal map((m2rintring00000002)ˆ1,(m2rintring00000002)ˆ{{-2}, {-1}},{{xˆ2+2*x, 2*x+3}})" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 16 / 20

  57. Parser “extensibility” > m2("ideal({xˆ2+2*x,2*x+3})") [1] "ideal map((m2rintring00000002)ˆ1,(m2rintring00000002)ˆ{{-2}, {-1}},{{xˆ2+2*x, 2*x+3}})" m2_parse_function.m2_map <- function(x) { R1 <- x[[1]] R2 <- x[[2]] . . . m2_structure( mat, m2_name = "", m2_class = "m2_matrix", m2_meta = list( ring = R1 ), base_class = "matrix" ) } Christopher O’Neill (UC Davis) The m2r package August 3, 2017 16 / 20

  58. Parser “extensibility” > m2("ideal({xˆ2+2*x,2*x+3})") [1] "ideal map((m2rintring00000002)ˆ1,(m2rintring00000002)ˆ{{-2}, {-1}},{{xˆ2+2*x, 2*x+3}})" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 16 / 20

  59. Parser “extensibility” > m2("ideal({xˆ2+2*x,2*x+3})") [1] "ideal map((m2rintring00000002)ˆ1,(m2rintring00000002)ˆ{{-2}, {-1}},{{xˆ2+2*x, 2*x+3}})" m2_parse_function.m2_ideal <- function(x) { m2_structure( m2_name = "", m2_class = "m2_ideal", m2_meta = list( ring = m2_meta(x[[1]], "ring"), gens = structure(x[[1]][1,], class = "mpolyList") ) ) } Christopher O’Neill (UC Davis) The m2r package August 3, 2017 16 / 20

  60. m2r is now in the cloud! > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 17 / 20

  61. m2r is now in the cloud! > library("m2r") Loading required package: mpoly Loading required package: stringr please cite mpoly if you use it; see citation("mpoly") M2 not found; defaulting to cloud. Use set_m2r_path("/path/to/m2") to run M2 locally. > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 17 / 20

  62. m2r is now in the cloud! > library("m2r") Loading required package: mpoly Loading required package: stringr please cite mpoly if you use it; see citation("mpoly") M2 not found; defaulting to cloud. Use set_m2r_path("/path/to/m2") to run M2 locally. > start_m2() Connecting to M2 in the cloud... done. > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 17 / 20

  63. m2r is now in the cloud! > library("m2r") Loading required package: mpoly Loading required package: stringr please cite mpoly if you use it; see citation("mpoly") M2 not found; defaulting to cloud. Use set_m2r_path("/path/to/m2") to run M2 locally. > start_m2() Connecting to M2 in the cloud... done. > m2("a = 5") [1] "5" > Christopher O’Neill (UC Davis) The m2r package August 3, 2017 17 / 20

  64. m2r is now in the cloud! > library("m2r") Loading required package: mpoly Loading required package: stringr please cite mpoly if you use it; see citation("mpoly") M2 not found; defaulting to cloud. Use set_m2r_path("/path/to/m2") to run M2 locally. > start_m2() Connecting to M2 in the cloud... done. > m2("a = 5") [1] "5" > m2("a") [1] "5" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 17 / 20

  65. m2r is now in the cloud! > library("m2r") Loading required package: mpoly Loading required package: stringr please cite mpoly if you use it; see citation("mpoly") M2 not found; defaulting to cloud. Use set_m2r_path("/path/to/m2") to run M2 locally. > start_m2() Connecting to M2 in the cloud... done. > m2("a = 5") [1] "5" > m2("a") [1] "5" Christopher O’Neill (UC Davis) The m2r package August 3, 2017 17 / 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend