# Python code to solve equations of motion
# Constants
g=9.81# gravitational acceleration in m/s^2
# Function to solve equations of motion
defequations_of_motion(initial_velocity,time,acceleration,initial_position):# Final velocity
final_velocity=initial_velocity+acceleration*time# Final position
final_position=initial_position+initial_velocity*time+0.5*acceleration*time**2# Displacement
displacement=final_position-initial_positionreturnfinal_velocity,final_position,displacement# Example usage
# Inputs
initial_velocity=0.0# initial velocity in m/s
time=4.0# time in seconds
acceleration=9.81# acceleration in m/s^2 (free fall)
initial_position=0.0# initial position in meters
# Solve equations of motion
final_velocity,final_position,displacement=equations_of_motion(initial_velocity,time,acceleration,initial_position)# Output results
print("Final velocity:",final_velocity,"m/s")print("Final position:",final_position,"m")print("Displacement:",displacement,"m")
During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:
Ensure the proper functioning of the site (essential cookies); and
Track your browsing to send you personalized communications if you have created a professional account on the site and can be contacted (audience measurement cookies).
With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.