I don't know how to solve the following system and then extract the values v_1, v_2, v_3 and v_n for the calculations in the prints.
import cmath
import math
import numpy as np
r3 = math.sqrt(3)
pp = cmath.exp(-1j * math.pi * 2 / 3)
U = 400
U_ph = U / r3
U_a = U_ph
U_b = U_a * pp
U_c = U_b * pp
S_HP = 3e3 - cmath.sqrt((3e3 / 0.95) ** 2 - 3e3 ** 2) * 1j
S_PV = -3.6e3 + 0j
S_EV = 16 * 400 * r3 + 0j
Z = 0.3 + 0.1j
Z_HP = (U_ph**2 / S_HP).conjugate()
Z_PV = (U_ph**2 / S_PV).conjugate()
Z_EV = (U_ph**2 / S_EV).conjugate()
v_1 = ((U_a/Z) + (v_n/Z_HP)) / ((1/Z) + (1/Z_HP))
v_2 = ((U_b/Z) + (v_n/Z_PV)) / ((1/Z) + (1/Z_PV))
v_3 = ((U_c/Z) + (v_n/Z_EV)) / ((1/Z) + (1/Z_EV))
v_n = ((v_1/Z_HP) + (v_2/Z_PV) + (v_3/Z_EV)) / ((1/Z) + (1/Z_HP) + (1/Z_PV) + (1/Z_EV))
print(f"\n |v1-vn| = {np.abs(v_1 - v_n):.0f} V.")
print(f"\n |v2-vn| = {np.abs(v_2 - v_n):.0f} V.")
print(f"\n |v3-vn| = {np.abs(v_3 - v_n):.0f} V.")
I tried using sympy's symbols to solve the problem but I can't manage to extract the values of v_1, v_2, v_3 and v_n in the form of int or float values.
Use sympy.solve to solve a system of equations: