Pythonを手伝ってくれる人はいますか?次のコードを実行すると、L_
ANDの両方で1.0の出力が得られますL_1
が、1にしたいだけです。
import math
d_ = 0 # My student number last digit
n_ = 10 + 0 # nth roots of unity
import math as m # for real
import cmath as m # for complex
# K_ [ number of the root]
K_ = 9
Root = m.exp((2 * K_ * m.pi * 1j) / n_) # determine the nth root of unity by using exponential form
Root1 = math.cos((2 * K_ * m.pi / n_)) + 1j * math.sin((2 * K_ * m.pi / n_)) # determine the nth root of unity by using polar form
p_ = (Root) ** (n_) # 10th power of Root
p_1 = (Root1) ** (n_) # 10th power of Root1
L_ = (Root.real ** 2 + Root.imag ** 2) # Test whether the point Root lies on unit circle
L_1 = (Root1.real ** 2 + Root1.imag ** 2) # Test whether the point Root1 lies on unit circle
print L_
print L_1