Ask Your Question
1

retrieve field of a Matrix

asked 2016-11-24 13:42:28 +0100

fagui gravatar image

it may sound a stupid question,

but I'd like to know how to retrieve in a variable the field overwhich a Matrix is defined

for example, if

K=GF(7)
M=random_matrix(K,2,2)

Is there a function where i can define for example K'= M.field() [and K' would be equal to K]

?

M.parent() provides some information of course, but we cannot use it directly

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-11-24 14:05:09 +0100

slelievre gravatar image

Use the base_ring method.

Here is an example.

Define a field.

sage: K = GF(7)
sage: K
Finite Field of size 7

A matrix over this field.

sage: M = random_matrix(K, 2, 2)

The matrix's base ring:

sage: KK = M.base_ring()
sage: KK
Finite Field of size 7

Check that it is the same as your original field.

sage: K is KK
True
edit flag offensive delete link more

Comments

thank you !

fagui gravatar imagefagui ( 2016-11-24 17:52:41 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-11-24 13:42:28 +0100

Seen: 218 times

Last updated: Nov 24 '16