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:
fricas
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):
fricas
)set messages time on
Try this::
fricas
eigen:=eigenvalues(sm)
Type: List(Union(Fraction(Polynomial(Integer)),
SuchThat?(Symbol,Polynomial(Integer))))
fricas
Time: 0.01 (IN) + 0.01 (EV) + 0.07 (OT) = 0.09 sec
solve(rhs(eigen.1),10.0^(-15))
Type: List(Equation(Polynomial(Float)))
fricas
Time: 0.03 (EV) + 0.01 (OT) = 0.04 sec
Thank you! This helps, but doesn't answer everything. Since interestingly:
fricas
charpol := reduce(*, [ rhs(x) - lhs(x) for x in % ])
Type: Polynomial(Float)
fricas
Time: 0 sec
we cannot recover the characteristic polynomial from this solution: Even if a large number is passed to solve, accuracy does not increase.
To recover characteristic polynomial one needs good precision, which means very
small second argument to solve. Giving large second arguments means very poor
accuracy:
fricas
solve(x+11/10,3)
Type: List(Equation(Polynomial(Fraction(Integer))))
fricas
Time: 0.01 (IN) = 0.01 sec
To have use of precise solution we also need to increase precision of other
floating point computations using digits. Unfortunately, this leads to
ugly display, so we only show final result:
fricas
digits(120)
fricas
Time: 0 sec
ev:= solve(rhs(eigen.1),1.0*10^(-100));
Type: List(Equation(Polynomial(Float)))
fricas
Time: 0.09 (EV) = 0.09 sec
cp:= reduce(*, [rhs(x)-lhs(x) for x in ev]);
Type: Polynomial(Float)
fricas
Time: 0 sec
rhs(eigen.1) - cp
Type: Polynomial(Float)
fricas
Time: 0 sec
fricas
A:=[[a,b],[c,d]]
Type: List(List(Symbol))
fricas
Time: 0.01 (OT) = 0.01 sec
fricas
A:=matrix[[cos(x),-sin(x)],[sin(x),cos(x)]]
Type: Matrix(Expression(Integer))
fricas
Time: 0.04 (OT) = 0.04 sec
A(1,1)
Type: Expression(Integer)
fricas
Time: 0 sec
eigen:=eigenvalues(A)
There are 1 exposed and 1 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.
Unfortunately, currently eigenvalues does not work for general expressions,
which causes the failure above.
fricas
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
Type: Matrix(Expression(Integer))
fricas
Time: 0 sec
A(1,1)*A(2,2)
Type: Expression(Integer)
fricas
Time: 0 sec
A(2,1)*A(1,2)
Type: Expression(Integer)
fricas
Time: 0 sec
A(1,1)*A(2,2)-A(2,1)*A(1,2)
Type: Expression(Integer)
fricas
Time: 0 sec
B := solve(A(1,1)*A(2,2)-A(2,1)*A(1,2)=0,L)
Type: List(Equation(Expression(Integer)))
fricas
Time: 0.01 (IN) + 0.01 (EV) + 0.01 (OT) = 0.03 sec
B(1)
Type: Equation(Expression(Integer))
fricas
Time: 0 sec
fricas
solve(x^2 - 2,x)
Type: List(Equation(Fraction(Polynomial(Integer))))
fricas
Time: 0.01 (EV) = 0.01 sec
sqrt(2)
fricas
Time: 0 sec
solve(x^2=4,x)
Type: List(Equation(Fraction(Polynomial(Integer))))
fricas
Time: 0.01 (IN) = 0.01 sec
fricas
P:=matrix[[a, b], [1.0 - a, 1.0 - b]]
Type: Matrix(Polynomial(Float))
fricas
Time: 0 sec
eigenvectors(P)
Internal Error
The function eigenvectors with signature hashcode is missing from
domain EigenPackage(Float)