next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: toString

toString -- convert to a string

Synopsis

Description

Sometimes the string representation is just the name. See also toExternalString which will try to convert x to a string that can be read back into the program later.
i1 : toString {1,4,a,f,212312,2.123243242}

o1 = {1, 4, a, f, 212312, 2.12324}
If a ring has a global name, then toString returns this name.
i2 : R = QQ[x_1..x_5];
i3 : toString R

o3 = R
i4 : toExternalString R

o4 = QQ(monoid[x_1, x_2, x_3, x_4, x_5, Degrees => {5:1}, Heft => {1},
     MonomialOrder => VerticalList{MonomialSize => 32, GRevLex => {5:1},
     Position => Up}, DegreeRank => 1])
i5 : toString(QQ[a])

o5 = QQ[a]
Matrices and ring elements are linearized
i6 : toString (x_1^3-3/4*x_5*x_3)

o6 = x_1^3-(3/4)*x_3*x_5
i7 : toString vars R

o7 = matrix {{x_1, x_2, x_3, x_4, x_5}}
i8 : toExternalString vars R

o8 = map((R)^1,(R)^{{-1},{-1},{-1},{-1},{-1}},{{x_1, x_2, x_3, x_4, x_5}})

See also

Ways to use toString :