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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!