login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for ScreenShots revision 10 of 13

1 2 3 4 5 6 7 8 9 10 11 12 13
Editor: 127.0.0.1
Time: 2007/11/16 05:07:50 GMT-8
Note: make computations live

changed:
- <ul>
-
- <li>
- <p>
-  Some computations. An important thing: everything is
-  <em>mathematically typed</em> in Axiom. <br/>
-  <pre>
-
-(1) -> 1+1
-
-   (1)  2
-                                                        Type: PositiveInteger
-(2) -> integrate(1/x^(1/3),x)
-
-         3+-+2
-        3\|x
-   (2)  ------
-           2
-                                          Type: Union(Expression Integer,...)
-  </pre>
- </p>
- Axiom is running under Windows. 
- </li>
-
- <li>
-  Some matrix computations under <a href="http://texmacs.org/">TeXmacs</a>.
-  <p>
-   <img src="/uploads/screenshot3.png">
-  </p>
-  Please notice the hierarchical editing capabilities of TeXmacs.
-  <p>
-   <img src="http://axiom-wiki.newsynthesis.org/uploads/screenshot2.jpg" />
-  </p>
- </li>
-
- <li>
- <p>Some more complicated computations:
- <pre>
A short demonstration of Axiom

  An important thing: all objects in Axiom have a <em>type</em>.  This enables us to give a simple demonstration of the Cayley-Hamilton theorem. 

Let n equal 4. The semicolon at the end of the input tells Axiom not to display the result.  Thus, only its type is shown:
\begin{axiom}
n := 4;
\end{axiom}
We define an abbreviation: let 'SM' be the ring of quadratic $n\times n$ matrices with rational functions as entries:
\begin{axiom}
SM ==> SquareMatrix(n, FRAC POLY INT)
\end{axiom}
Let 'M' be a generic $4 \times 4$ matrix:
\begin{axiom}
M: SM := matrix [[a[i,j] for j in 1..n] for i in 1..n]
\end{axiom}

Compute the characteristis polynomial of 'M':
\begin{axiom}
P := determinant (M - x * 1);
\end{axiom}

We now interpret 'P' as univariate polynomial in 'x', coefficients being from the $4 \times 4$ matrices. The double colon performs this coercion:
\begin{axiom}
Q := P::UP(x, SM);
\end{axiom}

Finally we evaluate this polynomial with the original matrix as argument.  In Axiom you do not need to use parenthesis if the function takes only one argument:
\begin{axiom}
Q M
\end{axiom}

Some matrix computations under <a href="http://texmacs.org/">TeXmacs</a>.
<img src="/uploads/screenshot3.png">

Notice the hierarchical editing capabilities of TeXmacs.
<img src="/uploads/screenshot2.jpg" />

Some more complicated computations:
\begin{axiom}

