\(\int \frac {(A+B \log (e (a+b x)^n (c+d x)^{-n}))^2}{(a+b x)^2} \, dx\) [160]

Optimal result
Mathematica [A] (verified)
Rubi [A] (warning: unable to verify)
Maple [B] (verified)
Fricas [B] (verification not implemented)
Sympy [F(-1)]
Maxima [B] (verification not implemented)
Giac [F]
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 33, antiderivative size = 129 \[ \int \frac {\left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{(a+b x)^2} \, dx=-\frac {2 B^2 n^2 (c+d x)}{(b c-a d) (a+b x)}-\frac {2 B n (c+d x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{(b c-a d) (a+b x)}-\frac {(c+d x) \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{(b c-a d) (a+b x)} \] Output:

-2*B^2*n^2*(d*x+c)/(-a*d+b*c)/(b*x+a)-2*B*n*(d*x+c)*(A+B*ln(e*(b*x+a)^n/(( 
d*x+c)^n)))/(-a*d+b*c)/(b*x+a)-(d*x+c)*(A+B*ln(e*(b*x+a)^n/((d*x+c)^n)))^2 
/(-a*d+b*c)/(b*x+a)
 

Mathematica [A] (verified)

Time = 0.46 (sec) , antiderivative size = 236, normalized size of antiderivative = 1.83 \[ \int \frac {\left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{(a+b x)^2} \, dx=\frac {B^2 d n^2 (a+b x) \log ^2(a+b x)+B^2 d n^2 (a+b x) \log ^2(c+d x)+2 B d n (a+b x) \log (c+d x) \left (A+B n+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )-2 B d n (a+b x) \log (a+b x) \left (A+B n+B n \log (c+d x)+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )-(b c-a d) \left (A^2+2 A B n+2 B^2 n^2+2 B (A+B n) \log \left (e (a+b x)^n (c+d x)^{-n}\right )+B^2 \log ^2\left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{b (b c-a d) (a+b x)} \] Input:

Integrate[(A + B*Log[(e*(a + b*x)^n)/(c + d*x)^n])^2/(a + b*x)^2,x]
 

Output:

(B^2*d*n^2*(a + b*x)*Log[a + b*x]^2 + B^2*d*n^2*(a + b*x)*Log[c + d*x]^2 + 
 2*B*d*n*(a + b*x)*Log[c + d*x]*(A + B*n + B*Log[(e*(a + b*x)^n)/(c + d*x) 
^n]) - 2*B*d*n*(a + b*x)*Log[a + b*x]*(A + B*n + B*n*Log[c + d*x] + B*Log[ 
(e*(a + b*x)^n)/(c + d*x)^n]) - (b*c - a*d)*(A^2 + 2*A*B*n + 2*B^2*n^2 + 2 
*B*(A + B*n)*Log[(e*(a + b*x)^n)/(c + d*x)^n] + B^2*Log[(e*(a + b*x)^n)/(c 
 + d*x)^n]^2))/(b*(b*c - a*d)*(a + b*x))
 

Rubi [A] (warning: unable to verify)

Time = 0.41 (sec) , antiderivative size = 107, normalized size of antiderivative = 0.83, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.121, Rules used = {2973, 2949, 2742, 2741}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )^2}{(a+b x)^2} \, dx\)

\(\Big \downarrow \) 2973

\(\displaystyle \int \frac {\left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )^2}{(a+b x)^2}dx\)

\(\Big \downarrow \) 2949

\(\displaystyle \frac {\int \frac {(c+d x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{(a+b x)^2}d\frac {a+b x}{c+d x}}{b c-a d}\)

\(\Big \downarrow \) 2742

\(\displaystyle \frac {2 B n \int \frac {(c+d x)^2 \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )}{(a+b x)^2}d\frac {a+b x}{c+d x}-\frac {(c+d x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{a+b x}}{b c-a d}\)

\(\Big \downarrow \) 2741

\(\displaystyle \frac {2 B n \left (-\frac {(c+d x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{a+b x}-\frac {B n (c+d x)}{a+b x}\right )-\frac {(c+d x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{a+b x}}{b c-a d}\)

Input:

Int[(A + B*Log[(e*(a + b*x)^n)/(c + d*x)^n])^2/(a + b*x)^2,x]
 

Output:

(-(((c + d*x)*(A + B*Log[e*((a + b*x)/(c + d*x))^n])^2)/(a + b*x)) + 2*B*n 
*(-((B*n*(c + d*x))/(a + b*x)) - ((c + d*x)*(A + B*Log[e*((a + b*x)/(c + d 
*x))^n]))/(a + b*x)))/(b*c - a*d)
 

Defintions of rubi rules used

rule 2741
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_.)*(x_))^(m_.), x_Symbol] :> 
Simp[(d*x)^(m + 1)*((a + b*Log[c*x^n])/(d*(m + 1))), x] - Simp[b*n*((d*x)^( 
m + 1)/(d*(m + 1)^2)), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[m, -1]
 

rule 2742
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_.)*(x_))^(m_.), x_Symbo 
l] :> Simp[(d*x)^(m + 1)*((a + b*Log[c*x^n])^p/(d*(m + 1))), x] - Simp[b*n* 
(p/(m + 1))   Int[(d*x)^m*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{a, b 
, c, d, m, n}, x] && NeQ[m, -1] && GtQ[p, 0]
 

rule 2949
Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*( 
B_.))^(p_.)*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(b*c - a*d)^(m + 
1)*(g/b)^m   Subst[Int[x^m*((A + B*Log[e*x^n])^p/(b - d*x)^(m + 2)), x], x, 
 (a + b*x)/(c + d*x)], x] /; FreeQ[{a, b, c, d, e, f, g, A, B, n}, x] && Ne 
Q[b*c - a*d, 0] && IntegersQ[m, p] && EqQ[b*f - a*g, 0] && (GtQ[p, 0] || Lt 
Q[m, -1])
 

rule 2973
Int[((A_.) + Log[(e_.)*(u_)^(n_.)*(v_)^(mn_)]*(B_.))^(p_.)*(w_.), x_Symbol] 
 :> Subst[Int[w*(A + B*Log[e*(u/v)^n])^p, x], e*(u/v)^n, e*(u^n/v^n)] /; Fr 
eeQ[{e, A, B, n, p}, x] && EqQ[n + mn, 0] && LinearQ[{u, v}, x] &&  !Intege 
rQ[n]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(298\) vs. \(2(129)=258\).

Time = 4.92 (sec) , antiderivative size = 299, normalized size of antiderivative = 2.32

method result size
parallelrisch \(-\frac {2 B^{2} a \,b^{2} d^{2} n^{3}-2 B^{2} b^{3} c d \,n^{3}+A^{2} a \,b^{2} d^{2} n -A^{2} b^{3} c d n +2 A B a \,b^{2} d^{2} n^{2}-2 A B \,b^{3} c d \,n^{2}-2 A B x \ln \left (e \left (b x +a \right )^{n} \left (d x +c \right )^{-n}\right ) b^{3} d^{2} n -2 A B \ln \left (e \left (b x +a \right )^{n} \left (d x +c \right )^{-n}\right ) b^{3} c d n -B^{2} x \ln \left (e \left (b x +a \right )^{n} \left (d x +c \right )^{-n}\right )^{2} b^{3} d^{2} n -2 B^{2} x \ln \left (e \left (b x +a \right )^{n} \left (d x +c \right )^{-n}\right ) b^{3} d^{2} n^{2}-B^{2} \ln \left (e \left (b x +a \right )^{n} \left (d x +c \right )^{-n}\right )^{2} b^{3} c d n -2 B^{2} \ln \left (e \left (b x +a \right )^{n} \left (d x +c \right )^{-n}\right ) b^{3} c d \,n^{2}}{\left (b x +a \right ) b^{3} d n \left (d a -b c \right )}\) \(299\)
risch \(\text {Expression too large to display}\) \(10099\)

Input:

int((A+B*ln(e*(b*x+a)^n/((d*x+c)^n)))^2/(b*x+a)^2,x,method=_RETURNVERBOSE)
 

Output:

-(2*B^2*a*b^2*d^2*n^3-2*B^2*b^3*c*d*n^3+A^2*a*b^2*d^2*n-A^2*b^3*c*d*n+2*A* 
B*a*b^2*d^2*n^2-2*A*B*b^3*c*d*n^2-2*A*B*x*ln(e*(b*x+a)^n/((d*x+c)^n))*b^3* 
d^2*n-2*A*B*ln(e*(b*x+a)^n/((d*x+c)^n))*b^3*c*d*n-B^2*x*ln(e*(b*x+a)^n/((d 
*x+c)^n))^2*b^3*d^2*n-2*B^2*x*ln(e*(b*x+a)^n/((d*x+c)^n))*b^3*d^2*n^2-B^2* 
ln(e*(b*x+a)^n/((d*x+c)^n))^2*b^3*c*d*n-2*B^2*ln(e*(b*x+a)^n/((d*x+c)^n))* 
b^3*c*d*n^2)/(b*x+a)/b^3/d/n/(a*d-b*c)
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 339 vs. \(2 (129) = 258\).

Time = 0.09 (sec) , antiderivative size = 339, normalized size of antiderivative = 2.63 \[ \int \frac {\left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{(a+b x)^2} \, dx=-\frac {A^{2} b c - A^{2} a d + 2 \, {\left (B^{2} b c - B^{2} a d\right )} n^{2} + {\left (B^{2} b d n^{2} x + B^{2} b c n^{2}\right )} \log \left (b x + a\right )^{2} + {\left (B^{2} b d n^{2} x + B^{2} b c n^{2}\right )} \log \left (d x + c\right )^{2} + {\left (B^{2} b c - B^{2} a d\right )} \log \left (e\right )^{2} + 2 \, {\left (A B b c - A B a d\right )} n + 2 \, {\left (B^{2} b c n^{2} + A B b c n + {\left (B^{2} b d n^{2} + A B b d n\right )} x + {\left (B^{2} b d n x + B^{2} b c n\right )} \log \left (e\right )\right )} \log \left (b x + a\right ) - 2 \, {\left (B^{2} b c n^{2} + A B b c n + {\left (B^{2} b d n^{2} + A B b d n\right )} x + {\left (B^{2} b d n^{2} x + B^{2} b c n^{2}\right )} \log \left (b x + a\right ) + {\left (B^{2} b d n x + B^{2} b c n\right )} \log \left (e\right )\right )} \log \left (d x + c\right ) + 2 \, {\left (A B b c - A B a d + {\left (B^{2} b c - B^{2} a d\right )} n\right )} \log \left (e\right )}{a b^{2} c - a^{2} b d + {\left (b^{3} c - a b^{2} d\right )} x} \] Input:

integrate((A+B*log(e*(b*x+a)^n/((d*x+c)^n)))^2/(b*x+a)^2,x, algorithm="fri 
cas")
 

Output:

-(A^2*b*c - A^2*a*d + 2*(B^2*b*c - B^2*a*d)*n^2 + (B^2*b*d*n^2*x + B^2*b*c 
*n^2)*log(b*x + a)^2 + (B^2*b*d*n^2*x + B^2*b*c*n^2)*log(d*x + c)^2 + (B^2 
*b*c - B^2*a*d)*log(e)^2 + 2*(A*B*b*c - A*B*a*d)*n + 2*(B^2*b*c*n^2 + A*B* 
b*c*n + (B^2*b*d*n^2 + A*B*b*d*n)*x + (B^2*b*d*n*x + B^2*b*c*n)*log(e))*lo 
g(b*x + a) - 2*(B^2*b*c*n^2 + A*B*b*c*n + (B^2*b*d*n^2 + A*B*b*d*n)*x + (B 
^2*b*d*n^2*x + B^2*b*c*n^2)*log(b*x + a) + (B^2*b*d*n*x + B^2*b*c*n)*log(e 
))*log(d*x + c) + 2*(A*B*b*c - A*B*a*d + (B^2*b*c - B^2*a*d)*n)*log(e))/(a 
*b^2*c - a^2*b*d + (b^3*c - a*b^2*d)*x)
 

Sympy [F(-1)]

Timed out. \[ \int \frac {\left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{(a+b x)^2} \, dx=\text {Timed out} \] Input:

integrate((A+B*ln(e*(b*x+a)**n/((d*x+c)**n)))**2/(b*x+a)**2,x)
 

Output:

Timed out
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 449 vs. \(2 (129) = 258\).

Time = 0.06 (sec) , antiderivative size = 449, normalized size of antiderivative = 3.48 \[ \int \frac {\left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{(a+b x)^2} \, dx=-B^{2} {\left (\frac {2 \, {\left (\frac {d e n \log \left (b x + a\right )}{b^{2} c - a b d} - \frac {d e n \log \left (d x + c\right )}{b^{2} c - a b d} + \frac {e n}{b^{2} x + a b}\right )} \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right )}{e} + \frac {2 \, b c e^{2} n^{2} - 2 \, a d e^{2} n^{2} - {\left (b d e^{2} n^{2} x + a d e^{2} n^{2}\right )} \log \left (b x + a\right )^{2} - {\left (b d e^{2} n^{2} x + a d e^{2} n^{2}\right )} \log \left (d x + c\right )^{2} + 2 \, {\left (b d e^{2} n^{2} x + a d e^{2} n^{2}\right )} \log \left (b x + a\right ) - 2 \, {\left (b d e^{2} n^{2} x + a d e^{2} n^{2} - {\left (b d e^{2} n^{2} x + a d e^{2} n^{2}\right )} \log \left (b x + a\right )\right )} \log \left (d x + c\right )}{{\left (a b^{2} c - a^{2} b d + {\left (b^{3} c - a b^{2} d\right )} x\right )} e^{2}}\right )} - \frac {B^{2} \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right )^{2}}{b^{2} x + a b} - \frac {2 \, {\left (\frac {d e n \log \left (b x + a\right )}{b^{2} c - a b d} - \frac {d e n \log \left (d x + c\right )}{b^{2} c - a b d} + \frac {e n}{b^{2} x + a b}\right )} A B}{e} - \frac {2 \, A B \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right )}{b^{2} x + a b} - \frac {A^{2}}{b^{2} x + a b} \] Input:

integrate((A+B*log(e*(b*x+a)^n/((d*x+c)^n)))^2/(b*x+a)^2,x, algorithm="max 
ima")
 

Output:

-B^2*(2*(d*e*n*log(b*x + a)/(b^2*c - a*b*d) - d*e*n*log(d*x + c)/(b^2*c - 
a*b*d) + e*n/(b^2*x + a*b))*log((b*x + a)^n*e/(d*x + c)^n)/e + (2*b*c*e^2* 
n^2 - 2*a*d*e^2*n^2 - (b*d*e^2*n^2*x + a*d*e^2*n^2)*log(b*x + a)^2 - (b*d* 
e^2*n^2*x + a*d*e^2*n^2)*log(d*x + c)^2 + 2*(b*d*e^2*n^2*x + a*d*e^2*n^2)* 
log(b*x + a) - 2*(b*d*e^2*n^2*x + a*d*e^2*n^2 - (b*d*e^2*n^2*x + a*d*e^2*n 
^2)*log(b*x + a))*log(d*x + c))/((a*b^2*c - a^2*b*d + (b^3*c - a*b^2*d)*x) 
*e^2)) - B^2*log((b*x + a)^n*e/(d*x + c)^n)^2/(b^2*x + a*b) - 2*(d*e*n*log 
(b*x + a)/(b^2*c - a*b*d) - d*e*n*log(d*x + c)/(b^2*c - a*b*d) + e*n/(b^2* 
x + a*b))*A*B/e - 2*A*B*log((b*x + a)^n*e/(d*x + c)^n)/(b^2*x + a*b) - A^2 
/(b^2*x + a*b)
 

Giac [F]

\[ \int \frac {\left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{(a+b x)^2} \, dx=\int { \frac {{\left (B \log \left (\frac {{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A\right )}^{2}}{{\left (b x + a\right )}^{2}} \,d x } \] Input:

integrate((A+B*log(e*(b*x+a)^n/((d*x+c)^n)))^2/(b*x+a)^2,x, algorithm="gia 
c")
 

Output:

integrate((B*log((b*x + a)^n*e/(d*x + c)^n) + A)^2/(b*x + a)^2, x)
 

Mupad [B] (verification not implemented)

Time = 26.64 (sec) , antiderivative size = 200, normalized size of antiderivative = 1.55 \[ \int \frac {\left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{(a+b x)^2} \, dx=-\ln \left (\frac {e\,{\left (a+b\,x\right )}^n}{{\left (c+d\,x\right )}^n}\right )\,\left (\frac {2\,A\,B}{x\,b^2+a\,b}+\frac {2\,B^2\,n}{x\,b^2+a\,b}\right )-{\ln \left (\frac {e\,{\left (a+b\,x\right )}^n}{{\left (c+d\,x\right )}^n}\right )}^2\,\left (\frac {B^2}{b\,\left (a+b\,x\right )}-\frac {B^2\,d}{b\,\left (a\,d-b\,c\right )}\right )-\frac {A^2+2\,A\,B\,n+2\,B^2\,n^2}{x\,b^2+a\,b}-\frac {B\,d\,n\,\mathrm {atan}\left (\frac {\left (\frac {c\,b^2+a\,d\,b}{b}+2\,b\,d\,x\right )\,1{}\mathrm {i}}{a\,d-b\,c}\right )\,\left (A+B\,n\right )\,4{}\mathrm {i}}{b\,\left (a\,d-b\,c\right )} \] Input:

int((A + B*log((e*(a + b*x)^n)/(c + d*x)^n))^2/(a + b*x)^2,x)
 

Output:

- log((e*(a + b*x)^n)/(c + d*x)^n)*((2*A*B)/(a*b + b^2*x) + (2*B^2*n)/(a*b 
 + b^2*x)) - log((e*(a + b*x)^n)/(c + d*x)^n)^2*(B^2/(b*(a + b*x)) - (B^2* 
d)/(b*(a*d - b*c))) - (A^2 + 2*B^2*n^2 + 2*A*B*n)/(a*b + b^2*x) - (B*d*n*a 
tan((((b^2*c + a*b*d)/b + 2*b*d*x)*1i)/(a*d - b*c))*(A + B*n)*4i)/(b*(a*d 
- b*c))
 

Reduce [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 369, normalized size of antiderivative = 2.86 \[ \int \frac {\left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )^2}{(a+b x)^2} \, dx=\frac {2 \,\mathrm {log}\left (b x +a \right ) a^{2} b c n +2 \,\mathrm {log}\left (b x +a \right ) a \,b^{2} c \,n^{2}+2 \,\mathrm {log}\left (b x +a \right ) a \,b^{2} c n x +2 \,\mathrm {log}\left (b x +a \right ) b^{3} c \,n^{2} x -2 \,\mathrm {log}\left (d x +c \right ) a^{2} b c n -2 \,\mathrm {log}\left (d x +c \right ) a \,b^{2} c \,n^{2}-2 \,\mathrm {log}\left (d x +c \right ) a \,b^{2} c n x -2 \,\mathrm {log}\left (d x +c \right ) b^{3} c \,n^{2} x +\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right )^{2} a \,b^{2} c +\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right )^{2} a \,b^{2} d x +2 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) a^{2} b d x -2 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) a \,b^{2} c x +2 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) a \,b^{2} d n x -2 \,\mathrm {log}\left (\frac {\left (b x +a \right )^{n} e}{\left (d x +c \right )^{n}}\right ) b^{3} c n x +a^{3} d x -a^{2} b c x +2 a^{2} b d n x -2 a \,b^{2} c n x +2 a \,b^{2} d \,n^{2} x -2 b^{3} c \,n^{2} x}{a \left (a b d x -b^{2} c x +a^{2} d -a b c \right )} \] Input:

int((A+B*log(e*(b*x+a)^n/((d*x+c)^n)))^2/(b*x+a)^2,x)
 

Output:

(2*log(a + b*x)*a**2*b*c*n + 2*log(a + b*x)*a*b**2*c*n**2 + 2*log(a + b*x) 
*a*b**2*c*n*x + 2*log(a + b*x)*b**3*c*n**2*x - 2*log(c + d*x)*a**2*b*c*n - 
 2*log(c + d*x)*a*b**2*c*n**2 - 2*log(c + d*x)*a*b**2*c*n*x - 2*log(c + d* 
x)*b**3*c*n**2*x + log(((a + b*x)**n*e)/(c + d*x)**n)**2*a*b**2*c + log((( 
a + b*x)**n*e)/(c + d*x)**n)**2*a*b**2*d*x + 2*log(((a + b*x)**n*e)/(c + d 
*x)**n)*a**2*b*d*x - 2*log(((a + b*x)**n*e)/(c + d*x)**n)*a*b**2*c*x + 2*l 
og(((a + b*x)**n*e)/(c + d*x)**n)*a*b**2*d*n*x - 2*log(((a + b*x)**n*e)/(c 
 + d*x)**n)*b**3*c*n*x + a**3*d*x - a**2*b*c*x + 2*a**2*b*d*n*x - 2*a*b**2 
*c*n*x + 2*a*b**2*d*n**2*x - 2*b**3*c*n**2*x)/(a*(a**2*d - a*b*c + a*b*d*x 
 - b**2*c*x))