## 2 Materials and Methods
### Static Optimization
\begin{cases}\begin{array}{c}l_{mt,i}=\sum\limits_{j=1}^{n_{s}}\mathbf{r}_{B,j }-\mathbf{r}_{A,j}\Big{]}+\sum\limits_{k=1}^{n_{w}}\mathbf{\Big{[}}\mathbf{c}_{PQ,k}^{ \prime}\Big{]}ds\\ v_{mt,i}=\sum\limits_{j=1}^{n_{s}}\mathbf{\Big{[}}\mathbf{v}_{B,j}-\mathbf{v}_{A,j}\Big{]} ^{T}\mathbf{\lambda}_{AB,j}+\sum\limits_{k=1}^{n_{w}}\mathbf{\Big{[}}\mathbf{v}_{Q,k}^{T} \mathbf{\lambda}_{Q,k}-\mathbf{v}_{p,k}^{T}\mathbf{i}_{p,k}\Big{)}\end{array}\end{cases}  \tag{30}\]  
From Equation (20), each muscle force \(F_{m,i}\) is written in Equation (31) as the sum of an active part \(\overline{F}_{CE,i}\) multiplied by the activation level \(a_{i}\) and a passive part \(\overline{F}_{PE,i}\), in order to relate the muscle force vector \(\mathbf{F}_{m}\) to the activation vector \(\mathbf{a}\), through the maximum active muscle force \(\overline{F}_{CE}\), and the passive muscle force vector \(\overline{F}_{PE}\) (which take into account the muscles' length, velocity, pennation and maximum isometric force). \[F_{m,i}=a_{i}\overline{F}_{CE,i}+\overline{F}_{PE,i}\ \to\ \mathbf{D}_{CE}=diag\Big{(} \overline{F}_{CE}\Big{)}\ \to\ \mathbf{F}_{m}=\mathbf{D}_{CE}\mathbf{a}+\overline{F}_{PE} \tag{31}\]  
Substituting in (29), the unknowns in the equation of motion (32) are the activation vector \(\mathbf{a}\) and the Lagrange multipliers related to the scleronomic constraints \(\mathbf{\lambda}_{s}\), which definitely represent the joint reactions, by including the muscle activation Jacobian \(\mathbf{\Phi}_{\overline{q},CE}\) and the generalised passive muscle force vector \(\mathbf{Q}_{PE}\). \[\left\{ \begin{array}{l}\mathbf{\Phi}_{\overline{q},CE}=\mathbf{D}_{CE}\mathbf{\Phi}_{ \overline{q}}\\ \mathbf{Q}_{PE}=\mathbf{\Phi}_{\overline{q}}^{T}\mathbf{F}_{PE}\end{array} \right.\to\left[ \begin{array}{cc}\mathbf{\Phi}_{\overline{q},CE}^{T}&-\mathbf{C}_{\overline{q},s}^{T} \end{array} \right]\left\| \begin{array}{l}\mathbf{a}\\ \mathbf{\Lambda}_{s}\end{array} \right\|=\mathbf{Q}_{c}-\mathbf{Q}_{PE} \tag{32}\]  
Since the linear equation system (32) has more unknowns than equations, due to the muscle redundancy, it is used as an equality constraint in the static optimization problem which minimizes the global muscle activation level (physiological criterion). If the muscle topology modelling is not accurate, the static optimization could fail, so the Lagrange multipliers associated with the rheonomic constraints \(\mathbf{\lambda}_{r}\) are reintroduced in (32) with the role of residual actuators, whose action has to be minimized together with the muscle activations (bounded between 0 and 1), in order to ensure the optimization convergence while satisfying the equation of motion, as written in (33). \[\left\{ \begin{array}{l}\mathbf{\Phi}_{\overline{q},CE}^{T}&-\mathbf{C}_{\overline{q},s}^{T}&-\mathbf{C}_{\overline{q},r}^{T}\end{array} \right.\left[ \begin{array}{l }\mathbf{a}\\ \mathbf{\Lambda}_{s}\end{array} \right]=\mathbf{Q}_{c}-\mathbf{Q}_{PE} \tag{33}\] \[\left\{ \begin{array}{l}\mathbf{A}=\begin{bmatrix}\mathbf{\Phi}_{\overline {q},CE}^{T}&-\mathbf{C}_{\overline{q},s}^{T}&-\mathbf{C}_{\overline{q},r}^{T}\end{bmatrix} \\ \mathbf{x}=\begin{bmatrix}\mathbf{a}\\ \mathbf{\Lambda}_{s}\\ \mathbf{\Lambda}_{r}\end{bmatrix}&\to&\mathbf{Ax}=\mathbf{b}\\ \mathbf{0}\leq\mathbf{a}\leq\mathbf{1}\\ \end{array} \right.\] \[\mathbf{b}=\mathbf{Q}_{c}-\mathbf{Q}_{PE}\]