Reputation: 305
I have an array from which I need to subtract the a value from one of the value in the array
I followed the suggestion given in this link. But didn't work in my case
My sample code is given below. In this , I wanted to subtract '1' from the second value of array (as mentioned in the function sig2(k).
I have tried as per the below link. But couldn't succeed.
Can some one let me know where am I going wrong
Subtract from first value in numpy array
import numpy as np
k = [1,3]
coe = np.array([[k[0],k[1]]])
def sig2(k):
return k[0] * np.power(lam1,((k[1]=-1)))
print(sig2(k))
Upvotes: 0
Views: 189
Reputation: 1907
Check the below code, is this what you want?
import numpy as np
k = [1,3]
coe = np.array([[k[0],k[1]]])
lam1 = 5
def sig2(k):
k[1] -= 1
return k[0] * np.power(lam1,(k[1]))
print(sig2(k))
Output
25
Upvotes: 1