So, I have the following code in R:
y
a <- -0.1
test <- (1/((y+as.numeric(!y))*(a-1)))
test
test^a
-0.9090909^a
Giving me the output:
> y
[1] 0.00000000 0.06024096 0.00000000 0.01098901 0.00000000 0.00000000
[7] 0.01829268 0.00000000 0.06976744 0.00000000 0.04380665 0.01351351
[13] 0.00000000 0.00000000 0.00000000 0.00000000 0.00310559 0.00000000
[19] 0.00000000 0.00000000 0.09957447 0.00000000 0.03738318 0.00000000
> a <- -0.1
> test <- (1/((y+as.numeric(!y))*(a-1)))
> test
[1] -0.9090909 -15.0909091 -0.9090909 -82.7272727 -0.9090909
[6] -0.9090909 -49.6969697 -0.9090909 -13.0303030 -0.9090909
[11] -20.7523511 -67.2727273 -0.9090909 -0.9090909 -0.9090909
[16] -0.9090909 -292.7272727 -0.9090909 -0.9090909 -0.9090909
[21] -9.1297591 -0.9090909 -24.3181818 -0.9090909
> test^a
[1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
[17] NaN NaN NaN NaN NaN NaN NaN NaN
> -0.9090909^a
[1] -1.009577
I do not understand why It gives me NaN when taking test to the power a, when clearly, I can simply copy a single value from test and raise it to the power a, and that works. Using test[1]^a does not work either.