modified to calcurate an inertia.