changed:
- 
-   All user variables and function definitions have been cleared.
-
-(1) -> Word := OrderedFreeMonoid(Symbol)
- 
-
-   (1)  OrderedFreeMonoid Symbol
-                                                                 Type: Domain
-(2) -> poly:= XPR(Integer,Word)
- 
-
-   (2)  XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-                                                                 Type: Domain
-(3) -> p:poly := 2 * x - 3 * y + 1
- 
-
-   (3)  1 + 2x - 3y
-                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-(4) -> q:poly := 2 * x + 1
- 
-
-   (4)  1 + 2x
-                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-(5) -> p + q
- 
-
-   (5)  2 + 4x - 3y
-                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-(6) -> p * q
- 
-
-                        2
-   (6)  1 + 4x - 3y + 4x  - 6y x
-                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-(7) -> (p +q)^2 -p^2 -q^2 - 2*p*q
- 
-
-   (7)  - 6x y + 6y x
-                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-(8) -> M := SquareMatrix(2,Fraction Integer)
- 
-
-   (8)  SquareMatrix(2,Fraction Integer)
-                                                                 Type: Domain
-(9) -> poly1:= XPR(M,Word)
- 
-
-   (9)
-   XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
-                                                                 Type: Domain
-(10) -> m1:M := matrix [[i*j**2 for i in 1..2] for j in 1..2]
- 
-
-         +1  2+
-   (10)  |    |
-         +4  8+
-                                       Type: SquareMatrix(2,Fraction Integer)
-(11) -> m2:M := m1 - 5/4
- 
-
-         +  1    +
-         |- -  2 |
-         |  4    |
-   (11)  |       |
-         |     27|
-         | 4   --|
-         +      4+
-                                       Type: SquareMatrix(2,Fraction Integer)
-(12) -> m3: M := m2**2
- 
-
-         +129     +
-         |---  13 |
-         | 16     |
-   (12)  |        |
-         |     857|
-         |26   ---|
-         +      16+
-                                       Type: SquareMatrix(2,Fraction Integer)
-(13) -> pm:poly1   := m1*x + m2*y + m3*z - 2/3
- 
-
-         +  2     +             +  1    +    +129     +
-         |- -   0 |             |- -  2 |    |---  13 |
-         |  3     |   +1  2+    |  4    |    | 16     |
-   (13)  |        | + |    |x + |       |y + |        |z
-         |       2|   +4  8+    |     27|    |     857|
-         | 0   - -|             | 4   --|    |26   ---|
-         +       3+             +      4+    +      16+
-Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
-(14) -> qm:poly1 := pm - m1*x
- 
-
-         +  2     +   +  1    +    +129     +
-         |- -   0 |   |- -  2 |    |---  13 |
-         |  3     |   |  4    |    | 16     |
-   (14)  |        | + |       |y + |        |z
-         |       2|   |     27|    |     857|
-         | 0   - -|   | 4   --|    |26   ---|
-         +       3+   +      4+    +      16+
-Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
-(15) -> qm**3
- 
-
-   (15)
-     +   8      +   +  1  8+    +43   52 +    +  129       +
-     |- --   0  |   |- -  -|    |--   -- |    |- ---  - 26 |
-     |  27      |   |  3  3|    | 4    3 |    |   8        | 2
-     |          | + |      |y + |        |z + |            |y
-     |         8|   |16    |    |104  857|    |         857|
-     | 0    - --|   |--   9|    |---  ---|    |- 52   - ---|
-     +        27+   + 3    +    + 3    12+    +          8 +
-   + 
-     +  3199     831 +      +  3199     831 +      +  103169     6409 +
-     |- ----   - --- |      |- ----   - --- |      |- ------   - ---- |
-     |   32       4  |      |   32       4  |      |    128        4  | 2
-     |               |y z + |               |z y + |                  |z
-     |  831     26467|      |  831     26467|      |   6409     820977|
-     |- ---   - -----|      |- ---   - -----|      | - ----   - ------|
-     +   2        32 +      +   2        32 +      +     2        128 +
-   + 
-     +3199   831 +     +103169   6409 +      +103169   6409 +
-     |----   --- |     |------   ---- |      |------   ---- |
-     | 64     8  | 3   |  256      8  | 2    |  256      8  |
-     |           |y  + |              |y z + |              |y z y
-     |831   26467|     | 6409   820977|      | 6409   820977|
-     |---   -----|     | ----   ------|      | ----   ------|
-     + 4      64 +     +   4      256 +      +   4      256 +
-   + 
-     +3178239   795341 +       +103169   6409 +       +3178239   795341 +
-     |-------   ------ |       |------   ---- |       |-------   ------ |
-     |  1024      128  |   2   |  256      8  |   2   |  1024      128  |
-     |                 |y z  + |              |z y  + |                 |z y z
-     |795341   25447787|       | 6409   820977|       |795341   25447787|
-     |------   --------|       | ----   ------|       |------   --------|
-     +  64       1024  +       +   4      256 +       +  64       1024  +
-   + 
-     +3178239   795341 +      +98625409  12326223 +
-     |-------   ------ |      |--------  -------- |
-     |  1024      128  | 2    |  4096       256   | 3
-     |                 |z y + |                   |z
-     |795341   25447787|      |12326223  788893897|
-     |------   --------|      |--------  ---------|
-     +  64       1024  +      +   128       4096  +
-Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
- </pre>
- </p>
- </li>
-
- </ul>
-
-</div>
-<div id="credit">$Id: screenshots.html,v 1.8 2003/11/02 09:43:28 dmentre Exp $
-</div>
-
Word := OrderedFreeMonoid(Symbol)
poly:= XPR(Integer,Word)
p:poly := 2 * x - 3 * y + 1
1 + 2x - 3y
q:poly := 2 * x + 1
p + q
p * q
(p +q)^2 -p^2 -q^2 - 2*p*q
M := SquareMatrix(2,Fraction Integer)
poly1:= XPR(M,Word)
m1:M := matrix [[i*j**2 for i in 1..2] for j in 1..2]
m2:M := m1 - 5/4
m3: M := m2**2
pm:poly1   := m1*x + m2*y + m3*z - 2/3
qm:poly1 := pm - m1*x
qm**3
\end{axiom}

