I was reading the paper "Introduction to quantum electromagnetic circuits", by U. Vool and M. Devoret and I am stuck in the construction of a Lagrangian function for the example LC circuit they present there (figure attached).
The recipe says: $$\mathcal{L} = \mathcal{E}_{kin} - \mathcal{E}_{pot},$$ being the subtraction of kinetic energy and potential energy. My problem is with potential term, and just for clarity I will show both of them.
Kinetic energy can be obtained from: $$\mathcal{E}_{kin} = \frac{1}{2}\dot{\phi}^{T}[C]\dot{\phi},$$ being $$\phi = \begin{pmatrix} \phi_a\\ \phi_b \end{pmatrix} $$
the node flux vector, \dot{\phi} its derivative, and \$[C]\$ is the capacitance matrix, when you run through an open loop of capacitors, and the potential term is given by $$ \mathcal{E}_{pot} = \frac{1}{2} \phi^T[L^{-1}]\phi + \sum_{b} \frac{1}{L_b} (\phi_n - \phi_{n'})\tilde{\Phi}_b. $$ In above equation, \$[L^{-1}]\$ is the matrix of inverse of inductances, obtained when you run through the inductances loop and remove row and column of the ground node. The sum in second term of the potential energy extends to all branches that contains an inductor, and \$\phi_n - \phi_{n'}\$ is the difference in fluxes between nodes \$n\$ and \$n'\$.
The potential energy they found in the paper for the circuit in the figure (attached) is:
$$ \mathcal{E}_{pot} = \frac{\phi_a^2}{2L_1} + \frac{\phi_b^2}{2L_2} + \frac{(\phi_a - \phi_b + \tilde{\Phi})^2}{2L_3}. $$
The relation between node flux and branch flux is given by: $$ \Phi_{b\in T} = \phi_n - \phi_{n'}\\ \Phi_{b\in \bar{T}} = \phi_n - \phi_{n'} + \tilde{\Phi}, $$ with \$\tilde{\Phi}\$ the magnetic flux through the loop formed by inductors, and T is the spanning tree and \$\bar{T}\$ its complement.
The \$[L^{-1}]\$ matrix is obtained as following: non diagonal elements are written as \$-1/L_{j,k}\$, where \$L_{j,k}\$ is the inductance in a branch that connects nodes j and k. The diagonal elements will be the opposite of the sum of values in the corresponding row or column.
Proceeding in this way, I get: $$ \begin{pmatrix} \frac{1}{L_1} + \frac{1}{L_3} && -\frac{1}{L_3}\\ -\frac{1}{L_3} && \frac{1}{L_2} + \frac{1}{L_3} \end{pmatrix} $$
I already removed the row and column of the ground node.
For the sum term, I get: $$ \sum_{b} \frac{1}{L_b} (\phi_n - \phi_{n'}) \tilde{\Phi}_b = \frac{1}{L_1} (\phi_a + \tilde{\Phi})\phi_a + \frac{1}{L_2} (\phi_b + \tilde{\Phi})\phi_b + \frac{1}{L_3} (\phi_a - \phi_b + \tilde{\Phi})(\phi_a - \phi_b). $$
In above equation, I consider that the flux in ground node is zero.
When I sum all the terms, there is no way to get the same result the authors shown.
If someone is aware of the recipe by Devoret, would be nice to hear from. Is my error in L matrix, in sum over inductive branches term, or both?
-- EDIT: Detailed calculation.
For kinetic energy the capacitances matrix is: $$ [C'] = \begin{pmatrix} C_1 + C_2 & -C_1 & -C_2 \\ -C_1 & C_1 + C_3 & -C_3 \\ -C_2 & -C_3 & C_2 + C_3 \end{pmatrix} $$ Being 1 the ground node, I eliminate row 1 column 1, which gives: $$ [C] = \begin{pmatrix} C_1 + C_3 & -C_3 \\ -C_3 & C_2 + C_3 \end{pmatrix} $$
Now we must to perform a simple matrix product (see eq. for kinetic energy) to get: $$ \mathcal{E}_{kin} = \frac{C_1 \dot{\phi}_a^2}{2} + \frac{C_2 \dot{\phi}_b^2}{2} + \frac{C_3 (\dot{\phi}_a^2 - \dot{\phi}_b^2)}{2}, $$ which is the expected result and is given in paper.
For the potential energy, following the recipe, the complete matrix of the inverse of inductances is:
$$ [l^{-1}] = \begin{pmatrix} 1/L_1 + 1/L_2 & -1/L_1 & -1/L_2\\ -1/L_1 & 1/L_1 + 1/L_3 & -1/L_3\\ -1/L_2 & -1/L_3 & 1/L_2 + 1/L_3 \end{pmatrix} $$
Now, being again 1 the ground node, I choose to remove column 1 and row 1 to get:
$$ [L^{-1}] = \begin{pmatrix} 1/L_1 + 1/L_3 & -1/L_3\\ -1/L_3 & 1/L_2 + 1/L_3 \end{pmatrix} $$
We still have for the potential energy, the branch contribution (see eq. for potential energy).
This development I already showed here. But performing the matrix product together with the sum term, I get:
$$ \frac{\tilde{\Phi} \phi_a}{L_1} + \frac{\tilde{\Phi}\phi_a}{L_3} - \frac{3\phi_a^2}{2L_1} + \frac{3\phi_a^2}{2L_3} - \frac{\tilde{\Phi}\phi_b}{L_2} - \frac{\tilde{\Phi}\phi_b}{L_3} - \frac{3\phi_a\phi_b}{L_3} + \frac{3\phi_b^2}{2L_2} + \frac{3\phi_b^2}{2L_3} $$ which is not even close to the expression in paper.

