Jak převést zrychlení z m/s² na g v Pythonu pomocí UliEngineering

Můžete snadno převést zrychlení z m/s² na g (standardní tíhové zrychlení) pomocí knihovny UliEngineering v Pythonu:

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.
m/s²
ms2_to_g.py
from UliEngineering.Physics.Acceleration import *
from UliEngineering.EngineerIO import *

# Převod 9.81 m/s² na g
acceleration = ms2_to_g("9.81 m/s²")
print(f"9.81 m/s² = {format_value(acceleration, 'g')}")

# Převod 24.5 m/s² na g
acceleration = ms2_to_g("24.5 m/s²")
print(f"24.5 m/s² = {format_value(acceleration, 'g')}")

Příklad výstupu

ms2_to_g_output.txt
9.81 m/s² = 1.00 g
24.5 m/s² = 2.50 g

Převod používá standardní hodnotu tihového zrychlení g₀ = 9.80665 m/s².


Podívejte se na podobné články podle kategorie: Calculators, Physics, Python