Answer the question
In order to leave comments, you need to log in
How to write equations for array elements?
I have an array dp:
def d_phi(a, b):
return a
dphi = quad(d_phi, t, t + 0.01, args=(x[0:2]))
p = np.zeros((1,4)) # Лучше объявить до начала работы функции
dp = np.zeros((1,4))
dp[0] = (-dphi[0] * p[1] - dphi[1] * p[2] - dphi[2] * p[3])/2
dp[1] = ( dphi[0] * p[0] + dphi[2] * p[2] - dphi[1] * p[3])/2
dp[2] = ( dphi[1] * p[0] - dphi[2] * p[1] + dphi[0] * p[3])/2
dp[3] = ( dphi[2] * p[0] + dphi[1] * p[1] - dphi[0] * p[1])/2
p = p + dp
Answer the question
In order to leave comments, you need to log in
It is obvious from the error that the problem is in the indexes (in the array declaration)
What does this line do?dp = np.zeros((1,4))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question