0
import numpy as np

F = np.arange(0.1, 1.6, 0.1)

m = 10

for i in range(1, 17, 1):
    i = F
    A = i * i * (m - 1)
    B = (i * i * m - 1)
    C = i * (i * i - 1) * (m - 1) * 0.2
    print(C)

    D = complex(B, C)
    E = A / D
    I = abs(complex(E))
    print(I)
[-0.1782 -0.3456 -0.4914 -0.6048 -0.675  -0.6912 -0.6426 -0.5184 -0.3078
  0.      0.4158  0.9504  1.6146  2.4192  3.375 ]

Traceback (most recent call last):
  File "complex.py", line 17, in <module>
    D = complex(B,C)
TypeError: only length-1 arrays can be converted to Python scalars

How can I use the complex() function with arrays? If that is the problem.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65

0 Answers0