print ("This program will calculate the final position of the 2nd Equation of Motion.")
import math
# Formula for calculating the final position of the 2nd Equation of Motion:
# FinalPosition = ((Acceleration*(Time**2))/2) + InitialLinearVelocity * Time + InitialPosition
###########################################
# Enter the Acceleration, Time, InitialLinearVelocity and InitialPosition
def SolveFor2ndEquationOfMotion():
print ("Solving for the final position of the 2nd Equation of Motion.")
# Enter the acceleration
Acceleration = float(input("Enter the acceleration in meters/second**2: ") )
# Enter the time
Time = float(input("Enter the time in seconds: ") )
# Enter the initial linear velocity
InitialLinearVelocity = float(input("Enter the initial linear velocity in meters per second: ") )
# Enter the initial position
InitialPosition = float(input("Enter the initial position in meters: ") )
# Calculate fraction first
# Calculate top of fraction
TopOfFraction = (Acceleration*(Time**2))
print ("The top of the fraction is: ", TopOfFraction)
# Calculate the fraction
FractionCalculated = (TopOfFraction/2)
print ("The fraction calculated is: ", FractionCalculated)
# Calculate right side of equation; do the multiplication first!
RightSideOfEquation = (InitialLinearVelocity*Time) + InitialPosition
print("The bottom of the right side of the equation is: ", RightSideOfEquation)
# Add the fraction side to the right side
FinalPosition = FractionCalculated + RightSideOfEquation
print("The final position is: ", FinalPosition, "meters.")
ContinueCalculations = "y"
# Check to see if the user wants to continue to calculate the 2nd Equation of Motion
while (ContinueCalculations=="y"):
SolveFor2ndEquationOfMotion()
ContinueCalculations = input("Would like to do another calculation for for the final position of the 2nd Equation of Motion? (y/n): ")
print("==================================")
print ("Thank you to www.fxsolver.com for assistance with this formula.")