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

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

Optimal result

Integrand size = 26, antiderivative size = 320 \[ \int \frac {(e+f x)^2 \cos (c+d x)}{a+b \sin (c+d x)} \, dx=-\frac {i (e+f x)^3}{3 b f}+\frac {(e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d}+\frac {(e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b d}-\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d^2}-\frac {2 i f (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b d^2}+\frac {2 f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d^3}+\frac {2 f^2 \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{b d^3} \] Output:

-1/3*I*(f*x+e)^3/b/f+(f*x+e)^2*ln(1-I*b*exp(I*(d*x+c))/(a-(a^2-b^2)^(1/2)) 
)/b/d+(f*x+e)^2*ln(1-I*b*exp(I*(d*x+c))/(a+(a^2-b^2)^(1/2)))/b/d-2*I*f*(f* 
x+e)*polylog(2,I*b*exp(I*(d*x+c))/(a-(a^2-b^2)^(1/2)))/b/d^2-2*I*f*(f*x+e) 
*polylog(2,I*b*exp(I*(d*x+c))/(a+(a^2-b^2)^(1/2)))/b/d^2+2*f^2*polylog(3,I 
*b*exp(I*(d*x+c))/(a-(a^2-b^2)^(1/2)))/b/d^3+2*f^2*polylog(3,I*b*exp(I*(d* 
x+c))/(a+(a^2-b^2)^(1/2)))/b/d^3
 

Mathematica [A] (verified)

Time = 0.19 (sec) , antiderivative size = 302, normalized size of antiderivative = 0.94 \[ \int \frac {(e+f x)^2 \cos (c+d x)}{a+b \sin (c+d x)} \, dx=\frac {-\frac {i (e+f x)^3}{f}+\frac {3 (e+f x)^2 \log \left (1+\frac {i b e^{i (c+d x)}}{-a+\sqrt {a^2-b^2}}\right )}{d}+\frac {3 (e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d}+\frac {6 f \left (-i d (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )+f \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )\right )}{d^3}+\frac {6 f \left (-i d (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )+f \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )\right )}{d^3}}{3 b} \] Input:

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

Output:

(((-I)*(e + f*x)^3)/f + (3*(e + f*x)^2*Log[1 + (I*b*E^(I*(c + d*x)))/(-a + 
 Sqrt[a^2 - b^2])])/d + (3*(e + f*x)^2*Log[1 - (I*b*E^(I*(c + d*x)))/(a + 
Sqrt[a^2 - b^2])])/d + (6*f*((-I)*d*(e + f*x)*PolyLog[2, (I*b*E^(I*(c + d* 
x)))/(a - Sqrt[a^2 - b^2])] + f*PolyLog[3, (I*b*E^(I*(c + d*x)))/(a - Sqrt 
[a^2 - b^2])]))/d^3 + (6*f*((-I)*d*(e + f*x)*PolyLog[2, (I*b*E^(I*(c + d*x 
)))/(a + Sqrt[a^2 - b^2])] + f*PolyLog[3, (I*b*E^(I*(c + d*x)))/(a + Sqrt[ 
a^2 - b^2])]))/d^3)/(3*b)
 

Rubi [A] (verified)

Time = 1.14 (sec) , antiderivative size = 322, normalized size of antiderivative = 1.01, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.192, Rules used = {5030, 2620, 3011, 2720, 7143}

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

\(\Big \downarrow \) 5030

\(\displaystyle \int \frac {e^{i (c+d x)} (e+f x)^2}{a-i b e^{i (c+d x)}-\sqrt {a^2-b^2}}dx+\int \frac {e^{i (c+d x)} (e+f x)^2}{a-i b e^{i (c+d x)}+\sqrt {a^2-b^2}}dx-\frac {i (e+f x)^3}{3 b f}\)

\(\Big \downarrow \) 2620

\(\displaystyle -\frac {2 f \int (e+f x) \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )dx}{b d}-\frac {2 f \int (e+f x) \log \left (1-\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )dx}{b d}+\frac {(e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d}+\frac {(e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{b d}-\frac {i (e+f x)^3}{3 b f}\)

\(\Big \downarrow \) 3011

\(\displaystyle -\frac {2 f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d}-\frac {i f \int \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )dx}{d}\right )}{b d}-\frac {2 f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d}-\frac {i f \int \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )dx}{d}\right )}{b d}+\frac {(e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d}+\frac {(e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{b d}-\frac {i (e+f x)^3}{3 b f}\)

\(\Big \downarrow \) 2720

\(\displaystyle -\frac {2 f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d}-\frac {f \int e^{-i (c+d x)} \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )de^{i (c+d x)}}{d^2}\right )}{b d}-\frac {2 f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d}-\frac {f \int e^{-i (c+d x)} \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )de^{i (c+d x)}}{d^2}\right )}{b d}+\frac {(e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d}+\frac {(e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{b d}-\frac {i (e+f x)^3}{3 b f}\)

\(\Big \downarrow \) 7143

\(\displaystyle -\frac {2 f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d}-\frac {f \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d^2}\right )}{b d}-\frac {2 f \left (\frac {i (e+f x) \operatorname {PolyLog}\left (2,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d}-\frac {f \operatorname {PolyLog}\left (3,\frac {i b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d^2}\right )}{b d}+\frac {(e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d}+\frac {(e+f x)^2 \log \left (1-\frac {i b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{b d}-\frac {i (e+f x)^3}{3 b f}\)

Input:

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

Output:

((-1/3*I)*(e + f*x)^3)/(b*f) + ((e + f*x)^2*Log[1 - (I*b*E^(I*(c + d*x)))/ 
(a - Sqrt[a^2 - b^2])])/(b*d) + ((e + f*x)^2*Log[1 - (I*b*E^(I*(c + d*x))) 
/(a + Sqrt[a^2 - b^2])])/(b*d) - (2*f*((I*(e + f*x)*PolyLog[2, (I*b*E^(I*( 
c + d*x)))/(a - Sqrt[a^2 - b^2])])/d - (f*PolyLog[3, (I*b*E^(I*(c + d*x))) 
/(a - Sqrt[a^2 - b^2])])/d^2))/(b*d) - (2*f*((I*(e + f*x)*PolyLog[2, (I*b* 
E^(I*(c + d*x)))/(a + Sqrt[a^2 - b^2])])/d - (f*PolyLog[3, (I*b*E^(I*(c + 
d*x)))/(a + Sqrt[a^2 - b^2])])/d^2))/(b*d)
 

Defintions of rubi rules used

rule 2620
Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/ 
((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp 
[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x] - Si 
mp[d*(m/(b*f*g*n*Log[F]))   Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x 
)))^n/a)], x], x] /; FreeQ[{F, a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]
 

rule 2720
Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Simp[v/D[v, x] 
   Subst[Int[FunctionOfExponentialFunction[u, x]/x, x], x, v], x]] /; Funct 
ionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; FreeQ 
[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x)) 
*(F_)[v_] /; FreeQ[{a, b, c}, x] && InverseFunctionQ[F[x]]]
 

rule 3011
Int[Log[1 + (e_.)*((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.)]*((f_.) + (g_.) 
*(x_))^(m_.), x_Symbol] :> Simp[(-(f + g*x)^m)*(PolyLog[2, (-e)*(F^(c*(a + 
b*x)))^n]/(b*c*n*Log[F])), x] + Simp[g*(m/(b*c*n*Log[F]))   Int[(f + g*x)^( 
m - 1)*PolyLog[2, (-e)*(F^(c*(a + b*x)))^n], x], x] /; FreeQ[{F, a, b, c, e 
, f, g, n}, x] && GtQ[m, 0]
 

rule 5030
Int[(Cos[(c_.) + (d_.)*(x_)]*((e_.) + (f_.)*(x_))^(m_.))/((a_) + (b_.)*Sin[ 
(c_.) + (d_.)*(x_)]), x_Symbol] :> Simp[(-I)*((e + f*x)^(m + 1)/(b*f*(m + 1 
))), x] + (Int[(e + f*x)^m*(E^(I*(c + d*x))/(a - Rt[a^2 - b^2, 2] - I*b*E^( 
I*(c + d*x)))), x] + Int[(e + f*x)^m*(E^(I*(c + d*x))/(a + Rt[a^2 - b^2, 2] 
 - I*b*E^(I*(c + d*x)))), x]) /; FreeQ[{a, b, c, d, e, f}, x] && IGtQ[m, 0] 
 && PosQ[a^2 - b^2]
 

rule 7143
Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_S 
ymbol] :> Simp[PolyLog[n + 1, c*(a + b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d 
, e, n, p}, x] && EqQ[b*d, a*e]
 
Maple [F]

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

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 1235 vs. \(2 (274) = 548\).

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

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

Output:

1/2*(2*f^2*polylog(3, -(I*a*cos(d*x + c) + a*sin(d*x + c) + (b*cos(d*x + c 
) - I*b*sin(d*x + c))*sqrt(-(a^2 - b^2)/b^2))/b) + 2*f^2*polylog(3, -(I*a* 
cos(d*x + c) + a*sin(d*x + c) - (b*cos(d*x + c) - I*b*sin(d*x + c))*sqrt(- 
(a^2 - b^2)/b^2))/b) + 2*f^2*polylog(3, -(-I*a*cos(d*x + c) + a*sin(d*x + 
c) + (b*cos(d*x + c) + I*b*sin(d*x + c))*sqrt(-(a^2 - b^2)/b^2))/b) + 2*f^ 
2*polylog(3, -(-I*a*cos(d*x + c) + a*sin(d*x + c) - (b*cos(d*x + c) + I*b* 
sin(d*x + c))*sqrt(-(a^2 - b^2)/b^2))/b) - 2*(I*d*f^2*x + I*d*e*f)*dilog(( 
I*a*cos(d*x + c) - a*sin(d*x + c) + (b*cos(d*x + c) + I*b*sin(d*x + c))*sq 
rt(-(a^2 - b^2)/b^2) - b)/b + 1) - 2*(I*d*f^2*x + I*d*e*f)*dilog((I*a*cos( 
d*x + c) - a*sin(d*x + c) - (b*cos(d*x + c) + I*b*sin(d*x + c))*sqrt(-(a^2 
 - b^2)/b^2) - b)/b + 1) - 2*(-I*d*f^2*x - I*d*e*f)*dilog((-I*a*cos(d*x + 
c) - a*sin(d*x + c) + (b*cos(d*x + c) - I*b*sin(d*x + c))*sqrt(-(a^2 - b^2 
)/b^2) - b)/b + 1) - 2*(-I*d*f^2*x - I*d*e*f)*dilog((-I*a*cos(d*x + c) - a 
*sin(d*x + c) - (b*cos(d*x + c) - I*b*sin(d*x + c))*sqrt(-(a^2 - b^2)/b^2) 
 - b)/b + 1) + (d^2*e^2 - 2*c*d*e*f + c^2*f^2)*log(2*b*cos(d*x + c) + 2*I* 
b*sin(d*x + c) + 2*b*sqrt(-(a^2 - b^2)/b^2) + 2*I*a) + (d^2*e^2 - 2*c*d*e* 
f + c^2*f^2)*log(2*b*cos(d*x + c) - 2*I*b*sin(d*x + c) + 2*b*sqrt(-(a^2 - 
b^2)/b^2) - 2*I*a) + (d^2*e^2 - 2*c*d*e*f + c^2*f^2)*log(-2*b*cos(d*x + c) 
 + 2*I*b*sin(d*x + c) + 2*b*sqrt(-(a^2 - b^2)/b^2) + 2*I*a) + (d^2*e^2 - 2 
*c*d*e*f + c^2*f^2)*log(-2*b*cos(d*x + c) - 2*I*b*sin(d*x + c) + 2*b*sq...
 

Sympy [F]

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

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

Output:

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

Maxima [F(-2)]

Exception generated. \[ \int \frac {(e+f x)^2 \cos (c+d x)}{a+b \sin (c+d x)} \, dx=\text {Exception raised: ValueError} \] Input:

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

Output:

Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?` f 
or more de
 

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

(6*int(x**2/(tan((c + d*x)/2)**2*a + 2*tan((c + d*x)/2)*b + a),x)*a*b*d*f* 
*2 + 6*int((tan((c + d*x)/2)*x**2)/(tan((c + d*x)/2)**2*a + 2*tan((c + d*x 
)/2)*b + a),x)*b**2*d*f**2 + 12*int((tan((c + d*x)/2)*x)/(tan((c + d*x)/2) 
**2*a + 2*tan((c + d*x)/2)*b + a),x)*b**2*d*e*f + 12*int(x/(tan((c + d*x)/ 
2)**2*a + 2*tan((c + d*x)/2)*b + a),x)*a*b*d*e*f - 3*log(tan((c + d*x)/2)* 
*2 + 1)*a*e**2 + 3*log(tan((c + d*x)/2)**2*a + 2*tan((c + d*x)/2)*b + a)*a 
*e**2 - 3*b*d*e*f*x**2 - b*d*f**2*x**3)/(3*a*b*d)