A short demonstration of Axiom

An important thing: all objects in Axiom have a type. This enables us to give a simple demonstration of the Cayley-Hamilton theorem.

Let n equal 4. The semicolon at the end of the input tells Axiom not to display the result. Thus, only its type is shown:

axiom
n := 4;
Type: PositiveInteger?

We define an abbreviation: let SM be the ring of quadratic n\times n matrices with rational functions as entries:

axiom
SM ==> SquareMatrix(n, FRAC POLY INT)
Type: Void

Let M be a generic 4 \times 4 matrix:

axiom
M: SM := matrix [[a[i,j] for j in 1..n] for i in 1..n]

\label{eq1}\left[ 
\begin{array}{cccc}
{a_{1, \: 1}}&{a_{1, \: 2}}&{a_{1, \: 3}}&{a_{1, \: 4}}
\
{a_{2, \: 1}}&{a_{2, \: 2}}&{a_{2, \: 3}}&{a_{2, \: 4}}
\
{a_{3, \: 1}}&{a_{3, \: 2}}&{a_{3, \: 3}}&{a_{3, \: 4}}
\
{a_{4, \: 1}}&{a_{4, \: 2}}&{a_{4, \: 3}}&{a_{4, \: 4}}
(1)
Type: SquareMatrix?(4,Fraction(Polynomial(Integer)))

Compute the characteristis polynomial of 'M':

axiom
P := determinant (M - x * 1);
Type: Fraction(Polynomial(Integer))

We now interpret P as univariate polynomial in x, coefficients being from the 4 \times 4 matrices. The double colon performs this coercion:

axiom
Q := P::UP(x, SM);
Type: UnivariatePolynomial?(x,SquareMatrix?(4,Fraction(Polynomial(Integer))))

Finally we evaluate this polynomial with the original matrix as argument. In Axiom you do not need to use parenthesis if the function takes only one argument:

axiom
Q M

\label{eq2}\left[ 
\begin{array}{cccc}
0 & 0 & 0 & 0 
\
0 & 0 & 0 & 0 
\
0 & 0 & 0 & 0 
\
0 & 0 & 0 & 0 
(2)
Type: SquareMatrix?(4,Fraction(Polynomial(Integer)))

Some matrix computations under TeXmacs?.

Notice the hierarchical editing capabilities of TeXmacs?.

Some more complicated computations:

axiom
)cl all
All user variables and function definitions have been cleared. Word := OrderedFreeMonoid(Symbol)

\label{eq3}\hbox{\axiomType{OrderedFreeMonoid}\ } (\hbox{\axiomType{Symbol}\ })(3)
Type: Type
axiom
poly:= XPR(Integer,Word)

\label{eq4}\hbox{\axiomType{XPolynomialRing}\ } (\hbox{\axiomType{Integer}\ } , \hbox{\axiomType{OrderedFreeMonoid}\ } (\hbox{\axiomType{Symbol}\ }))(4)
Type: Type
axiom
p:poly := 2 * x - 3 * y + 1

\label{eq5}1 +{2 \  x}-{3 \  y}(5)
Type: XPolynomialRing?(Integer,OrderedFreeMonoid?(Symbol))
axiom
1 + 2x - 3y
Cannot find a definition or applicable library operation named 2 with argument type(s) Variable(x)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need. q:poly := 2 * x + 1

\label{eq6}1 +{2 \  x}(6)
Type: XPolynomialRing?(Integer,OrderedFreeMonoid?(Symbol))
axiom
p + q

\label{eq7}2 +{4 \  x}-{3 \  y}(7)
Type: XPolynomialRing?(Integer,OrderedFreeMonoid?(Symbol))
axiom
p * q

\label{eq8}1 +{4 \  x}-{3 \  y}+{4 \ {x^2}}-{6 \  y \  x}(8)
Type: XPolynomialRing?(Integer,OrderedFreeMonoid?(Symbol))
axiom
(p +q)^2 -p^2 -q^2 - 2*p*q

\label{eq9}-{6 \  x \  y}+{6 \  y \  x}(9)
Type: XPolynomialRing?(Integer,OrderedFreeMonoid?(Symbol))
axiom
M := SquareMatrix(2,Fraction Integer)

\label{eq10}\hbox{\axiomType{SquareMatrix}\ } (2, \hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }))(10)
Type: Type
axiom
poly1:= XPR(M,Word)

