\(\int \frac {(a+b \sin (e+f x))^2}{c+d x} \, dx\) [160]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [F]
Maxima [C] (verification not implemented)
Giac [C] (verification not implemented)
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 20, antiderivative size = 156 \[ \int \frac {(a+b \sin (e+f x))^2}{c+d x} \, dx=-\frac {b^2 \cos \left (2 e-\frac {2 c f}{d}\right ) \operatorname {CosIntegral}\left (\frac {2 c f}{d}+2 f x\right )}{2 d}+\frac {a^2 \log (c+d x)}{d}+\frac {b^2 \log (c+d x)}{2 d}+\frac {2 a b \operatorname {CosIntegral}\left (\frac {c f}{d}+f x\right ) \sin \left (e-\frac {c f}{d}\right )}{d}+\frac {2 a b \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (\frac {c f}{d}+f x\right )}{d}+\frac {b^2 \sin \left (2 e-\frac {2 c f}{d}\right ) \text {Si}\left (\frac {2 c f}{d}+2 f x\right )}{2 d} \] Output:

-1/2*b^2*cos(-2*e+2*c*f/d)*Ci(2*c*f/d+2*f*x)/d+a^2*ln(d*x+c)/d+1/2*b^2*ln( 
d*x+c)/d-2*a*b*Ci(c*f/d+f*x)*sin(-e+c*f/d)/d+2*a*b*cos(-e+c*f/d)*Si(c*f/d+ 
f*x)/d-1/2*b^2*sin(-2*e+2*c*f/d)*Si(2*c*f/d+2*f*x)/d
 

Mathematica [A] (verified)

Time = 0.38 (sec) , antiderivative size = 134, normalized size of antiderivative = 0.86 \[ \int \frac {(a+b \sin (e+f x))^2}{c+d x} \, dx=\frac {-b^2 \cos \left (2 e-\frac {2 c f}{d}\right ) \operatorname {CosIntegral}\left (\frac {2 f (c+d x)}{d}\right )+2 a^2 \log (c+d x)+b^2 \log (c+d x)+4 a b \operatorname {CosIntegral}\left (f \left (\frac {c}{d}+x\right )\right ) \sin \left (e-\frac {c f}{d}\right )+4 a b \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (f \left (\frac {c}{d}+x\right )\right )+b^2 \sin \left (2 e-\frac {2 c f}{d}\right ) \text {Si}\left (\frac {2 f (c+d x)}{d}\right )}{2 d} \] Input:

Integrate[(a + b*Sin[e + f*x])^2/(c + d*x),x]
 

Output:

(-(b^2*Cos[2*e - (2*c*f)/d]*CosIntegral[(2*f*(c + d*x))/d]) + 2*a^2*Log[c 
+ d*x] + b^2*Log[c + d*x] + 4*a*b*CosIntegral[f*(c/d + x)]*Sin[e - (c*f)/d 
] + 4*a*b*Cos[e - (c*f)/d]*SinIntegral[f*(c/d + x)] + b^2*Sin[2*e - (2*c*f 
)/d]*SinIntegral[(2*f*(c + d*x))/d])/(2*d)
 

Rubi [A] (verified)

Time = 0.54 (sec) , antiderivative size = 156, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.150, Rules used = {3042, 3798, 2009}

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 {(a+b \sin (e+f x))^2}{c+d x} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+b \sin (e+f x))^2}{c+d x}dx\)

\(\Big \downarrow \) 3798

