fork(2) download
  1. from math import pi, e
  2. def F(array, x):
  3. value = 0
  4. for i in xrange(len(array)):
  5. value += array[i] * (x**i)
  6. return value
  7.  
  8. W =[]
  9. for i in xrange(8):
  10. W.append(pow(e, (2*pi*1j*i) / 8))
  11. #print W
  12.  
  13. ansa, ansb = [], []
  14. a = [1,1,2,0,0,0,0,0]
  15. b = [1,3,0,0,0,0,0,0]
  16. for i in xrange(8):
  17. ansa.append(F(a, W[i]))
  18. ansb.append(F(b, W[i]))
  19. print ansa
  20. print
  21. print ansb
  22.  
  23.  
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
[(4+0j), (1.7071067811865477+2.7071067811865475j), (-1+1.0000000000000002j), (0.2928932188134522-1.2928932188134525j), (2-3.6739403974420594e-16j), (0.2928932188134529+1.292893218813453j), (-1.0000000000000002-0.9999999999999992j), (1.7071067811865466-2.707106781186548j)]

[(4+0j), (3.121320343559643+2.1213203435596424j), (1.0000000000000002+3j), (-1.1213203435596424+2.121320343559643j), (-2+3.6739403974420594e-16j), (-1.1213203435596428-2.1213203435596424j), (0.9999999999999994-3j), (3.121320343559642-2.121320343559643j)]