Integrand size = 27, antiderivative size = 87 \[ \int \frac {A+B \log \left (\frac {e (a+b x)}{c+d x}\right )}{(f+g x)^2} \, dx=\frac {(a+b x) \left (A+B \log \left (\frac {e (a+b x)}{c+d x}\right )\right )}{(b f-a g) (f+g x)}+\frac {B (b c-a d) \log \left (\frac {f+g x}{c+d x}\right )}{(b f-a g) (d f-c g)} \] Output:
(b*x+a)*(A+B*ln(e*(b*x+a)/(d*x+c)))/(-a*g+b*f)/(g*x+f)+B*(-a*d+b*c)*ln((g* x+f)/(d*x+c))/(-a*g+b*f)/(-c*g+d*f)
Time = 0.14 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.21 \[ \int \frac {A+B \log \left (\frac {e (a+b x)}{c+d x}\right )}{(f+g x)^2} \, dx=\frac {-\frac {A+B \log \left (\frac {e (a+b x)}{c+d x}\right )}{f+g x}+\frac {B (b (d f-c g) \log (a+b x)+(-b d f+a d g) \log (c+d x)+(b c-a d) g \log (f+g x))}{(b f-a g) (d f-c g)}}{g} \] Input:
Integrate[(A + B*Log[(e*(a + b*x))/(c + d*x)])/(f + g*x)^2,x]
Output:
(-((A + B*Log[(e*(a + b*x))/(c + d*x)])/(f + g*x)) + (B*(b*(d*f - c*g)*Log [a + b*x] + (-(b*d*f) + a*d*g)*Log[c + d*x] + (b*c - a*d)*g*Log[f + g*x])) /((b*f - a*g)*(d*f - c*g)))/g
Time = 0.30 (sec) , antiderivative size = 137, normalized size of antiderivative = 1.57, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.111, Rules used = {2954, 2751, 16}
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 {B \log \left (\frac {e (a+b x)}{c+d x}\right )+A}{(f+g x)^2} \, dx\) |
\(\Big \downarrow \) 2954 |
\(\displaystyle (b c-a d) \int \frac {A+B \log \left (\frac {e (a+b x)}{c+d x}\right )}{\left (b f-a g-\frac {(d f-c g) (a+b x)}{c+d x}\right )^2}d\frac {a+b x}{c+d x}\) |
\(\Big \downarrow \) 2751 |
\(\displaystyle (b c-a d) \left (\frac {(a+b x) \left (B \log \left (\frac {e (a+b x)}{c+d x}\right )+A\right )}{(c+d x) (b f-a g) \left (-\frac {(a+b x) (d f-c g)}{c+d x}-a g+b f\right )}-\frac {B \int \frac {1}{b f-a g-\frac {(d f-c g) (a+b x)}{c+d x}}d\frac {a+b x}{c+d x}}{b f-a g}\right )\) |
\(\Big \downarrow \) 16 |
\(\displaystyle (b c-a d) \left (\frac {(a+b x) \left (B \log \left (\frac {e (a+b x)}{c+d x}\right )+A\right )}{(c+d x) (b f-a g) \left (-\frac {(a+b x) (d f-c g)}{c+d x}-a g+b f\right )}+\frac {B \log \left (-\frac {(a+b x) (d f-c g)}{c+d x}-a g+b f\right )}{(b f-a g) (d f-c g)}\right )\) |
Input:
Int[(A + B*Log[(e*(a + b*x))/(c + d*x)])/(f + g*x)^2,x]
Output:
(b*c - a*d)*(((a + b*x)*(A + B*Log[(e*(a + b*x))/(c + d*x)]))/((b*f - a*g) *(c + d*x)*(b*f - a*g - ((d*f - c*g)*(a + b*x))/(c + d*x))) + (B*Log[b*f - a*g - ((d*f - c*g)*(a + b*x))/(c + d*x)])/((b*f - a*g)*(d*f - c*g)))
Int[(c_.)/((a_.) + (b_.)*(x_)), x_Symbol] :> Simp[c*(Log[RemoveContent[a + b*x, x]]/b), x] /; FreeQ[{a, b, c}, x]
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_) + (e_.)*(x_)^(r_.))^(q_), x _Symbol] :> Simp[x*(d + e*x^r)^(q + 1)*((a + b*Log[c*x^n])/d), x] - Simp[b* (n/d) Int[(d + e*x^r)^(q + 1), x], x] /; FreeQ[{a, b, c, d, e, n, q, r}, x] && EqQ[r*(q + 1) + 1, 0]
Int[((A_.) + Log[(e_.)*((a_.) + (b_.)*(x_))^(n_.)*((c_.) + (d_.)*(x_))^(mn_ )]*(B_.))^(p_.)*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(b*c - a*d) Subst[Int[(b*f - a*g - (d*f - c*g)*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] && EqQ[n + mn, 0] && IGtQ[n, 0] && NeQ[b*c - a*d, 0] && IntegerQ[m ] && IGtQ[p, 0]
Leaf count of result is larger than twice the leaf count of optimal. \(241\) vs. \(2(87)=174\).
Time = 1.28 (sec) , antiderivative size = 242, normalized size of antiderivative = 2.78
method | result | size |
parts | \(-\frac {A}{\left (g x +f \right ) g}-B \left (d a -b c \right ) e \left (\frac {\ln \left (\left (c g -d f \right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )-a e g +b e f \right )}{e \left (a g -b f \right ) \left (c g -d f \right )}-\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )}{e \left (a g -b f \right ) \left (c g \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )-d f \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )-a e g +b e f \right )}\right )\) | \(242\) |
risch | \(-\frac {B \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right )}{g \left (g x +f \right )}-\frac {B \ln \left (-b x -a \right ) b c \,g^{2} x -B \ln \left (-b x -a \right ) b d f g x +B \ln \left (g x +f \right ) a d \,g^{2} x -B \ln \left (g x +f \right ) b c \,g^{2} x -B \ln \left (-d x -c \right ) a d \,g^{2} x +B \ln \left (-d x -c \right ) b d f g x +B \ln \left (-b x -a \right ) b c f g -B \ln \left (-b x -a \right ) b d \,f^{2}+B \ln \left (g x +f \right ) a d f g -B \ln \left (g x +f \right ) b c f g -B \ln \left (-d x -c \right ) a d f g +B \ln \left (-d x -c \right ) b d \,f^{2}+A a c \,g^{2}-A a d f g -A b c f g +A b d \,f^{2}}{\left (c g -d f \right ) \left (a g -b f \right ) \left (g x +f \right ) g}\) | \(277\) |
derivativedivides | \(-\frac {e \left (d a -b c \right ) \left (-\frac {d^{2} A}{\left (\left (-c g +d f \right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )+a e g -b e f \right ) \left (-c g +d f \right )}+d^{2} B \left (-\frac {\ln \left (\left (-c g +d f \right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )+a e g -b e f \right )}{e \left (a g -b f \right ) \left (-c g +d f \right )}+\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )}{e \left (a g -b f \right ) \left (a e g -b e f -c g \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )+d f \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )\right )}\right )\right )}{d^{2}}\) | \(300\) |
default | \(-\frac {e \left (d a -b c \right ) \left (-\frac {d^{2} A}{\left (\left (-c g +d f \right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )+a e g -b e f \right ) \left (-c g +d f \right )}+d^{2} B \left (-\frac {\ln \left (\left (-c g +d f \right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )+a e g -b e f \right )}{e \left (a g -b f \right ) \left (-c g +d f \right )}+\frac {\ln \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right ) \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )}{e \left (a g -b f \right ) \left (a e g -b e f -c g \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )+d f \left (\frac {b e}{d}+\frac {\left (d a -b c \right ) e}{d \left (d x +c \right )}\right )\right )}\right )\right )}{d^{2}}\) | \(300\) |
parallelrisch | \(\frac {A x \,a^{2} c^{2} g^{2}-B x \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right ) a^{2} c d f g +B x \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right ) a b c d \,f^{2}+B \ln \left (b x +a \right ) x \,a^{2} c d f g -B \ln \left (b x +a \right ) x a b \,c^{2} f g -B \ln \left (g x +f \right ) x \,a^{2} c d f g +B \ln \left (g x +f \right ) x a b \,c^{2} f g -A x \,a^{2} c d f g +B \ln \left (b x +a \right ) a^{2} c d \,f^{2}-B \ln \left (b x +a \right ) a b \,c^{2} f^{2}-B \ln \left (g x +f \right ) a^{2} c d \,f^{2}+B \ln \left (g x +f \right ) a b \,c^{2} f^{2}-B \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right ) a^{2} c^{2} f g +B \ln \left (\frac {e \left (b x +a \right )}{d x +c}\right ) a b \,c^{2} f^{2}-A x a b \,c^{2} f g +A x a b c d \,f^{2}}{\left (a c \,g^{2}-a d f g -b c f g +d \,f^{2} b \right ) \left (g x +f \right ) a c f}\) | \(324\) |
Input:
int((A+B*ln(e*(b*x+a)/(d*x+c)))/(g*x+f)^2,x,method=_RETURNVERBOSE)
Output:
-A/(g*x+f)/g-B*(a*d-b*c)*e*(1/e/(a*g-b*f)*ln((c*g-d*f)*(b*e/d+(a*d-b*c)*e/ d/(d*x+c))-a*e*g+b*e*f)/(c*g-d*f)-ln(b*e/d+(a*d-b*c)*e/d/(d*x+c))*(b*e/d+( a*d-b*c)*e/d/(d*x+c))/e/(a*g-b*f)/(c*g*(b*e/d+(a*d-b*c)*e/d/(d*x+c))-d*f*( b*e/d+(a*d-b*c)*e/d/(d*x+c))-a*e*g+b*e*f))
Leaf count of result is larger than twice the leaf count of optimal. 255 vs. \(2 (87) = 174\).
Time = 3.06 (sec) , antiderivative size = 255, normalized size of antiderivative = 2.93 \[ \int \frac {A+B \log \left (\frac {e (a+b x)}{c+d x}\right )}{(f+g x)^2} \, dx=-\frac {A b d f^{2} + A a c g^{2} - {\left (A b c + A a d\right )} f g - {\left (B b d f^{2} - B b c f g + {\left (B b d f g - B b c g^{2}\right )} x\right )} \log \left (b x + a\right ) + {\left (B b d f^{2} - B a d f g + {\left (B b d f g - B a d g^{2}\right )} x\right )} \log \left (d x + c\right ) - {\left ({\left (B b c - B a d\right )} g^{2} x + {\left (B b c - B a d\right )} f g\right )} \log \left (g x + f\right ) + {\left (B b d f^{2} + B a c g^{2} - {\left (B b c + B a d\right )} f g\right )} \log \left (\frac {b e x + a e}{d x + c}\right )}{b d f^{3} g + a c f g^{3} - {\left (b c + a d\right )} f^{2} g^{2} + {\left (b d f^{2} g^{2} + a c g^{4} - {\left (b c + a d\right )} f g^{3}\right )} x} \] Input:
integrate((A+B*log(e*(b*x+a)/(d*x+c)))/(g*x+f)^2,x, algorithm="fricas")
Output:
-(A*b*d*f^2 + A*a*c*g^2 - (A*b*c + A*a*d)*f*g - (B*b*d*f^2 - B*b*c*f*g + ( B*b*d*f*g - B*b*c*g^2)*x)*log(b*x + a) + (B*b*d*f^2 - B*a*d*f*g + (B*b*d*f *g - B*a*d*g^2)*x)*log(d*x + c) - ((B*b*c - B*a*d)*g^2*x + (B*b*c - B*a*d) *f*g)*log(g*x + f) + (B*b*d*f^2 + B*a*c*g^2 - (B*b*c + B*a*d)*f*g)*log((b* e*x + a*e)/(d*x + c)))/(b*d*f^3*g + a*c*f*g^3 - (b*c + a*d)*f^2*g^2 + (b*d *f^2*g^2 + a*c*g^4 - (b*c + a*d)*f*g^3)*x)
Timed out. \[ \int \frac {A+B \log \left (\frac {e (a+b x)}{c+d x}\right )}{(f+g x)^2} \, dx=\text {Timed out} \] Input:
integrate((A+B*ln(e*(b*x+a)/(d*x+c)))/(g*x+f)**2,x)
Output:
Timed out
Time = 0.04 (sec) , antiderivative size = 138, normalized size of antiderivative = 1.59 \[ \int \frac {A+B \log \left (\frac {e (a+b x)}{c+d x}\right )}{(f+g x)^2} \, dx=B {\left (\frac {b \log \left (b x + a\right )}{b f g - a g^{2}} - \frac {d \log \left (d x + c\right )}{d f g - c g^{2}} + \frac {{\left (b c - a d\right )} \log \left (g x + f\right )}{b d f^{2} + a c g^{2} - {\left (b c + a d\right )} f g} - \frac {\log \left (\frac {b e x}{d x + c} + \frac {a e}{d x + c}\right )}{g^{2} x + f g}\right )} - \frac {A}{g^{2} x + f g} \] Input:
integrate((A+B*log(e*(b*x+a)/(d*x+c)))/(g*x+f)^2,x, algorithm="maxima")
Output:
B*(b*log(b*x + a)/(b*f*g - a*g^2) - d*log(d*x + c)/(d*f*g - c*g^2) + (b*c - a*d)*log(g*x + f)/(b*d*f^2 + a*c*g^2 - (b*c + a*d)*f*g) - log(b*e*x/(d*x + c) + a*e/(d*x + c))/(g^2*x + f*g)) - A/(g^2*x + f*g)
Leaf count of result is larger than twice the leaf count of optimal. 511 vs. \(2 (87) = 174\).
Time = 0.23 (sec) , antiderivative size = 511, normalized size of antiderivative = 5.87 \[ \int \frac {A+B \log \left (\frac {e (a+b x)}{c+d x}\right )}{(f+g x)^2} \, dx={\left (\frac {{\left (B b^{2} c^{2} e - 2 \, B a b c d e + B a^{2} d^{2} e\right )} \log \left (-b e f + a e g + \frac {{\left (b e x + a e\right )} d f}{d x + c} - \frac {{\left (b e x + a e\right )} c g}{d x + c}\right )}{b d f^{2} - b c f g - a d f g + a c g^{2}} + \frac {{\left (B b^{2} c^{2} e^{2} - 2 \, B a b c d e^{2} + B a^{2} d^{2} e^{2}\right )} \log \left (\frac {b e x + a e}{d x + c}\right )}{b d e f^{2} - b c e f g - a d e f g + a c e g^{2} - \frac {{\left (b e x + a e\right )} d^{2} f^{2}}{d x + c} + \frac {2 \, {\left (b e x + a e\right )} c d f g}{d x + c} - \frac {{\left (b e x + a e\right )} c^{2} g^{2}}{d x + c}} - \frac {{\left (B b^{2} c^{2} e - 2 \, B a b c d e + B a^{2} d^{2} e\right )} \log \left (\frac {b e x + a e}{d x + c}\right )}{b d f^{2} - b c f g - a d f g + a c g^{2}} + \frac {A b^{2} c^{2} e^{2} - 2 \, A a b c d e^{2} + A a^{2} d^{2} e^{2}}{b d e f^{2} - b c e f g - a d e f g + a c e g^{2} - \frac {{\left (b e x + a e\right )} d^{2} f^{2}}{d x + c} + \frac {2 \, {\left (b e x + a e\right )} c d f g}{d x + c} - \frac {{\left (b e x + a e\right )} c^{2} g^{2}}{d x + c}}\right )} {\left (\frac {b c}{{\left (b c e - a d e\right )} {\left (b c - a d\right )}} - \frac {a d}{{\left (b c e - a d e\right )} {\left (b c - a d\right )}}\right )} \] Input:
integrate((A+B*log(e*(b*x+a)/(d*x+c)))/(g*x+f)^2,x, algorithm="giac")
Output:
((B*b^2*c^2*e - 2*B*a*b*c*d*e + B*a^2*d^2*e)*log(-b*e*f + a*e*g + (b*e*x + a*e)*d*f/(d*x + c) - (b*e*x + a*e)*c*g/(d*x + c))/(b*d*f^2 - b*c*f*g - a* d*f*g + a*c*g^2) + (B*b^2*c^2*e^2 - 2*B*a*b*c*d*e^2 + B*a^2*d^2*e^2)*log(( b*e*x + a*e)/(d*x + c))/(b*d*e*f^2 - b*c*e*f*g - a*d*e*f*g + a*c*e*g^2 - ( b*e*x + a*e)*d^2*f^2/(d*x + c) + 2*(b*e*x + a*e)*c*d*f*g/(d*x + c) - (b*e* x + a*e)*c^2*g^2/(d*x + c)) - (B*b^2*c^2*e - 2*B*a*b*c*d*e + B*a^2*d^2*e)* log((b*e*x + a*e)/(d*x + c))/(b*d*f^2 - b*c*f*g - a*d*f*g + a*c*g^2) + (A* b^2*c^2*e^2 - 2*A*a*b*c*d*e^2 + A*a^2*d^2*e^2)/(b*d*e*f^2 - b*c*e*f*g - a* d*e*f*g + a*c*e*g^2 - (b*e*x + a*e)*d^2*f^2/(d*x + c) + 2*(b*e*x + a*e)*c* d*f*g/(d*x + c) - (b*e*x + a*e)*c^2*g^2/(d*x + c)))*(b*c/((b*c*e - a*d*e)* (b*c - a*d)) - a*d/((b*c*e - a*d*e)*(b*c - a*d)))
Time = 26.18 (sec) , antiderivative size = 166, normalized size of antiderivative = 1.91 \[ \int \frac {A+B \log \left (\frac {e (a+b x)}{c+d x}\right )}{(f+g x)^2} \, dx=\frac {B\,d\,\ln \left (c+d\,x\right )}{c\,g^2-d\,f\,g}-\frac {B\,\ln \left (\frac {a\,e+b\,e\,x}{c+d\,x}\right )}{x\,g^2+f\,g}-\frac {B\,b\,\ln \left (a+b\,x\right )}{a\,g^2-b\,f\,g}-\frac {A}{x\,g^2+f\,g}-\frac {B\,a\,d\,\ln \left (f+g\,x\right )}{a\,c\,g^2+b\,d\,f^2-a\,d\,f\,g-b\,c\,f\,g}+\frac {B\,b\,c\,\ln \left (f+g\,x\right )}{a\,c\,g^2+b\,d\,f^2-a\,d\,f\,g-b\,c\,f\,g} \] Input:
int((A + B*log((e*(a + b*x))/(c + d*x)))/(f + g*x)^2,x)
Output:
(B*d*log(c + d*x))/(c*g^2 - d*f*g) - (B*log((a*e + b*e*x)/(c + d*x)))/(f*g + g^2*x) - (B*b*log(a + b*x))/(a*g^2 - b*f*g) - A/(f*g + g^2*x) - (B*a*d* log(f + g*x))/(a*c*g^2 + b*d*f^2 - a*d*f*g - b*c*f*g) + (B*b*c*log(f + g*x ))/(a*c*g^2 + b*d*f^2 - a*d*f*g - b*c*f*g)
Time = 0.17 (sec) , antiderivative size = 372, normalized size of antiderivative = 4.28 \[ \int \frac {A+B \log \left (\frac {e (a+b x)}{c+d x}\right )}{(f+g x)^2} \, dx=\frac {-\mathrm {log}\left (b x +a \right ) a b c f g -\mathrm {log}\left (b x +a \right ) a b c \,g^{2} x +\mathrm {log}\left (b x +a \right ) a b d \,f^{2}+\mathrm {log}\left (b x +a \right ) a b d f g x +\mathrm {log}\left (d x +c \right ) a b c f g +\mathrm {log}\left (d x +c \right ) a b c \,g^{2} x -\mathrm {log}\left (d x +c \right ) b^{2} c \,f^{2}-\mathrm {log}\left (d x +c \right ) b^{2} c f g x -\mathrm {log}\left (g x +f \right ) a b d \,f^{2}-\mathrm {log}\left (g x +f \right ) a b d f g x +\mathrm {log}\left (g x +f \right ) b^{2} c \,f^{2}+\mathrm {log}\left (g x +f \right ) b^{2} c f g x +\mathrm {log}\left (\frac {b e x +a e}{d x +c}\right ) a b c \,g^{2} x -\mathrm {log}\left (\frac {b e x +a e}{d x +c}\right ) a b d f g x -\mathrm {log}\left (\frac {b e x +a e}{d x +c}\right ) b^{2} c f g x +\mathrm {log}\left (\frac {b e x +a e}{d x +c}\right ) b^{2} d \,f^{2} x +a^{2} c \,g^{2} x -a^{2} d f g x -a b c f g x +a b d \,f^{2} x}{f \left (a c \,g^{3} x -a d f \,g^{2} x -b c f \,g^{2} x +b d \,f^{2} g x +a c f \,g^{2}-a d \,f^{2} g -b c \,f^{2} g +b d \,f^{3}\right )} \] Input:
int((A+B*log(e*(b*x+a)/(d*x+c)))/(g*x+f)^2,x)
Output:
( - log(a + b*x)*a*b*c*f*g - log(a + b*x)*a*b*c*g**2*x + log(a + b*x)*a*b* d*f**2 + log(a + b*x)*a*b*d*f*g*x + log(c + d*x)*a*b*c*f*g + log(c + d*x)* a*b*c*g**2*x - log(c + d*x)*b**2*c*f**2 - log(c + d*x)*b**2*c*f*g*x - log( f + g*x)*a*b*d*f**2 - log(f + g*x)*a*b*d*f*g*x + log(f + g*x)*b**2*c*f**2 + log(f + g*x)*b**2*c*f*g*x + log((a*e + b*e*x)/(c + d*x))*a*b*c*g**2*x - log((a*e + b*e*x)/(c + d*x))*a*b*d*f*g*x - log((a*e + b*e*x)/(c + d*x))*b* *2*c*f*g*x + log((a*e + b*e*x)/(c + d*x))*b**2*d*f**2*x + a**2*c*g**2*x - a**2*d*f*g*x - a*b*c*f*g*x + a*b*d*f**2*x)/(f*(a*c*f*g**2 + a*c*g**3*x - a *d*f**2*g - a*d*f*g**2*x - b*c*f**2*g - b*c*f*g**2*x + b*d*f**3 + b*d*f**2 *g*x))