Ask Your Question
0

polynomial

asked 8 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

.

p=5
f1=(p^2-1)
f2=divisors(f1)
f2
for  i in f2 :
    f=cyclotomic_polynomial(i,'z')
    print (i,f)

Result:

[1, 2, 3, 4, 6, 8, 12, 24]
(1, z - 1)
(2, z + 1)
(3, z^2 + z + 1)
(4, z^2 + 1)
(6, z^2 - z + 1)
(8, z^4 + 1)
(12, z^4 - z^2 + 1)
(24, z^8 - z^4 + 1)

i want the above result in the following form

phi1= z - 1
phi2= z + 1
phi3= z^2 + z + 1
phi4= z^2 + 1
phi6= z^2 - z + 1
phi8= z^4 + 1
phi12= z^4 - z^2 + 1
phi24= z^8 - z^4 + 1

how to obtained.

Preview: (hide)

Comments

To display inline code, surround it within backticks `.

To display blocks of code, either indent them with 4 spaces, or select the corresponding lines and click the "code" button (the icon with '101 010').

Can you edit your question to do that?

slelievre gravatar imageslelievre ( 8 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 8 years ago

fidbc gravatar image

Changing the print statement to print "phi{0} = {1}".format(i,f) should do the job.

Preview: (hide)
link

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: 8 years ago

Seen: 330 times

Last updated: Oct 19 '16