Analytical Derivatives for Efficient Mechanical Simulations of Hybrid Soft Rigid Robots