3.495 \(\int a^{-x} b^{-x} (a^x-b^x)^2 \, dx\)

Optimal. Leaf size=34 \[ \frac {a^x b^{-x}-a^{-x} b^x}{\log (a)-\log (b)}-2 x \]

________________________________________________________________________________________

Rubi [A]  time = 0.21, antiderivative size = 41, normalized size of antiderivative = 1.21, number of steps used = 9, number of rules used = 4, integrand size = 22, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {2287, 6742, 2194, 8} \[ -\frac {a^{-x} b^x}{\log (a)-\log (b)}+\frac {a^x b^{-x}}{\log (a)-\log (b)}-2 x \]

Antiderivative was successfully verified.

[In]

Int[(a^x - b^x)^2/(a^x*b^x),x]

[Out]

-2*x + a^x/(b^x*(Log[a] - Log[b])) - b^x/(a^x*(Log[a] - Log[b]))

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2194

Int[((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.), x_Symbol] :> Simp[(F^(c*(a + b*x)))^n/(b*c*n*Log[F]), x] /; Fre
eQ[{F, a, b, c, n}, x]

Rule 2287

Int[(u_.)*(F_)^(v_)*(G_)^(w_), x_Symbol] :> With[{z = v*Log[F] + w*Log[G]}, Int[u*NormalizeIntegrand[E^z, x],
x] /; BinomialQ[z, x] || (PolynomialQ[z, x] && LeQ[Exponent[z, x], 2])] /; FreeQ[{F, G}, x]

Rule 6742

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps

\begin {align*} \int a^{-x} b^{-x} \left (a^x-b^x\right )^2 \, dx &=\int \left (a^x-b^x\right )^2 e^{-x (\log (a)+\log (b))} \, dx\\ &=\int \left (a^{2 x} e^{-x (\log (a)+\log (b))}-2 a^x b^x e^{-x (\log (a)+\log (b))}+b^{2 x} e^{-x (\log (a)+\log (b))}\right ) \, dx\\ &=-\left (2 \int a^x b^x e^{-x (\log (a)+\log (b))} \, dx\right )+\int a^{2 x} e^{-x (\log (a)+\log (b))} \, dx+\int b^{2 x} e^{-x (\log (a)+\log (b))} \, dx\\ &=-(2 \int 1 \, dx)+\int e^{-x (\log (a)-\log (b))} \, dx+\int e^{x (\log (a)-\log (b))} \, dx\\ &=-2 x+\frac {a^x b^{-x}}{\log (a)-\log (b)}-\frac {a^{-x} b^x}{\log (a)-\log (b)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.06, size = 46, normalized size = 1.35 \[ \frac {e^{x (\log (a)-\log (b))}}{\log (a)-\log (b)}+\frac {e^{x (\log (b)-\log (a))}}{\log (b)-\log (a)}-2 x \]

Antiderivative was successfully verified.

[In]

Integrate[(a^x - b^x)^2/(a^x*b^x),x]

[Out]

-2*x + E^(x*(Log[a] - Log[b]))/(Log[a] - Log[b]) + E^(x*(-Log[a] + Log[b]))/(-Log[a] + Log[b])

________________________________________________________________________________________

IntegrateAlgebraic [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int a^{-x} b^{-x} \left (a^x-b^x\right )^2 \, dx \]

Verification is Not applicable to the result.

[In]

IntegrateAlgebraic[(a^x - b^x)^2/(a^x*b^x),x]

[Out]

Could not integrate

________________________________________________________________________________________

fricas [A]  time = 0.85, size = 52, normalized size = 1.53 \[ -\frac {2 \, {\left (x \log \relax (a) - x \log \relax (b)\right )} a^{x} b^{x} - a^{2 \, x} + b^{2 \, x}}{a^{x} b^{x} {\left (\log \relax (a) - \log \relax (b)\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a^x-b^x)^2/(a^x)/(b^x),x, algorithm="fricas")

[Out]

-(2*(x*log(a) - x*log(b))*a^x*b^x - a^(2*x) + b^(2*x))/(a^x*b^x*(log(a) - log(b)))

________________________________________________________________________________________

giac [C]  time = 0.94, size = 436, normalized size = 12.82 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a^x-b^x)^2/(a^x)/(b^x),x, algorithm="giac")

[Out]

2*(2*(log(abs(a)) - log(abs(b)))*cos(-1/2*pi*x*sgn(a) + 1/2*pi*x*sgn(b))/((pi*sgn(a) - pi*sgn(b))^2 + 4*(log(a
bs(a)) - log(abs(b)))^2) - (pi*sgn(a) - pi*sgn(b))*sin(-1/2*pi*x*sgn(a) + 1/2*pi*x*sgn(b))/((pi*sgn(a) - pi*sg
n(b))^2 + 4*(log(abs(a)) - log(abs(b)))^2))*e^(x*(log(abs(a)) - log(abs(b)))) - 1/2*I*(-2*I*e^(1/2*I*pi*x*sgn(
a) - 1/2*I*pi*x*sgn(b))/(I*pi*sgn(a) - I*pi*sgn(b) + 2*log(abs(a)) - 2*log(abs(b))) + 2*I*e^(-1/2*I*pi*x*sgn(a
) + 1/2*I*pi*x*sgn(b))/(-I*pi*sgn(a) + I*pi*sgn(b) + 2*log(abs(a)) - 2*log(abs(b))))*e^(x*(log(abs(a)) - log(a
bs(b)))) - 2*(2*(log(abs(a)) - log(abs(b)))*cos(1/2*pi*x*sgn(a) - 1/2*pi*x*sgn(b))/((pi*sgn(a) - pi*sgn(b))^2
+ 4*(log(abs(a)) - log(abs(b)))^2) - (pi*sgn(a) - pi*sgn(b))*sin(1/2*pi*x*sgn(a) - 1/2*pi*x*sgn(b))/((pi*sgn(a
) - pi*sgn(b))^2 + 4*(log(abs(a)) - log(abs(b)))^2))*e^(-x*(log(abs(a)) - log(abs(b)))) - 1/2*I*(2*I*e^(1/2*I*
pi*x*sgn(a) - 1/2*I*pi*x*sgn(b))/(I*pi*sgn(a) - I*pi*sgn(b) - 2*log(abs(a)) + 2*log(abs(b))) - 2*I*e^(-1/2*I*p
i*x*sgn(a) + 1/2*I*pi*x*sgn(b))/(-I*pi*sgn(a) + I*pi*sgn(b) - 2*log(abs(a)) + 2*log(abs(b))))*e^(-x*(log(abs(a
)) - log(abs(b)))) - 2*x

________________________________________________________________________________________

maple [A]  time = 0.05, size = 42, normalized size = 1.24




method result size



risch \(-2 x +\frac {a^{x} b^{-x}}{\ln \relax (a )-\ln \relax (b )}-\frac {b^{x} a^{-x}}{\ln \relax (a )-\ln \relax (b )}\) \(42\)
norman \(\left (\frac {{\mathrm e}^{2 x \ln \relax (a )}}{\ln \relax (a )-\ln \relax (b )}-\frac {{\mathrm e}^{2 x \ln \relax (b )}}{\ln \relax (a )-\ln \relax (b )}-2 x \,{\mathrm e}^{x \ln \relax (a )} {\mathrm e}^{x \ln \relax (b )}\right ) {\mathrm e}^{-x \ln \relax (a )} {\mathrm e}^{-x \ln \relax (b )}\) \(65\)
meijerg error in int/gbinthm/express: improper op or subscript selector\ N/A



Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a^x-b^x)^2/(a^x)/(b^x),x,method=_RETURNVERBOSE)

[Out]

-2*x+a^x/(b^x)/(ln(a)-ln(b))-b^x/(a^x)/(ln(a)-ln(b))

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a^x-b^x)^2/(a^x)/(b^x),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(-log(b)/log(a)>0)', see `assum
e?` for more details)Is -log(b)/log(a) equal to -1?

________________________________________________________________________________________

mupad [B]  time = 0.49, size = 34, normalized size = 1.00 \[ \frac {\frac {a^x}{b^x}-\frac {b^x}{a^x}}{\ln \relax (a)-\ln \relax (b)}-2\,x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a^x - b^x)^2/(a^x*b^x),x)

[Out]

(a^x/b^x - b^x/a^x)/(log(a) - log(b)) - 2*x

________________________________________________________________________________________

sympy [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: TypeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a**x-b**x)**2/(a**x)/(b**x),x)

[Out]

Exception raised: TypeError

________________________________________________________________________________________