axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## [Axiom-developer] [Axiom Language] (new)

 From: billpage Subject: [Axiom-developer] [Axiom Language] (new) Date: Tue, 22 Feb 2005 14:45:00 -0600

Changes http://page.axiom-developer.org/zope/mathaction/AxiomLanguage/diff
--
Axiom Types

Consider
\begin{axiom}
(1+2)/3
\end{axiom}

It is sort of interesting, isn't it, that Axiom insists on
calling 1' a fraction just because of the way it was
calculated? There is a way to say that you want the answer
as an integer. Of course this isn't always possible:
\begin{axiom}
(1/3)::Integer
\end{axiom}

But the example it is:
\begin{axiom}
((1+2)/3)::Integer
\end{axiom}

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).

\begin{axiom}
((1+2)/3)::Polynomial Integer
((1+2)/3)::SquareMatrix(1,Integer)
((1+2)/3)::SquareMatrix(3,Integer)
((1+2)/3)::SquareMatrix(3, Polynomial Complex Integer)
\end{axiom}

--
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden

`

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]
• [Axiom-developer] [Axiom Language] (new), billpage <=