eq_horaire_solveur.py

Created by teivaetienne

Created on December 18, 2024

942 Bytes


# Python code to solve equations of motion (equations horaires)

# Function to solve all types of motion equations
def solve_equation_horaire(initial_position, initial_velocity, acceleration, time):
    # Position as a function of time
    position = initial_position + initial_velocity * time + 0.5 * acceleration * time ** 2

    # Velocity as a function of time
    velocity = initial_velocity + acceleration * time

    return position, velocity

# Example usage
# Inputs
initial_position = 0.0  # initial position in meters
initial_velocity = 5.0  # initial velocity in m/s
acceleration = 2.0  # acceleration in m/s^2
time = 3.0  # time in seconds

# Solve equations of motion
position, velocity = solve_equation_horaire(initial_position, initial_velocity, acceleration, time)

# Output results
print("Position after", time, "seconds:", position, "m")
print("Velocity after", time, "seconds:", velocity, "m/s")

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

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.