3.5.95 \(\int a^{-x} b^{-x} (a^x-b^x)^2 \, dx\) [495]

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.13, 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 = {2325, 6874, 2225, 8} \begin {gather*} -\frac {a^{-x} b^x}{\log (a)-\log (b)}+\frac {a^x b^{-x}}{\log (a)-\log (b)}-2 x \end {gather*}

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 2225

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 2325

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 6874

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.04, size = 46, normalized size = 1.35 \begin {gather*} -2 x+\frac {e^{x (\log (a)-\log (b))}}{\log (a)-\log (b)}+\frac {e^{x (-\log (a)+\log (b))}}{-\log (a)+\log (b)} \end {gather*}

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])

________________________________________________________________________________________

Mathics [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {cought exception: Invalid NaN comparison} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

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

[Out]

cought exception: Invalid NaN comparison

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 42, normalized size = 1.24

method result size
risch \(-2 x +\frac {a^{x} b^{-x}}{\ln \left (a \right )-\ln \left (b \right )}-\frac {b^{x} a^{-x}}{\ln \left (a \right )-\ln \left (b \right )}\) \(42\)
norman \(\left (\frac {{\mathrm e}^{2 x \ln \left (a \right )}}{\ln \left (a \right )-\ln \left (b \right )}-\frac {{\mathrm e}^{2 x \ln \left (b \right )}}{\ln \left (a \right )-\ln \left (b \right )}-2 x \,{\mathrm e}^{x \ln \left (a \right )} {\mathrm e}^{x \ln \left (b \right )}\right ) {\mathrm e}^{-x \ln \left (a \right )} {\mathrm e}^{-x \ln \left (b \right )}\) \(65\)

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 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}

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

________________________________________________________________________________________

Fricas [A]
time = 0.31, size = 52, normalized size = 1.53 \begin {gather*} -\frac {2 \, {\left (x \log \left (a\right ) - x \log \left (b\right )\right )} a^{x} b^{x} - a^{2 \, x} + b^{2 \, x}}{a^{x} b^{x} {\left (\log \left (a\right ) - \log \left (b\right )\right )}} \end {gather*}

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)))

________________________________________________________________________________________

Sympy [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: TypeError} \end {gather*}

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

________________________________________________________________________________________

Giac [F] N/A
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Could not integrate

________________________________________________________________________________________

Mupad [B]
time = 0.49, size = 34, normalized size = 1.00 \begin {gather*} \frac {\frac {a^x}{b^x}-\frac {b^x}{a^x}}{\ln \left (a\right )-\ln \left (b\right )}-2\,x \end {gather*}

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

________________________________________________________________________________________