m2: Evaluate Macaulay2 Code

Description Usage Arguments Value Examples

View source: R/m2.r

Description

Write a Macaulay2 file, evaluate it through a back-end connection to Macaulay2, and bring the output back into R.

Usage

1
m2(code, dir = tempdir(), opts = "--script")

Arguments

code

Macaulay2 code as either a character string or function; see examples

dir

directory to place the files in

opts

options for m2

Value

an object of class m2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
## Not run: 

options(digits = 20)
13^20
m2("13^20") # correct answer
m2("toRR(20,(19004963774880800571392-13^20)/13^20)") # relative error
options(digits = 7)

code <- "
1+1
2+3
100!
R = QQ[x,y,z]
(x+y)^10
curve = ideal( x^4-y^5, x^3-y^7 )
gens gb curve
m = matrix {{x^2, x^2-y^2, x*y*z^7 }}
image m
R = QQ[a..d]
I = ideal(a^3-b^2*c, b*c^2-c*d^2, c^3)
G = gens gb I
G
"
m2(code)


code <- "
R = QQ[x,y,z,t]
I = ideal( t^4 - x, t^3 - y, t^2 - z)
gens gb I
"
m2(code)


## End(Not run)

algstat documentation built on May 29, 2017, 10:34 p.m.

Related to m2 in algstat...