如何使用 UliEngineering 在 Python 中将加速度从 m/s² 转换为 g

你可以使用 UliEngineering Python 库轻松地将加速度从 m/s² 转换为 g(标准重力):

ms2_to_g.py
from UliEngineering.Physics.Acceleration import *
from UliEngineering.EngineerIO import *

# 将 9.81 m/s² 转换为 g
acceleration = ms2_to_g("9.81 m/s²")
print(f"9.81 m/s² = {format_value(acceleration, 'g')}")

# 将 24.5 m/s² 转换为 g
acceleration = ms2_to_g("24.5 m/s²")
print(f"24.5 m/s² = {format_value(acceleration, 'g')}")

示例输出

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

转换使用标准重力值 g₀ = 9.80665 m/s²。


Check out similar posts by category: Physics, Python