Ask Your Question
0

Evaluating expressions with zetan for insertion into numpy array

asked 2023-09-26 00:11:56 +0100

ayodan gravatar image

I'm working with the character table of the centralizer for Z4: G = CyclicPermutationGroup(4) followed by t = G.character_table() yields

[     1      1      1      1]
[     1     -1      1     -1]
[     1 -zeta4     -1  zeta4]
[     1  zeta4     -1 -zeta4]

I'm trying to simplify results of calculations using this table for insertion into numpy arrays (these results simply involve adding and multiplying elements of the table). For example, let us consider f = t[1,3] - 4 * t[3,3] which evaluates to -4*zeta4 - 1. I've tried using AlgebraicConverter and .arithmetic() functionalities.

a = AlgebraicConverter(QQbar)
a.arithmetic(f, f.operator())

I obtain the following error

AttributeError: 'sage.rings.number_field.number_field_element.NumberFieldElement_absolute' object has no attribute 'operator'

Advice on how to remedy this error or how to follow a better approach would be greatly appreciated.

edit retag flag offensive close merge delete

Comments

Do you mean something like this :

sage: G = CyclicPermutationGroup(4)
sage: t = G.character_table()
sage: t[1,3]-4*t[3,3]
-4*zeta4 - 1
sage: import numpy
sage: numpy.complex64((t[1,3]-4*t[3,3]))
(-1-4j)
Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2023-09-26 12:10:11 +0100 )edit

Yes thank you!

ayodan gravatar imageayodan ( 2023-09-26 22:38:53 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-09-27 19:25:33 +0100

Emmanuel Charpentier gravatar image

In order to give an explicit answer to this question for the enefit of future perusers, I copy my previous comment :

sage: G = CyclicPermutationGroup(4)
sage: t = G.character_table()
sage: t[1,3]-4*t[3,3]
-4*zeta4 - 1
sage: import numpy
sage: numpy.complex64((t[1,3]-4*t[3,3]))
(-1-4j)

HTH,

edit flag offensive delete link more

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: 2023-09-26 00:11:56 +0100

Seen: 123 times

Last updated: Sep 27 '23