modified to speed up the solution of redundant Newton-Euler