Como converter aceleração de g para m/s² em Python usando UliEngineering

Você pode converter facilmente aceleração de g (gravidade padrão) para m/s² usando a biblioteca Python UliEngineering:

TechOverflow calculators:
You can enter values with SI suffixes like 12.2m (equivalent to 0.012) or 14k (14000) or 32u (0.000032).
The results are calculated while you type and shown directly below the calculator, so there is no need to press return or click on a Calculate button.
g
g_to_ms2.py
from UliEngineering.Physics.Acceleration import *
from UliEngineering.EngineerIO import *

# Converter 1g para m/s²
acceleration = g_to_ms2("1g")
print(f"1g = {format_value(acceleration, 'm/s²')}")

# Converter 2.5g para m/s²
acceleration = g_to_ms2("2.5g")
print(f"2.5g = {format_value(acceleration, 'm/s²')}")

Exemplo de saída

g_to_ms2_output.txt
1g = 9.81 m/s²
2.5g = 24.5 m/s²

A conversão usa o valor de gravidade padrão g₀ = 9,80665 m/s².


Check out similar posts by category: Calculators, Physics, Python