Python - Calculate Change in Velocity for Hohmann Transfer Orbit
by matt392 in Circuits > Software
26 Views, 0 Favorites, 0 Comments
Python - Calculate Change in Velocity for Hohmann Transfer Orbit
# Formula to calculate change in velocity for Hohmann Transfer Orbit # Change in Veolcity = ((2 * Initial Velocity) * (sin((Inclination Change/2)))) # Use functions for left and right sides import math print ("Formula to calculate Hohmann Transfer Orbit") print ("The formula for watts is: Change in Veolcity = ((2 * Initial Velocity) * (sin((Inclination Change/2))))") # Define functions that will calculate the formula # Calculate the left side of the formula def leftsideofformula(): EnteredInitialVelocity = input ("Enter the initial velocity in meters per seconds: ") # Convert to integer InitialVelocity = int(EnteredInitialVelocity) LeftSideOfFormula = (2 * InitialVelocity) print("The left side of the formula is: ", LeftSideOfFormula) return LeftSideOfFormula # Calculate the bottom of the formula def rightsideofformula(): EnteredInclinationChange = input ("Enter the inclination change in degrees: ") # Convert to integer InclinationChange = float(EnteredInclinationChange) numberforsinecalculationradians = (InclinationChange/2) # Convert to radians # Use math.radians() function to convert degrees to radians numberforsinecalculation = math.radians(numberforsinecalculationradians) rightsideofformula = math.sin(numberforsinecalculation) print("The right side of the formula is: ", rightsideofformula) return rightsideofformula # Use the left and right numbers to make final velocity in calculation # Place result from function into variable to print ChangeInVeolcity = leftsideofformula() * rightsideofformula() print ("The change in velocity is:", ChangeInVeolcity, "meters per second.")