The ring object is generated by the operator define_ring. This operator has a side effect; it also changes the current ring. The line
[(x,y) ring_of_differential_operators 0] define_ring /R setwould create the ring of differential operators
.Dsymbol (d) defThe current ring can be obtained by [(CurrentRingp)] system_variable . The current ring is the ring of polynomials of two variables when the system starts.
All polynomial except belongs to a ring. For a non-zero polynomial f, the line
f (ring) dc /rr setput the associated ring object of f to the variable rr. As we have seen before, a given string is parsed as a polynomial in the current ring by the operator ``.''. To parse in a given ring, the operator ``__'' is used. That is,
[(x,y) ring_of_differential_operators 0] define_ring /R set (x^2-y) R __ /f setmeans to parse the string
x^2-yin the ring R and put the polynomial in the variable f. Arithmetic operators for two polynomials can be performed only when the two polynomials belong to a same ring. If you want to map a polynomial to a different ring, the easiest way is to translate the polynomial into a string and parse it in the ring. That is,
[(x,y) ring_of_polynomials 0] define_ring /R1 set (x-y). /f set [(x,y,z) ring_of_differential_operators 0] define_ring /R2 set (y+Dz). /g set f toString . /f set f g add ::would output .
It is convinient to have a class of numbers that is contained in any ring. The datatype number (universalNumber) is the class of bignum, which is allowed to be added and multiplied to any polynomials with characteristic 0.