如何在 Python 中使用 UliEngineering 计算钛或不锈钢棒的重量
在以下示例中,我们将计算尺寸为 Ø10mm x 100mm 的纯(即 2 级)钛棒的重量,并将其与相同尺寸的 1.4404 钢棒进行比较。
为此,我们将使用包含预定义密度值的 UliEngineering.Physics.Density 和 UliEngineering.Math.Geometry.Cylinder 来计算棒的体积。
rod_weight_example.py
from UliEngineering.Math.Geometry.Cylinder import *
from UliEngineering.Physics.Density import *
weight_14404 = cylinder_weight_by_diameter(diameter=0.010, length=0.1, density=Densities['1.4404'])
weight_titanium = cylinder_weight_by_diameter(diameter=0.010, length=0.1, density=Densities['Titanium'])
print(f"Weight of 1.4404 rod: {weight_14404:.3n} kg")
print(f"Weight of Titanium rod: {weight_titanium:.3n} kg")这会打印:
output.txt
Weight of 1.4404 rod: 0.0628 kg
Weight of Titanium rod: 0.0354 kgCheck out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow