print ("This program will calculate the Tsiolkovsky rocket equation..")
import math
### Formula for calculating the Tsiolkovsky rocket equation:
# MaxChangeInVelocity = (EffectiveExhaustVelocity) * NaturalLog(InitialTotalMass)/(FinalTotalMass)
# math.log(x): Return the natural logarithm of x (to base e).
# Example: NaturalLogOfX = math.log(x)
###########################################
# Enter the EffectiveExhaustVelocity, InitialTotalMass, FinalTotalMass
#
def SolveForMaxChangeInVelocity():
print ("Solving for the lead angle.")
# Enter the Effective Exhaust Velocity
EffectiveExhaustVelocity = float(input("Enter the Effective Exhaust Velocity: ") )
# Enter the Initial Total Mass
InitialTotalMass = float(input("Enter the Initial Total Mass: ") )
# Enter the Final Total Mass
FinalTotalMass = float(input("Enter the Final Total Mass: ") )
# Calculate the fraction
FractionCalculated = (InitialTotalMass/FinalTotalMass)
print("The fraction is: ", FractionCalculated)
# Find the natural log
NaturalLogOfFraction = math.log(FractionCalculated)
print("The natural log of the faction is: ", NaturalLogOfFraction)
# Calculate the maximum change in velocity
MaxChangeInVelocity = EffectiveExhaustVelocity * NaturalLogOfFraction
print("The maximum change in velocity is: ", MaxChangeInVelocity)
ContinueCalculations = "y"
# Check to see if the user wants to continue to calculate the maximum change in velocity
while (ContinueCalculations=="y"):
SolveForMaxChangeInVelocity()
ContinueCalculations = input("Would like to do another calculation for the maxmimum change in velocity? (y/n): ")
print("==================================")
print ("Thank you to www.fxsolver.com for assistance with this formula.")