Completed the function for torque and euler-lagrangian: tested but not thoroughly