Question
*I'm getting either zero division errors or L1/v1 not defined* *I tried adding a ValueError() for L1
*I'm getting either zero division errors or L1/v1 not defined* *I tried adding a ValueError() for L1<=0 and it didn't work*
def orbit_data_from_perihelion(L1, v1): """Given the perihelion distance and speed of a solar orbit (in SI units: m and m/s), return a dictionary containing multiple parameters of the orbit: L1: perihelion distance (m) v1: perihelion speed (m/s) L2: aphelion distance (m) v2: aphelion speed (m/s) a: semi-major axis (m) b: semi-minor axis (m) T: orbital period (s) e: orbital eccentricity T_yr: orbital period (years) """ G=6.67*10**-11 M=1.998e30 a1=1 b1=((2*G*M)/(v1*L1)) c=((2*G*M)/L1) v2=(b1+-(b1**2-(4*a1*(-v1**2+(c))))**(1/2))/2 L2=(L1*v1)/v2 a=(1/2)(L1+L2) b=((L1*l2)**(1/2)) T=((2*pi*a*b)/(L1*v1)) e=((L2-L1)(L2+L1)) T_yr=365.2422 orbitdict:{L1:"perihelion distance (m)",v1:"perihelion speed (m/s)",L2:"aphelion distance (m)", v2:"aphelion speed (m/s)", a:"semi-major axis (m)", b:"semi-minor axis (m)", T:"orbital period (s)", e:"orbital eccentricity", T_yr:"orbital period (years)"} return(orbitdict)
orbit_data_from_perihelion(L1,v1)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started