I'm new to Axiom, so maybe I'm doing things in a stupid way.
I want to get (estimates of) the eigenvalues of a 10x10 matrix of floats:
axiom
m := matrix([[random()$Integer for i in 1..10] for j in 1..10]); sm := m + transpose(m); smf:Matrix Float := sm
Type: Matrix(Float)
The problem is: If I now call eigenvalues(smf) on the symmetric float matrix smf Axiom 3.0 Beta (February 2005) runs for a very long time (uncomment code if you want to try it):
axiom
)set messages time on
Try this::
axiom
eigen:=eigenvalues(sm)
Type: List(Union(Fraction(Polynomial(Integer)),
SuchThat?(Symbol,Polynomial(Integer))))
axiom
Time: 0.02 (IN) + 0.24 (EV) + 0.31 (OT) = 0.57 sec
solve(rhs(eigen.1),15)
Type: List(Equation(Polynomial(Fraction(Integer))))
axiom
Time: 0.03 (IN) + 0.83 (EV) + 0.04 (OT) = 0.90 sec
Thank you! This helps, but doesn't answer everything. Since interestingly:
axiom
charpol := reduce(*, [ rhs(x) - lhs(x) for x in % ])
Type: Polynomial(Fraction(Integer))
axiom
Time: 0.01 (IN) + 0.01 (OT) = 0.02 sec
we cannot recover the characteristic polynomial from this solution: Even if a large number is passed to solve, accuracy does not increase.
Why would you expect to be able to recover the characteristic polynomial? There is always round off error for finite precision arithmetic. For integer approximations, it would be worse.
The command solve: (Polynomial Fraction Integer, PositiveInteger)->List Equation Polynomial Integer
solves the equation over the integers, so it is {\it not} accurate. For example:
axiom
solve(x+11/10,3)
Type: List(Equation(Polynomial(Fraction(Integer))))
axiom
Time: 0.06 (IN) + 0.01 (OT) = 0.07 sec
ev:= solve(rhs(eigen.1),1.0*10^(-50))
Type: List(Equation(Polynomial(Float)))
axiom
Time: 0.54 (EV) + 0.02 (OT) = 0.56 sec
cp:= reduce(*, [rhs(x)-lhs(x) for x in ev])
Type: Polynomial(Float)
axiom
Time: 0 sec
axiom
A:=[[cos(x),-sin(x)],[sin(x),cos(x)]]
Type: List(List(Expression(Integer)))
axiom
Time: 0.03 (IN) + 0.16 (OT) = 0.19 sec
axiom
A:=[[a,b],[c,d]]
Type: List(List(Symbol))
axiom
Time: 0.02 (IN) = 0.02 sec
axiom
A:=matrix[[cos(x),-sin(x)],[sin(x),cos(x)]]
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
axiom
A:=matrix[[cos(x),-sin(x)],[sin(x),cos(x)]]
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
eigen:=eigenvalues(A)
There are 1 exposed and 0 unexposed library operations named
eigenvalues having 1 argument(s) but none was determined to be
applicable. Use HyperDoc Browse, or issue
)display op eigenvalues
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.
Cannot find a definition or applicable library operation named
eigenvalues with argument type(s)
Matrix(Expression(Integer))
Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.
axiom
A:=matrix[[cos(x),-sin(x)],[sin(x),cos(x)]]
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
axiom
A:=matrix[[cos(x),-sin(x)],[sin(x),cos(x)]]
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
A(1,1)
Type: Expression(Integer)
axiom
Time: 0 sec
axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
Type: Matrix(Expression(Integer))
axiom
Time: 0.01 (IN) = 0.01 sec
A(1,1)*A(2,2)-A(2,1)*A(1,2)
Type: Expression(Integer)
axiom
Time: 0 sec
axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
A(1,1)*A(2,2)
Type: Expression(Integer)
axiom
Time: 0 sec
A(2,1)*A(1,2)
Type: Expression(Integer)
axiom
Time: 0 sec
axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
solve(A(1,1)*A(2,2)-A(2,1)*A(1,2)=0,L)
Type: List(Equation(Expression(Integer)))
axiom
Time: 0.03 (IN) + 0.01 (EV) + 0.05 (OT) = 0.09 sec
axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
Type: Matrix(Expression(Integer))
axiom
Time: 0.01 (IN) = 0.01 sec
solve(A(1,1)*A(2,2)-A(2,1)*A(1,2)=0,L)
Type: List(Equation(Expression(Integer)))
axiom
Time: 0 sec
L
Type: Variable(L)
axiom
Time: 0 sec
axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
B=solve(A(1,1)*A(2,2)-A(2,1)*A(1,2)=0,L)
There are 3 exposed and 0 unexposed library operations named
equation having 2 argument(s) but none was determined to be
applicable. Use HyperDoc Browse, or issue
)display op equation
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.
Cannot find a definition or applicable library operation named
equation with argument type(s)
Variable(B)
List(Equation(Expression(Integer)))
Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.
axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
solve(A(1,1)*A(2,2)-A(2,1)*A(1,2)=0,L)
Type: List(Equation(Expression(Integer)))
axiom
Time: 0 sec
L(1)
There are no library operations named L
Use HyperDoc Browse or issue
)what op L
to learn if there is any operation containing " L " in its name.
Cannot find a definition or applicable library operation named L
with argument type(s)
PositiveInteger
Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.
axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
solve(A(1,1)*A(2,2)-A(2,1)*A(1,2)=0,L)
Type: List(Equation(Expression(Integer)))
axiom
Time: 0.01 (EV) + 0.01 (OT) = 0.02 sec
L.1
There are no library operations named L
Use HyperDoc Browse or issue
)what op L
to learn if there is any operation containing " L " in its name.
Cannot find a definition or applicable library operation named L
with argument type(s)
PositiveInteger
Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.
axiom
solve(x^2,x)
Type: List(Equation(Fraction(Polynomial(Integer))))
axiom
Time: 0.02 (IN) = 0.02 sec
axiom
sqrt(2)
axiom
Time: 0.01 (EV) = 0.01 sec
axiom
solve(x^2=4,x)
Type: List(Equation(Fraction(Polynomial(Integer))))
axiom
Time: 0.03 (IN) + 0.01 (EV) = 0.04 sec
axiom
solve(x^2=4,x)
Type: List(Equation(Fraction(Polynomial(Integer))))
axiom
Time: 0 sec
x
Type: Variable(x)
axiom
Time: 0 sec
axiom
e=vector[1,2]
There are 3 exposed and 0 unexposed library operations named
equation having 2 argument(s) but none was determined to be
applicable. Use HyperDoc Browse, or issue
)display op equation
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.
Cannot find a definition or applicable library operation named
equation with argument type(s)
Variable(e)
Vector(PositiveInteger)
Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.
e=solve(x^2=4,x)
There are 3 exposed and 0 unexposed library operations named
equation having 2 argument(s) but none was determined to be
applicable. Use HyperDoc Browse, or issue
)display op equation
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.
Cannot find a definition or applicable library operation named
equation with argument type(s)
Variable(e)
List(Equation(Fraction(Polynomial(Integer))))
Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.
axiom
e=solve(x^2=4,x)
There are 3 exposed and 0 unexposed library operations named
equation having 2 argument(s) but none was determined to be
applicable. Use HyperDoc Browse, or issue
)display op equation
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.
Cannot find a definition or applicable library operation named
equation with argument type(s)
Variable(e)
List(Equation(Fraction(Polynomial(Integer))))
Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.
axiom
P:=matrix[[a, b], [1.0 - a, 1.0 - b]]
Type: Matrix(Polynomial(Float))
axiom
Time: 0.01 (IN) = 0.01 sec
eigenvectors(P)
Type: List(Record(eigval: Union(Fraction(Polynomial(Float)),
SuchThat?(Symbol,Polynomial(Float))),eigmult: NonNegativeInteger?,eigvec: List(Matrix(Fraction(Polynomial(Float))))))
axiom
Time: 0.01 (EV) + 0.02 (OT) = 0.03 sec