m2_parser: Convert a M2 object into an R object

Description Usage Arguments Value References Examples

Description

Convert a M2 object into an R object

Usage

 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
36
37
38
39
40
41
m2_parse(s)

## S3 method for class 'm2_integer'
print(x, ...)

## S3 method for class 'm2_float'
print(x, ...)

## S3 method for class 'm2_complex'
print(x, ...)

## S3 method for class 'm2_string'
print(x, ...)

## S3 method for class 'm2_boolean'
print(x, ...)

## S3 method for class 'm2_list'
print(x, ...)

## S3 method for class 'm2_array'
print(x, ...)

## S3 method for class 'm2_sequence'
print(x, ...)

## S3 method for class 'm2_symbol'
print(x, ...)

## S3 method for class 'm2_option'
print(x, ...)

## S3 method for class 'm2_hashtable'
print(x, ...)

## S3 method for class 'm2_module'
print(x, ...)

m2_toggle_gmp()

get_m2_gmp()

Arguments

s

a character(1), typically the result of running toExternalString on an M2 object

x

an object to be printed

...

...

Value

an R object

References

D. Kahle, C. O'Neill, and J. Sommars (2020). "A Computer Algebra System for R: Macaulay2 and the m2r Package." Journal of Statistical Software, 93(9):1-31.

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
## Not run:  requires Macaulay2

m2("1+1")
m2.("1+1")
m2_parse(m2.("1+1"))

m2("QQ[x,y]")
m2.("QQ[x,y]")
m2_parse(m2.("QQ[x,y]"))

get_m2_gmp()
m2("3/2") %>% m2_parse()
m2_toggle_gmp() # gmp on
m2("3/2") %>% m2_parse()
m2("6/4") %>% m2_parse()
m2("3345234524352435432/223454325235432524352433245") %>% m2_parse()
m2_toggle_gmp() # gmp off



m2("50!") %>% m2_parse()
m2_toggle_gmp() # gmp on
m2("50!") %>% m2_parse()
m2_toggle_gmp() # gmp off


## End(Not run)

coneill-math/m2r documentation built on May 28, 2020, 12:30 p.m.