This is your equation:
In [24]: from sympy import *
In [25]: x = symbols('x')
In [26]: a, b, c, d, e, u, t, s = symbols('a, b, c, d, e, u, t, s')
In [27]: A = a/(1 + u + x)**1
In [28]: B = b/(1 + u + x)**2
In [29]: C = c/(1 + u + x)**3
In [30]: D = d/(1 + u + x)**4
In [31]: E = (e + t/x)/(1 + u + x)**5
In [32]: eq = s - (A+B+C+D+E)
In [33]: eq
Out[33]:
t
e + ─
a b c d x
- ───────── - ──────────── - ──────────── - ──────────── + s - ────────────
u + x + 1 2 3 4 5
(u + x + 1) (u + x + 1) (u + x + 1) (u + x + 1)
If we could solve this symbolically then we could get a formula that you could use for a new column. There is no hope of solving this symbolically though as this will lead to a fully arbitrary symbolic polynomial equation of degree 6 and the Abel-Ruffini theorem prevents symbolic solutions to those in ordinary functions:
https://en.wikipedia.org/wiki/Abel%E2%80%93Ruffini_theorem
However given numerical values for all of the symbols you can easily compute the roots of the polynomial numerically. For this you will need to loop through all rows calling a numerical routine but we can try to do it more efficiently than just calling SymPy's symbolic solve
function for each row. Let's turn it into a polynomial equation:
In [49]: together(eq)
Out[49]:
4 3 2 5
- a⋅x⋅(u + x + 1) - b⋅x⋅(u + x + 1) - c⋅x⋅(u + x + 1) - d⋅x⋅(u + x + 1) - e⋅x + s⋅x⋅(u + x + 1) - t
───────────────────────────────────────────────────────────────────────────────────────────────────────
5
x⋅(u + x + 1)
In [50]: numer(together(eq))
Out[50]:
4 3 2 5
- a⋅x⋅(u + x + 1) - b⋅x⋅(u + x + 1) - c⋅x⋅(u + x + 1) - d⋅x⋅(u + x + 1) - e⋅x + s⋅x⋅(u + x + 1) - t
In [51]: numer(together(eq)).as_poly(x)
Out[51]:
Poly(s*x**6 + (-a + 5*s*u + 5*s)*x**5 + (-4*a*u - 4*a - b + 10*s*u**2 + 20*s*u + 10*s)*x**4 + (-6*a
*u**2 - 12*a*u - 6*a - 3*b*u - 3*b - c + 10*s*u**3 + 30*s*u**2 + 30*s*u + 10*s)*x**3 + (-4*a*u**3 -
12*a*u**2 - 12*a*u - 4*a - 3*b*u**2 - 6*b*u - 3*b - 2*c*u - 2*c - d + 5*s*u**4 + 20*s*u**3 + 30*s*
u**2 + 20*s*u + 5*s)*x**2 + (-a*u**4 - 4*a*u**3 - 6*a*u**2 - 4*a*u - a - b*u**3 - 3*b*u**2 - 3*b*u
- b - c*u**2 - 2*c*u - c - d*u - d - e + s*u**5 + 5*s*u**4 + 10*s*u**3 + 10*s*u**2 + 5*s*u + s)*x -
t, x, domain='ZZ[s,t,u,a,b,c,d,e]')
Now we can get the coefficients of the polynomial and use lambdify to evaluate them efficiently:
In [52]: numer(together(eq)).as_poly(x).all_coeffs()
Out[52]:
⎡ 2 2
⎣s, -a + 5⋅s⋅u + 5⋅s, -4⋅a⋅u - 4⋅a - b + 10⋅s⋅u + 20⋅s⋅u + 10⋅s, - 6⋅a⋅u - 12⋅a⋅u - 6⋅a - 3⋅b⋅u -
3 2 3 2 2
3⋅b - c + 10⋅s⋅u + 30⋅s⋅u + 30⋅s⋅u + 10⋅s, - 4⋅a⋅u - 12⋅a⋅u - 12⋅a⋅u - 4⋅a - 3⋅b⋅u - 6⋅b⋅u -
4 3 2 4 3 2
3⋅b - 2⋅c⋅u - 2⋅c - d + 5⋅s⋅u + 20⋅s⋅u + 30⋅s⋅u + 20⋅s⋅u + 5⋅s, - a⋅u - 4⋅a⋅u - 6⋅a⋅u - 4⋅a⋅u
3 2 2 5 4 3
- a - b⋅u - 3⋅b⋅u - 3⋅b⋅u - b - c⋅u - 2⋅c⋅u - c - d⋅u - d - e + s⋅u + 5⋅s⋅u + 10⋅s⋅u + 10⋅s⋅
2 ⎤
u + 5⋅s⋅u + s, -t⎦
In [53]: coeffs = numer(together(eq)).as_poly(x).all_coeffs()
In [54]: coeffs_lam = lambdify([a, b, c, d, e, s, t, u], coeffs)
In [56]: coeffs_lam(1, 2, 3, 4, 5, 6, 7, 8)
Out[56]: [6, 269, 4822, 43197, 193370, 345991, -7]
Now that you have numeric polynomial coefficients numpy's np.roots function is the fastest way to get the roots (more accurate but slower methods could alternatively be used):
In [57]: np.roots(coeffs_lam(1, 2, 3, 4, 5, 6, 7, 8))
Out[57]:
array([-9.69478098e+00+0.44599886j, -9.69478098e+00-0.44599886j,
-8.86569067e+00+0.88529552j, -8.86569067e+00-0.88529552j,
-7.71241026e+00+0.j , 2.02315114e-05+0.j ])
The question doesn't acknowledge the possibility of there being multiple solutions but for almost all values of the parameters there will be 6 solutions. Some might be non-real but the number of real solutions will always be even so if there are any real solutions there will be at least 2 of them. You will need to decide for yourself how to choose which is one that you want and write some code to select it.