Python - Lift to Drag Ratio

by matt392 in Circuits > Software

70 Views, 1 Favorites, 0 Comments

Python - Lift to Drag Ratio

airlinetakoff.jpg
liftdragratio.gif
2ndlawformula.png
LiftToDragRatioFormula.png
print ("This program will calculate the Lift to Drag Ratio.")

import math

###  Formula for calculating the Lift to Drage Ratio:
#  LiftToDragRatio = ( (.5) * math.sqrt( (math.pi*AspectRatio*SpanEfficiencyFactor)/(ZeroLiftDragCoefficient) )
###########################################

# Enter the AspectRatio, SpanEfficiencyFactor, ZeroLiftDragCoefficient
ContinueCalculations = "y"

def CalculateLiftToDragRatio():
    print ("Solving for the the Lift to Drag Ratio.")
    # Enter the AspectRatio 
    AspectRatio = float(input("Enter the Aspect Ratio: ") )
    # Enter the SpanEfficiencyFactor
    SpanEfficiencyFactor = float(input("Enter the Span Efficiency Factor: ") )
    # Enter the Zero Lift Drag Coefficient
    ZeroLiftDragCoefficient = float(input("Enter the Zero Lift Drag Coefficient: ") )
    # Pi is a constant
    # math.pi
        
    # Calculate the top of the fraction
    TopOfFraction = (math.pi * AspectRatio * SpanEfficiencyFactor)
    print("The top of thefraction is: ", TopOfFraction)
    # Calculate the fraction
    CalculateFraction = (TopOfFraction/ZeroLiftDragCoefficient)
    print("The fraction calculated is: ", CalculateFraction)
    # Find square root
    SquareRootResult = math.sqrt(CalculateFraction)
    print("The square root is: ", SquareRootResult)
    LiftToDragRatio = (.5) * SquareRootResult
    print("The lift to drag ratio is: ", LiftToDragRatio)

while (ContinueCalculations=="y"):
    CalculateLiftToDragRatio()
    ContinueCalculations = str(input("Would you like to continue to calculate the lift to drag ratio (y/n): ")) 

print("==================================")
print ("Thank you to www.fxsolver.com for assistance with this formula.")

Downloads