Answer the question
In order to leave comments, you need to log in
How to change vector values?
Declared a variable and set values for it:
dphi = x[0:2] * 0.1
p = np.zeros((4))
dp = np.zeros((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
You are trying to use the 3rd element of the dphi array in the expression dphi[2] * p[3]. And they created an array with only 2 elements: dphi = x[0:2] * 0.1.
Apparently it is necessary to do so: dphi = x[: 3] * 0.1.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question