- #1
- 2,168
- 193
Code:
from numpy import log as ln
z = 3
k = 2
x = 1 - ln(1 + z) / ln(1 + k)
y = 1/5
print("The x=", x)
Q = x**y
print(Q)
The result is
Code:
The x= -0.26185950714291484
c:\Users\-\Desktop\... RuntimeWarning: invalid value
encountered in double_scalars
Q = x**y
nan
I am having troubling to understand the problem here. It's clear that I can print the x, but I cannot take the power of it.Meanwhile when I write a code like
Code:
x = -0.26185950714291484
y = 1/5
print("The x=", x)
Q = x**y
print(Q)
I get
Code:
The x= -0.26185950714291484
(0.6188299348758349+0.44960626529008196j)
I am literally shocked. I cannot understand what is going on. If I just put the numbers manually I can calculate the result. But if I do them computationally I get an error ?