\label{eq11}\hbox{\axiomType{XPolynomialRing}\ } (\hbox{\axiomType{SquareMatrix}\ } (2, \hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ })) , \hbox{\axiomType{OrderedFreeMonoid}\ } (\hbox{\axiomType{Symbol}\ }))(11)
Type: Type
axiom
m1:M := matrix [[i*j**2 for i in 1..2] for j in 1..2]

\label{eq12}\left[ 
\begin{array}{cc}
1 & 2 
\
4 & 8 
(12)
Type: SquareMatrix?(2,Fraction(Integer))
axiom
m2:M := m1 - 5/4

\label{eq13}\left[ 
\begin{array}{cc}
-{1 \over 4}& 2 
\
4 &{{27}\over 4}
(13)
Type: SquareMatrix?(2,Fraction(Integer))
axiom
m3: M := m2**2

\label{eq14}\left[ 
\begin{array}{cc}
{{129}\over{16}}&{13}
\
{26}&{{857}\over{16}}
(14)
Type: SquareMatrix?(2,Fraction(Integer))
axiom
pm:poly1   := m1*x + m2*y + m3*z - 2/3

\label{eq15}\begin{array}{@{}l}
\displaystyle
{\left[ 
\begin{array}{cc}
-{2 \over 3}& 0 
\
0 & -{2 \over 3}
(15)
Type: XPolynomialRing?(SquareMatrix?(2,Fraction(Integer)),OrderedFreeMonoid?(Symbol))
axiom
qm:poly1 := pm - m1*x

\label{eq16}\begin{array}{@{}l}
\displaystyle
{\left[ 
\begin{array}{cc}
-{2 \over 3}& 0 
\
0 & -{2 \over 3}
(16)
Type: XPolynomialRing?(SquareMatrix?(2,Fraction(Integer)),OrderedFreeMonoid?(Symbol))
axiom
qm**3

\label{eq17}\begin{array}{@{}l}
\displaystyle
{\left[ 
\begin{array}{cc}
-{8 \over{27}}& 0 
\
0 & -{8 \over{27}}
(17)
Type: XPolynomialRing?(SquareMatrix?(2,Fraction(Integer)),OrderedFreeMonoid?(Symbol))