Ask Your Question

Revision history [back]

Given the picture, i have to guess your construction (tell ):

Your field K :

sage: K = Qp(5,prec=70)                                                                                                                                                                                      
sage: K                                                                                                                                                                                                      
5-adic Field with capped relative precision 70

Your matrix I (which is the identity) :

sage: I = matrix.identity(K,15)

There is no information about Matrix2, hence, i will pick one randomly:

sage: M = I.parent()                                                                                                                                                                                         
sage: M                                                                                                                                                                                                      
Full MatrixSpace of 15 by 15 dense matrices over 5-adic Field with capped relative precision 70
sage: Matrix2 = M.random_element()

On my installation,

sage: Matrix2.charpoly()

works well.

Te folowing does not work:

sage: x*Matrix2

because, by default x is a symbol, to be used in symbolic expressions like sin(x)*sqrt(2).

What you might want is a polynomial indeterminate. The following non-Pythonic constructions builds both the polynomial ring R and the indeterminate x

sage: R.<x> = K[]
sage: R
Univariate Polynomial Ring in x over 5-adic Field with capped relative precision 70

WIth such a x, you can do:

sage: det(I - x*Matrix2)

The difference with the previous charpoly result seem to be some residual things:

sage: det(I - x*Matrix2) - Matrix2.charpoly()
O(5^-1843)*x^15 + O(5^-1813)*x^14 + O(5^-1585)*x^13 + O(5^-1544)*x^12 + O(5^-1316)*x^11 + O(5^-1275)*x^10 + O(5^-1047)*x^9 + O(5^-1006)*x^8 + O(5^-1006)*x^7 + O(5^-1047)*x^6 + O(5^-1275)*x^5 + O(5^-1316)*x^4 + O(5^-1544)*x^3 + O(5^-1585)*x^2 + O(5^-1813)*x + O(5^-1843)

Given the picture, i have to guess your construction (tell ):

Your field K :

sage: K = Qp(5,prec=70)                                                                                                                                                                                      
sage: K                                                                                                                                                                                                      
5-adic Field with capped relative precision 70

Your matrix I (which is the identity) :

sage: I = matrix.identity(K,15)

There is no information about Matrix2, hence, i will pick one randomly:

sage: M = I.parent()                                                                                                                                                                                         
sage: M                                                                                                                                                                                                      
Full MatrixSpace of 15 by 15 dense matrices over 5-adic Field with capped relative precision 70
sage: Matrix2 = M.random_element()

On my installation,

sage: Matrix2.charpoly()

works well.

Te folowing does not work:

sage: x*Matrix2

because, by default x is a symbol, to be used in symbolic expressions like sin(x)*sqrt(2).

What you might want is a polynomial indeterminate. The following non-Pythonic constructions builds both the polynomial ring R and the indeterminate x

sage: R.<x> = K[] 
sage: R
Univariate Polynomial Ring in x over 5-adic Field with capped relative precision 70

70

WIth such a x, you can do:

sage: det(I - x*Matrix2)

The difference with the previous charpoly result seem to be some residual things:

sage: det(I - x*Matrix2) - Matrix2.charpoly()
O(5^-1843)*x^15 + O(5^-1813)*x^14 + O(5^-1585)*x^13 + O(5^-1544)*x^12 + O(5^-1316)*x^11 + O(5^-1275)*x^10 + O(5^-1047)*x^9 + O(5^-1006)*x^8 + O(5^-1006)*x^7 + O(5^-1047)*x^6 + O(5^-1275)*x^5 + O(5^-1316)*x^4 + O(5^-1544)*x^3 + O(5^-1585)*x^2 + O(5^-1813)*x + O(5^-1843)

Given the picture, i have to guess your construction (tell ):

Your field K :

sage: K = Qp(5,prec=70)                                                                                                                                                                                      
sage: K                                                                                                                                                                                                      
5-adic Field with capped relative precision 70

Your matrix I (which is the identity) :

sage: I = matrix.identity(K,15)

There is no information about the construction of Matrix2, hence, i will pick one randomly:

sage: M = I.parent()                                                                                                                                                                                         
sage: M                                                                                                                                                                                                      
Full MatrixSpace of 15 by 15 dense matrices over 5-adic Field with capped relative precision 70
sage: Matrix2 = M.random_element()

On my installation,

sage: Matrix2.charpoly()

works well.

Te The folowing does not work:

sage: x*Matrix2

because, by default x is a symbol, to be used in symbolic expressions like sin(x)*sqrt(2).

What you might want is a polynomial indeterminate. The following non-Pythonic constructions builds both the polynomial ring R and the indeterminate x

sage: R.<x> = K[]                                                                                                                                                                                            
sage: R                                                                                                                                                                                                      
Univariate Polynomial Ring in x over 5-adic Field with capped relative precision 70

WIth such a x, you can do:

sage: det(I - x*Matrix2)

The difference with the previous charpoly result seem to be some residual things:

sage: det(I - x*Matrix2) - Matrix2.charpoly()
O(5^-1843)*x^15 + O(5^-1813)*x^14 + O(5^-1585)*x^13 + O(5^-1544)*x^12 + O(5^-1316)*x^11 + O(5^-1275)*x^10 + O(5^-1047)*x^9 + O(5^-1006)*x^8 + O(5^-1006)*x^7 + O(5^-1047)*x^6 + O(5^-1275)*x^5 + O(5^-1316)*x^4 + O(5^-1544)*x^3 + O(5^-1585)*x^2 + O(5^-1813)*x + O(5^-1843)

Given the picture, i have to guess your construction (tell ):

Your field K :

sage: K = Qp(5,prec=70)                                                                                                                                                                                      
sage: K                                                                                                                                                                                                      
5-adic Field with capped relative precision 70

Your matrix I (which is the identity) :

sage: I = matrix.identity(K,15)

There is no information about the construction of Matrix2, hence, i will pick one randomly:

sage: M = I.parent()                                                                                                                                                                                         
sage: M                                                                                                                                                                                                      
Full MatrixSpace of 15 by 15 dense matrices over 5-adic Field with capped relative precision 70
sage: Matrix2 = M.random_element()

On my installation,

sage: Matrix2.charpoly()

works well.

The folowing does not work:

sage: x*Matrix2

because, by default x is a symbol, to be used in symbolic expressions like sin(x)*sqrt(2).

What you might want is a polynomial indeterminate. The following non-Pythonic constructions builds both the polynomial ring R and the indeterminate x

sage: R.<x> = K[]                                                                                                                                                                                            
sage: R                                                                                                                                                                                                      
Univariate Polynomial Ring in x over 5-adic Field with capped relative precision 70

WIth such a x, you can do:

sage: det(I - x*Matrix2)

The difference with the previous charpoly result seem to be some residual things:things due to bounded precision:

sage: det(I - x*Matrix2) - Matrix2.charpoly()
O(5^-1843)*x^15 + O(5^-1813)*x^14 + O(5^-1585)*x^13 + O(5^-1544)*x^12 + O(5^-1316)*x^11 + O(5^-1275)*x^10 + O(5^-1047)*x^9 + O(5^-1006)*x^8 + O(5^-1006)*x^7 + O(5^-1047)*x^6 + O(5^-1275)*x^5 + O(5^-1316)*x^4 + O(5^-1544)*x^3 + O(5^-1585)*x^2 + O(5^-1813)*x + O(5^-1843)