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

# Edit detail for numerical linear algebra revision 2 of 5

 1 2 3 4 5 Editor: Bill Page Time: 2008/05/28 20:37:02 GMT-7 Note: formatting

removed:
-From unknown Fri Jun 24 07:57:44 -0500 2005
-From: unknown
-Date: Fri, 24 Jun 2005 07:57:44 -0500
-Subject: test
-Message-ID: <20050624075744-0500@page.axiom-developer.org>
-
-\begin{axiom}
-A:=matrix[[cos(x),-sin(x)],[sin(x),cos(x)]]
-\end{axiom
-

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  (1) 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)  (2) 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)  (3) 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 % ])  (4) 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)  (5) 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))  (6) 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])  (7) Type: Polynomial(Float) axiom Time: 0 sec axiom A:=[[cos(x),-sin(x)],[sin(x),cos(x)]]  (8) Type: List(List(Expression(Integer))) axiom Time: 0.03 (IN) + 0.16 (OT) = 0.19 sec axiom A:=[[a,b],[c,d]]  (9) Type: List(List(Symbol)) axiom Time: 0.02 (IN) = 0.02 sec axiom A:=matrix[[cos(x),-sin(x)],[sin(x),cos(x)]]  (10) Type: Matrix(Expression(Integer)) axiom Time: 0 sec axiom A:=matrix[[cos(x),-sin(x)],[sin(x),cos(x)]]  (11) 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)]]
 (12)
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec

axiom
A:=matrix[[cos(x),-sin(x)],[sin(x),cos(x)]]
 (13)
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
A(1,1)
 (14)
Type: Expression(Integer)
axiom
Time: 0 sec

axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
 (15)
Type: Matrix(Expression(Integer))
axiom
Time: 0.01 (IN) = 0.01 sec
A(1,1)*A(2,2)-A(2,1)*A(1,2)
 (16)
Type: Expression(Integer)
axiom
Time: 0 sec

axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
 (17)
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
A(1,1)*A(2,2)
 (18)
Type: Expression(Integer)
axiom
Time: 0 sec
A(2,1)*A(1,2)
 (19)
Type: Expression(Integer)
axiom
Time: 0 sec

axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
 (20)
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
solve(A(1,1)*A(2,2)-A(2,1)*A(1,2)=0,L)
 (21)
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]]
 (22)
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)
 (23)
Type: List(Equation(Expression(Integer)))
axiom
Time: 0 sec
L
 (24)
Type: Variable(L)
axiom
Time: 0 sec

axiom
A:=matrix[[cos(x)-L,-sin(x)],[sin(x),cos(x)-L]]
 (25)
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]]  (26) Type: Matrix(Expression(Integer)) axiom Time: 0 sec solve(A(1,1)*A(2,2)-A(2,1)*A(1,2)=0,L)  (27) 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]]
 (28)
Type: Matrix(Expression(Integer))
axiom
Time: 0 sec
solve(A(1,1)*A(2,2)-A(2,1)*A(1,2)=0,L)
 (29)
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)  (30) Type: List(Equation(Fraction(Polynomial(Integer)))) axiom Time: 0.02 (IN) = 0.02 sec axiom sqrt(2)  (31) Type: AlgebraicNumber? axiom Time: 0.01 (EV) = 0.01 sec axiom solve(x^2=4,x)  (32) Type: List(Equation(Fraction(Polynomial(Integer)))) axiom Time: 0.03 (IN) + 0.01 (EV) = 0.04 sec axiom solve(x^2=4,x)  (33) Type: List(Equation(Fraction(Polynomial(Integer)))) axiom Time: 0 sec x  (34) 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]]
 (35)
Type: Matrix(Polynomial(Float))
axiom
Time: 0.01 (IN) = 0.01 sec
eigenvectors(P)
 (36)
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