Formula manipulation in the bond graph modelling and simulation of large mechanical systems