A short demonstration of AxiomAn 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 axiom SM ==> SquareMatrix(n, FRAC POLY INT) Type: Void
Let axiom M: SM := matrix [[a[i,j] for j in 1..n] for i in 1..n]
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 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
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
Type: Domain
axiom poly:= XPR(Integer,Word)
Type: Domain
axiom p:poly := 2 * x - 3 * y + 1
axiom 1 + 2x - 3y
axiom p + q
axiom p * q
axiom (p +q)^2 -p^2 -q^2 - 2*p*q
axiom M := SquareMatrix(2,Fraction Integer)
Type: Domain
axiom poly1:= XPR(M,Word)
Type: Domain
axiom m1:M := matrix [[i*j**2 for i in 1..2] for j in 1..2]
Type: SquareMatrix?(2,Fraction Integer)
axiom m2:M := m1 - 5/4
Type: SquareMatrix?(2,Fraction Integer)
axiom m3: M := m2**2
Type: SquareMatrix?(2,Fraction Integer)
axiom pm:poly1 := m1*x + m2*y + m3*z - 2/3
axiom qm:poly1 := pm - m1*x
axiom qm**3
|






