The results are identical. As explained previously, the computational time for this symbolic derivation grows slower with the number of dofs compared to the Lagrange equation of second kind.Table 4 explains the code. This code may be written more compact e.g. by introducing a subfunction for deriving M and h for every single body. This was not done here, to keep the code easily readable and as close as possible to the original equations.