In this program, I have encountered the error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Given that the value of alpha in each iteration is only one number, why this error occurs.
while rho>1e-3:
print(alpha)
if alpha>-90 and alpha<=90:
rho_dot,alpha_dot,beta_dot = [-k_rho*rho*math.cos(alpha),
k_rho*math.sin(alpha)-k_alpha*alpha-k_beta*beta,-k_rho*math.sin(alpha)]
if np.union1d((alpha>-180 and alpha<=-90),(alpha>90 and alpha<=180)):
rho_dot,alpha_dot,beta_dot = [k_rho*rho*math.cos(alpha),-k_rho*math.sin(alpha)+k_alpha*alpha+k_beta*beta,k_rho*math.sin(alpha)]