def real_annomaly_from_eccentric(self, time): ecc_an = utils.eccentric_annomaly(self.period, self.epsilon, time) real_an = np.arccos((np.cos(ecc_an)[0] - self.epsilon) / (1 - self.epsilon*np.cos(ecc_an)[0])) real_an = real_an if 2*time < self.period else 2*np.pi - real_an return real_an
def position(self, time): time = self.get_time_in_period(time) eccentric_annomaly = utils.eccentric_annomaly(self.period, self.epsilon, time) position = [ self.a * (np.cos(eccentric_annomaly) - self.epsilon)[0], self.a * np.sqrt(1 - self.epsilon**2) * np.sin(eccentric_annomaly)[0] ] return position
def speed(self, time): time = self.get_time_in_period(time) eccentric_annomaly = utils.eccentric_annomaly(self.period, self.epsilon, time) denom = self.period * (1 - self.epsilon * np.cos(eccentric_annomaly)) quotient = 2 * np.pi * self.a / denom speed = [(-quotient * np.sin(eccentric_annomaly))[0], (quotient * np.sqrt(1 - self.epsilon**2) * np.cos(eccentric_annomaly))[0]] return speed
def speed_2bodies(self, time): G = 6.674*10**(-11) sun_mass = 1.989*10**30 mu = 8.9546188*10**(-25)*G*sun_mass**3/(self.mass + sun_mass)**2 period = np.sqrt(4*np.pi**2*self.a**3/mu) time = self.get_time_in_period(time) eccentric_annomaly = utils.eccentric_annomaly( period, self.epsilon, time ) denom = period*(1-self.epsilon*np.cos(eccentric_annomaly)) quotient = 2*np.pi*self.a/denom speed = [ (-quotient*np.sin(eccentric_annomaly))[0], (quotient * np.sqrt(1 - self.epsilon**2)*np.cos(eccentric_annomaly))[0] ] return speed
def eccentric_annomaly(self, time): time = self.get_time_in_period(time) return utils.eccentric_annomaly(self.period, self.epsilon, time)[0]