无效的语法不断出现在ap,r_ddot或ddy上。
def odeFunc(t,R):
r2=(R[[0]]**2+R[[1]]**2+R[[2]]**2)(0.5)
#Constants
mu=3.98716708E5 #gravitational parameters [km^3/s^2]
Re=6378.137 #Radius of earth
J= 0.0010826267
gamma= (5*R[2]**2)/(r2**2) #Partial coeff used to calculate ap
lambd= (-3*J*mu*Re**2)/(2*r2**5)
#Pertubation due to non-spherical earth
ap = np.reshape(np.array([[lambd*R[0]*(1-gamma)],[lambd*R[1]*(1-gamma)],[lambd*R[2]*(3-gamma)]],(3,1)
r_ddot = (-mu*R[0:3])/(r2**3) + ap #acceleration
ddy = [np.zeros((6,1))]
ddy = np.reshape(np.array([[R[3]],[R[4]],[R[5]],[r_ddot[0]],[r_ddot[1]],[r_ddot[2]],(6,1) #return value of acc and vel
return ddy