How to compute the weight of a titanium or stainless steel rod using UliEngineering in Python
In the following example, we’ll compute the weight of a pure (i.e. grade 2) titanium rod of dimensions Ø10mm x 100mm
and compare it to a 1.4404 steel rod of the same size.
In order to do that, we’ll use UliEngineering.Physics.Density
containing pre-defined density values and UliEngineering.Math.Geometry.Cylinder
to compute the volume of the rod.
In order to run this script, first install UliEngineering.
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")
This prints:
Weight of 1.4404 rod: 0.0628 kg
Weight of Titanium rod: 0.0354 kg