Ask Your Question
0

polynomial

asked 2016-10-09 13:05:29 -0500

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.

edit retag flag offensive close merge delete

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 ( 2016-10-10 06:52:56 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-10-18 20:34:55 -0500

fidbc gravatar image

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

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: 2016-10-09 13:05:29 -0500

Seen: 64 times

Last updated: Oct 18 '16