A short demonstrationAn important thing: all objects in FriCAS 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 FriCAS not to display the result. Thus, only its type is shown: fricas (1) -> n := 4; Type: PositiveInteger?
We define an abbreviation: let fricas SM ==> SquareMatrix(n, Type: Void
Let fricas M: SM := matrix [[a[i,
Type: SquareMatrix?(4,
Compute the characteristis polynomial of 'M': fricas P := determinant (M - x * 1); Type: Fraction(Polynomial(Integer))
We now interpret fricas Q := P::UP(x, Finally we evaluate this polynomial with the original matrix as argument. In FriCAS you do not need to use parenthesis if the function takes only one argument: fricas Q M
Type: SquareMatrix?(4,
Some matrix computations under TeXmacs (this is old screenshot from Axiom era). Notice the hierarchical editing capabilities of TeXmacs (again this is old screenshot from Axiom era). Some more complicated computations: fricas )cl all
Type: Type
fricas poly:= XPR(Integer,
Type: Type
fricas p:poly := 2 * x - 3 * y + 1
fricas q:poly := 2 * x + 1
fricas p + q
fricas p * q
fricas (p +q)^2 -p^2 -q^2 - 2*p*q
fricas M := SquareMatrix(2,
Type: Type
fricas poly1:= XPR(M,
Type: Type
fricas m1:M := matrix [[i*j^2 for i in 1..2] for j in 1..2]
Type: SquareMatrix?(2,
fricas m2:M := m1 - 5/4
Type: SquareMatrix?(2,
fricas m3: M := m2^2
Type: SquareMatrix?(2,
fricas pm:poly1 := m1*x + m2*y + m3*z - 2/3
fricas qm:poly1 := pm - m1*x
fricas qm^3
|