\(\displaystyle \int \left (\frac {a^2}{c+d x}+\frac {2 a b \sin (e+f x)}{c+d x}+\frac {b^2 \sin ^2(e+f x)}{c+d x}\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {a^2 \log (c+d x)}{d}+\frac {2 a b \operatorname {CosIntegral}\left (x f+\frac {c f}{d}\right ) \sin \left (e-\frac {c f}{d}\right )}{d}+\frac {2 a b \cos \left (e-\frac {c f}{d}\right ) \text {Si}\left (x f+\frac {c f}{d}\right )}{d}-\frac {b^2 \operatorname {CosIntegral}\left (2 x f+\frac {2 c f}{d}\right ) \cos \left (2 e-\frac {2 c f}{d}\right )}{2 d}+\frac {b^2 \sin \left (2 e-\frac {2 c f}{d}\right ) \text {Si}\left (2 x f+\frac {2 c f}{d}\right )}{2 d}+\frac {b^2 \log (c+d x)}{2 d}\)

Input:

Int[(a + b*Sin[e + f*x])^2/(c + d*x),x]
 

Output:

-1/2*(b^2*Cos[2*e - (2*c*f)/d]*CosIntegral[(2*c*f)/d + 2*f*x])/d + (a^2*Lo 
g[c + d*x])/d + (b^2*Log[c + d*x])/(2*d) + (2*a*b*CosIntegral[(c*f)/d + f* 
x]*Sin[e - (c*f)/d])/d + (2*a*b*Cos[e - (c*f)/d]*SinIntegral[(c*f)/d + f*x 
])/d + (b^2*Sin[2*e - (2*c*f)/d]*SinIntegral[(2*c*f)/d + 2*f*x])/(2*d)
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3798
Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_.) 
, x_Symbol] :> Int[ExpandIntegrand[(c + d*x)^m, (a + b*Sin[e + f*x])^n, x], 
 x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[n, 0] && (EqQ[n, 1] || IGtQ[ 
m, 0] || NeQ[a^2 - b^2, 0])
 
Maple [A] (verified)

Time = 1.48 (sec) , antiderivative size = 203, normalized size of antiderivative = 1.30

method result size
parts \(\frac {a^{2} \ln \left (d x +c \right )}{d}+\frac {b^{2} \ln \left (c f -d e +d \left (f x +e \right )\right )}{2 d}-\frac {b^{2} \operatorname {Si}\left (2 f x +2 e +\frac {2 c f -2 d e}{d}\right ) \sin \left (\frac {2 c f -2 d e}{d}\right )}{2 d}-\frac {b^{2} \operatorname {Ci}\left (2 f x +2 e +\frac {2 c f -2 d e}{d}\right ) \cos \left (\frac {2 c f -2 d e}{d}\right )}{2 d}+2 a b \left (\frac {\operatorname {Si}\left (f x +e +\frac {c f -d e}{d}\right ) \cos \left (\frac {c f -d e}{d}\right )}{d}-\frac {\operatorname {Ci}\left (f x +e +\frac {c f -d e}{d}\right ) \sin \left (\frac {c f -d e}{d}\right )}{d}\right )\) \(203\)
derivativedivides \(\frac {\frac {a^{2} f \ln \left (c f -d e +d \left (f x +e \right )\right )}{d}+2 f a b \left (\frac {\operatorname {Si}\left (f x +e +\frac {c f -d e}{d}\right ) \cos \left (\frac {c f -d e}{d}\right )}{d}-\frac {\operatorname {Ci}\left (f x +e +\frac {c f -d e}{d}\right ) \sin \left (\frac {c f -d e}{d}\right )}{d}\right )+\frac {f \,b^{2} \ln \left (c f -d e +d \left (f x +e \right )\right )}{2 d}-\frac {f \,b^{2} \left (\frac {2 \,\operatorname {Si}\left (2 f x +2 e +\frac {2 c f -2 d e}{d}\right ) \sin \left (\frac {2 c f -2 d e}{d}\right )}{d}+\frac {2 \,\operatorname {Ci}\left (2 f x +2 e +\frac {2 c f -2 d e}{d}\right ) \cos \left (\frac {2 c f -2 d e}{d}\right )}{d}\right )}{4}}{f}\) \(221\)
default \(\frac {\frac {a^{2} f \ln \left (c f -d e +d \left (f x +e \right )\right )}{d}+2 f a b \left (\frac {\operatorname {Si}\left (f x +e +\frac {c f -d e}{d}\right ) \cos \left (\frac {c f -d e}{d}\right )}{d}-\frac {\operatorname {Ci}\left (f x +e +\frac {c f -d e}{d}\right ) \sin \left (\frac {c f -d e}{d}\right )}{d}\right )+\frac {f \,b^{2} \ln \left (c f -d e +d \left (f x +e \right )\right )}{2 d}-\frac {f \,b^{2} \left (\frac {2 \,\operatorname {Si}\left (2 f x +2 e +\frac {2 c f -2 d e}{d}\right ) \sin \left (\frac {2 c f -2 d e}{d}\right )}{d}+\frac {2 \,\operatorname {Ci}\left (2 f x +2 e +\frac {2 c f -2 d e}{d}\right ) \cos \left (\frac {2 c f -2 d e}{d}\right )}{d}\right )}{4}}{f}\) \(221\)
risch \(-\frac {i a b \,{\mathrm e}^{\frac {i \left (c f -d e \right )}{d}} \operatorname {expIntegral}_{1}\left (i f x +i e +\frac {i \left (c f -d e \right )}{d}\right )}{d}+\frac {a^{2} \ln \left (d x +c \right )}{d}+\frac {b^{2} \ln \left (d x +c \right )}{2 d}+\frac {b^{2} {\mathrm e}^{\frac {2 i \left (c f -d e \right )}{d}} \operatorname {expIntegral}_{1}\left (2 i f x +2 i e +\frac {2 i \left (c f -d e \right )}{d}\right )}{4 d}+\frac {b^{2} {\mathrm e}^{-\frac {2 i \left (c f -d e \right )}{d}} \operatorname {expIntegral}_{1}\left (-2 i f x -2 i e -\frac {2 \left (i c f -i d e \right )}{d}\right )}{4 d}+\frac {i a b \,{\mathrm e}^{-\frac {i \left (c f -d e \right )}{d}} \operatorname {expIntegral}_{1}\left (-i f x -i e -\frac {i c f -i d e}{d}\right )}{d}\) \(229\)

Input:

int((a+b*sin(f*x+e))^2/(d*x+c),x,method=_RETURNVERBOSE)
 

Output:

a^2*ln(d*x+c)/d+1/2*b^2*ln(c*f-d*e+d*(f*x+e))/d-1/2*b^2*Si(2*f*x+2*e+2*(c* 
f-d*e)/d)*sin(2*(c*f-d*e)/d)/d-1/2*b^2*Ci(2*f*x+2*e+2*(c*f-d*e)/d)*cos(2*( 
c*f-d*e)/d)/d+2*a*b*(Si(f*x+e+(c*f-d*e)/d)*cos((c*f-d*e)/d)/d-Ci(f*x+e+(c* 
f-d*e)/d)*sin((c*f-d*e)/d)/d)
 

Fricas [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 149, normalized size of antiderivative = 0.96 \[ \int \frac {(a+b \sin (e+f x))^2}{c+d x} \, dx=-\frac {b^{2} \cos \left (-\frac {2 \, {\left (d e - c f\right )}}{d}\right ) \operatorname {Ci}\left (\frac {2 \, {\left (d f x + c f\right )}}{d}\right ) + 4 \, a b \operatorname {Ci}\left (\frac {d f x + c f}{d}\right ) \sin \left (-\frac {d e - c f}{d}\right ) + b^{2} \sin \left (-\frac {2 \, {\left (d e - c f\right )}}{d}\right ) \operatorname {Si}\left (\frac {2 \, {\left (d f x + c f\right )}}{d}\right ) - 4 \, a b \cos \left (-\frac {d e - c f}{d}\right ) \operatorname {Si}\left (\frac {d f x + c f}{d}\right ) - {\left (2 \, a^{2} + b^{2}\right )} \log \left (d x + c\right )}{2 \, d} \] Input:

integrate((a+b*sin(f*x+e))^2/(d*x+c),x, algorithm="fricas")
 

Output:

-1/2*(b^2*cos(-2*(d*e - c*f)/d)*cos_integral(2*(d*f*x + c*f)/d) + 4*a*b*co 
s_integral((d*f*x + c*f)/d)*sin(-(d*e - c*f)/d) + b^2*sin(-2*(d*e - c*f)/d 
)*sin_integral(2*(d*f*x + c*f)/d) - 4*a*b*cos(-(d*e - c*f)/d)*sin_integral 
((d*f*x + c*f)/d) - (2*a^2 + b^2)*log(d*x + c))/d
 

Sympy [F]

\[ \int \frac {(a+b \sin (e+f x))^2}{c+d x} \, dx=\int \frac {\left (a + b \sin {\left (e + f x \right )}\right )^{2}}{c + d x}\, dx \] Input:

integrate((a+b*sin(f*x+e))**2/(d*x+c),x)
 

Output:

Integral((a + b*sin(e + f*x))**2/(c + d*x), x)
 

Maxima [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.11 (sec) , antiderivative size = 336, normalized size of antiderivative = 2.15 \[ \int \frac {(a+b \sin (e+f x))^2}{c+d x} \, dx=\frac {\frac {4 \, a^{2} f \log \left (c + \frac {{\left (f x + e\right )} d}{f} - \frac {d e}{f}\right )}{d} + \frac {4 \, {\left (f {\left (-i \, E_{1}\left (\frac {i \, {\left (f x + e\right )} d - i \, d e + i \, c f}{d}\right ) + i \, E_{1}\left (-\frac {i \, {\left (f x + e\right )} d - i \, d e + i \, c f}{d}\right )\right )} \cos \left (-\frac {d e - c f}{d}\right ) + f {\left (E_{1}\left (\frac {i \, {\left (f x + e\right )} d - i \, d e + i \, c f}{d}\right ) + E_{1}\left (-\frac {i \, {\left (f x + e\right )} d - i \, d e + i \, c f}{d}\right )\right )} \sin \left (-\frac {d e - c f}{d}\right )\right )} a b}{d} + \frac {{\left (f {\left (E_{1}\left (\frac {2 \, {\left (-i \, {\left (f x + e\right )} d + i \, d e - i \, c f\right )}}{d}\right ) + E_{1}\left (-\frac {2 \, {\left (-i \, {\left (f x + e\right )} d + i \, d e - i \, c f\right )}}{d}\right )\right )} \cos \left (-\frac {2 \, {\left (d e - c f\right )}}{d}\right ) + f {\left (-i \, E_{1}\left (\frac {2 \, {\left (-i \, {\left (f x + e\right )} d + i \, d e - i \, c f\right )}}{d}\right ) + i \, E_{1}\left (-\frac {2 \, {\left (-i \, {\left (f x + e\right )} d + i \, d e - i \, c f\right )}}{d}\right )\right )} \sin \left (-\frac {2 \, {\left (d e - c f\right )}}{d}\right ) + 2 \, f \log \left ({\left (f x + e\right )} d - d e + c f\right )\right )} b^{2}}{d}}{4 \, f} \] Input:

integrate((a+b*sin(f*x+e))^2/(d*x+c),x, algorithm="maxima")
 

Output:

1/4*(4*a^2*f*log(c + (f*x + e)*d/f - d*e/f)/d + 4*(f*(-I*exp_integral_e(1, 
 (I*(f*x + e)*d - I*d*e + I*c*f)/d) + I*exp_integral_e(1, -(I*(f*x + e)*d 
- I*d*e + I*c*f)/d))*cos(-(d*e - c*f)/d) + f*(exp_integral_e(1, (I*(f*x + 
e)*d - I*d*e + I*c*f)/d) + exp_integral_e(1, -(I*(f*x + e)*d - I*d*e + I*c 
*f)/d))*sin(-(d*e - c*f)/d))*a*b/d + (f*(exp_integral_e(1, 2*(-I*(f*x + e) 
*d + I*d*e - I*c*f)/d) + exp_integral_e(1, -2*(-I*(f*x + e)*d + I*d*e - I* 
c*f)/d))*cos(-2*(d*e - c*f)/d) + f*(-I*exp_integral_e(1, 2*(-I*(f*x + e)*d 
 + I*d*e - I*c*f)/d) + I*exp_integral_e(1, -2*(-I*(f*x + e)*d + I*d*e - I* 
c*f)/d))*sin(-2*(d*e - c*f)/d) + 2*f*log((f*x + e)*d - d*e + c*f))*b^2/d)/ 
f
 

Giac [C] (verification not implemented)

Result contains higher order function than in optimal. Order 9 vs. order 4.

Time = 0.46 (sec) , antiderivative size = 7139, normalized size of antiderivative = 45.76 \[ \int \frac {(a+b \sin (e+f x))^2}{c+d x} \, dx=\text {Too large to display} \] Input:

integrate((a+b*sin(f*x+e))^2/(d*x+c),x, algorithm="giac")
 

Output:

1/4*(4*a*b*imag_part(cos_integral(f*x + c*f/d))*tan(1/2*e)^2*tan(e)^2*tan( 
c*f/d)^2*tan(1/2*c*f/d)^2 - 4*a*b*imag_part(cos_integral(-f*x - c*f/d))*ta 
n(1/2*e)^2*tan(e)^2*tan(c*f/d)^2*tan(1/2*c*f/d)^2 + 4*a^2*log(abs(d*x + c) 
)*tan(1/2*e)^2*tan(e)^2*tan(c*f/d)^2*tan(1/2*c*f/d)^2 + 2*b^2*log(abs(d*x 
+ c))*tan(1/2*e)^2*tan(e)^2*tan(c*f/d)^2*tan(1/2*c*f/d)^2 - b^2*real_part( 
cos_integral(2*f*x + 2*c*f/d))*tan(1/2*e)^2*tan(e)^2*tan(c*f/d)^2*tan(1/2* 
c*f/d)^2 - b^2*real_part(cos_integral(-2*f*x - 2*c*f/d))*tan(1/2*e)^2*tan( 
e)^2*tan(c*f/d)^2*tan(1/2*c*f/d)^2 + 8*a*b*sin_integral((d*f*x + c*f)/d)*t 
an(1/2*e)^2*tan(e)^2*tan(c*f/d)^2*tan(1/2*c*f/d)^2 + 8*a*b*real_part(cos_i 
ntegral(f*x + c*f/d))*tan(1/2*e)^2*tan(e)^2*tan(c*f/d)^2*tan(1/2*c*f/d) + 
8*a*b*real_part(cos_integral(-f*x - c*f/d))*tan(1/2*e)^2*tan(e)^2*tan(c*f/ 
d)^2*tan(1/2*c*f/d) + 2*b^2*imag_part(cos_integral(2*f*x + 2*c*f/d))*tan(1 
/2*e)^2*tan(e)^2*tan(c*f/d)*tan(1/2*c*f/d)^2 - 2*b^2*imag_part(cos_integra 
l(-2*f*x - 2*c*f/d))*tan(1/2*e)^2*tan(e)^2*tan(c*f/d)*tan(1/2*c*f/d)^2 + 4 
*b^2*sin_integral(2*(d*f*x + c*f)/d)*tan(1/2*e)^2*tan(e)^2*tan(c*f/d)*tan( 
1/2*c*f/d)^2 - 2*b^2*imag_part(cos_integral(2*f*x + 2*c*f/d))*tan(1/2*e)^2 
*tan(e)*tan(c*f/d)^2*tan(1/2*c*f/d)^2 + 2*b^2*imag_part(cos_integral(-2*f* 
x - 2*c*f/d))*tan(1/2*e)^2*tan(e)*tan(c*f/d)^2*tan(1/2*c*f/d)^2 - 4*b^2*si 
n_integral(2*(d*f*x + c*f)/d)*tan(1/2*e)^2*tan(e)*tan(c*f/d)^2*tan(1/2*c*f 
/d)^2 - 8*a*b*real_part(cos_integral(f*x + c*f/d))*tan(1/2*e)*tan(e)^2*...
 

Mupad [F(-1)]

Timed out. \[ \int \frac {(a+b \sin (e+f x))^2}{c+d x} \, dx=\int \frac {{\left (a+b\,\sin \left (e+f\,x\right )\right )}^2}{c+d\,x} \,d x \] Input:

int((a + b*sin(e + f*x))^2/(c + d*x),x)
 

Output:

int((a + b*sin(e + f*x))^2/(c + d*x), x)
 

Reduce [F]

\[ \int \frac {(a+b \sin (e+f x))^2}{c+d x} \, dx=\frac {\left (\int \frac {\sin \left (f x +e \right )^{2}}{d x +c}d x \right ) b^{2} d +2 \left (\int \frac {\sin \left (f x +e \right )}{d x +c}d x \right ) a b d +\mathrm {log}\left (d x +c \right ) a^{2}}{d} \] Input:

int((a+b*sin(f*x+e))^2/(d*x+c),x)
 

Output:

(int(sin(e + f*x)**2/(c + d*x),x)*b**2*d + 2*int(sin(e + f*x)/(c + d*x),x) 
*a*b*d + log(c + d*x)*a**2)/d