How to extract variable values from interrelated algebraic equations using programming? I need help with solving a set of equations that are interrelated.
The equations are:
$$
R(\omega_{s})+j X(\omega_{s})=R_{\mathrm{s}}+\frac{\left(R_{0}+\frac{1}{j \omega_{s} C_{0}}\right)\left(R_{m}+\frac{1}{j \omega_{s} C_{m}}+j \omega_{s} L_{m}\right)}{R_{0}+\frac{1}{j \omega_{s} C_{0}}+R_{m}+\frac{1}{j \omega_{s} C_{m}}+j \omega_{s} L_{m}}
$$
$$
R(\omega_{p}) + j X(\omega_{p})=R_{\mathrm{s}}+\frac{\left(R_{0}+\frac{1}{j \omega_{p} C_{0}}\right)\left(R_{m}+\frac{1}{j \omega_{p} C_{m}}+j \omega_{p} L_{m}\right)}{R_{0}+\frac{1}{j \omega_{p} C_{0}}+R_{m}+\frac{1}{j \omega_{p} C_{m}}+j \omega_{p} L_{m}}
$$
$$
\omega_{s}=\frac{1}{\sqrt{\mathrm{L}_{m}  \mathrm{C}_{m}}}
$$
$$
\left(\frac{\omega_{p}}{\omega_{s}}\right)^{2}=1+\frac{C_{m}}{C_{0}}
$$
Out of the above equations, values of $R(\omega_{s}),R(\omega_{p}), X(\omega_{s}), X(\omega_{p}), \omega_{s}$ and $\omega_{p} $ are known, and the values of $R_{m}, C_{m}, L_{m}, C_{0}, R_{s}, R_{0}$ are to be found out. Also $j = \sqrt{-1}$, the imaginary unit.
Can these algebraic equations be solved using a programming language (preferably python) without simplifying them any further?
 A: (The following assumes that all knowns and unknowns are real.)
The last two equations imply
$$C_0 = \frac{1}{L_m(w_p^2-w_s^2)} \qquad\qquad C_m = \frac{1}{L_m w_s^2}$$
Substituting these into the first two equations, defining
$$L:=L_m(w_p^2-w_s^2) 
\qquad v_s:=\frac{1}{w_s} 
\qquad v_p:=\frac{1}{w_p}$$
$$A_x:=R(w_x) \qquad B_x:=X(w_x) 
\qquad R'_s := R_s-A_s$$ and then equating real and imaginary parts gives this system:
$$\begin{align}
B_s (R_0+R_m) + L v_s(R_m + R_s' ) &= 0 \tag1 \\
B_s L v_s - (R_0 R_m + R_0 R_s'+R_m R_s')  &= 0 \tag2 \\
L^2 v_p^2 + (R_0 R_m + R_0 R_s'+R_m R_s')+ (R_0+R_m)(A_s-A_p) &= 0 \tag3 \\
B_p (R_0+R_m) - L v_p( R_0 - R_m) &= 0 \tag4
\end{align}$$
Then $(1)$, $(4)$, and $(2)+(3)$ gives a linear system in $R_0$, $R_m$, $R_s'$ with solution
$$
R_0 = \frac{(L v_p^2 + B_s v_s)(L v_p + B_p)}{2v_p (A_p - A_s) } \qquad 
R_m = \frac{(L v_p^2 + B_s v_s)(L v_p - B_p)}{2v_p (A_p - A_s) } \\[12pt]
R_s' = -\frac{(L v_p^2 + B_s v_s) (2 B_s v_p - B_p v_s + L v_p v_s)}{
   2v_p v_s (A_p - A_s) }\tag5$$
Substituting into $(2)$ gives an ugly quartic:
$$\begin{align}
0 &= B_p^2 B_s^2 v_s^3\\
&\quad+ 2 L B_s v_p v_s^2 \left(2 (A_p-A_s)^2 v_p + B_p^2 v_p + 2 B_s^2 v_p - B_p B_s v_s\right) \\
&\quad+ L^2 v_p^2 v_s \left(B_p^2 v_p^2 + 
   8 B_s^2 v_p^2 - 4 B_p B_s v_p v_s + B_s^2 v_s^2 \right) \\
&\quad+ 2 L^3 v_p^4 \left(2 B_s v_p^2 - B_p v_p v_s + B_s v_s^2\right) \\
&\quad+ L^4 v_p^6 v_s
\end{align} \tag6$$
In theory, a symbolic representation of the roots is available by a Quartic Formula, but numerical methods may be more appropriate. In any case, for each candidate value of $L$, one can back-substitute to get corresponding values of $R_0$, $R_m$, $R_s$, $L_m$, $C_0$, $C_m$.
