Python - Electron Speed Calculation
by matt392 in Circuits > Software
50 Views, 1 Favorites, 0 Comments
Python - Electron Speed Calculation


print ("This program will calculate the Electron Speed.") import math ### Formula for calculating the Electron Speed: # ElectronSpeed = sqrt(((AtomicNumber*CoulombsConstant*(AtomicUnitOfCharge**2))/(ElectronMass*OrbitRadius)) ########################################### # Enter the AtomicNumber, OrbitRadius # def SolveForElectronSpeed(): print ("Solving for the electron speed.") # Enter the atomic number AtomicNumber = float(input("Enter the Atomic Number: ") ) # Coulomb's Constant CoulombsConstant = (8.98755179 * (10**-9)) print("Coulomb's Constant is: ", CoulombsConstant) AtomicUnitOfCharge = 1.602176565*(10**-19) print("The Atomic Unit of Charge is: ", AtomicUnitOfCharge) ElectronMass = (9.10938291*(10**-31)) print("The Electron Mass is: ", ElectronMass) # Enter the orbit radius OrbitRadius = float(input("Enter the orbit radius (eg:.00001): ") ) # Calculate top of fraction TopOfFraction = ((AtomicNumber) * (CoulombsConstant) * (AtomicUnitOfCharge**2) ) print ("The top of the fraction is: ", TopOfFraction) # Calculate the bottom of fraction BottomOfFraction = (ElectronMass * OrbitRadius) print ("The bottom of fraction is: ", BottomOfFraction) # Calculate the fraction FractionCalculated = (TopOfFraction/BottomOfFraction) print("The fraction is: ", FractionCalculated) ElectronSpeed = math.sqrt(FractionCalculated) print("The Electron Speed is: ", ElectronSpeed) ContinueCalculations = "y" # Check to see if the user wants to continue to calculate electron speed while (ContinueCalculations=="y"): SolveForElectronSpeed() ContinueCalculations = input("Would like to do another calculation for Electron Speed? (y/n): ") print("==================================") print ("Thank you to www.fxsolver.com for assistance with this formula.")