[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fri, 28 Jan 2005 00:08:44 -0600
Axiom is very strict with types (meaning: where the operation takes place). The
division of 1+2 by 3 takes place in Fraction Integer (field of rational
numbers) and that is where the answer should be, even if it is 1. Most people
would automatically "retract" this to the integer 1. But in general, there is
no natural way to do so (why not retract 1 to a natural number, for example?).
So Axiom provides the user a way to "coerce" an answer to another type. You can
coerce 1 to any of many, many types, for example, as a polynomial, or even as a
matrix (or the unit element of any ring).
((1+2)/3)::SquareMatrix(3, Polynomial Complex Integer)
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden