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

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

Optimal result

Integrand size = 25, antiderivative size = 93 \[ \int \frac {(c+d \sin (e+f x))^2}{a+b \sin (e+f x)} \, dx=\frac {d (2 b c-a d) x}{b^2}+\frac {2 (b c-a d)^2 \arctan \left (\frac {b+a \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{b^2 \sqrt {a^2-b^2} f}-\frac {d^2 \cos (e+f x)}{b f} \] Output:

d*(-a*d+2*b*c)*x/b^2+2*(-a*d+b*c)^2*arctan((b+a*tan(1/2*f*x+1/2*e))/(a^2-b 
^2)^(1/2))/b^2/(a^2-b^2)^(1/2)/f-d^2*cos(f*x+e)/b/f
 

Mathematica [A] (verified)

Time = 0.91 (sec) , antiderivative size = 90, normalized size of antiderivative = 0.97 \[ \int \frac {(c+d \sin (e+f x))^2}{a+b \sin (e+f x)} \, dx=\frac {d (2 b c-a d) (e+f x)+\frac {2 (b c-a d)^2 \arctan \left (\frac {b+a \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}-b d^2 \cos (e+f x)}{b^2 f} \] Input:

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

Output:

(d*(2*b*c - a*d)*(e + f*x) + (2*(b*c - a*d)^2*ArcTan[(b + a*Tan[(e + f*x)/ 
2])/Sqrt[a^2 - b^2]])/Sqrt[a^2 - b^2] - b*d^2*Cos[e + f*x])/(b^2*f)
 

Rubi [A] (verified)

Time = 0.49 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.12, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.320, Rules used = {3042, 3225, 3042, 3214, 3042, 3139, 1083, 217}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3225

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3214

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3139

\(\displaystyle \frac {\frac {2 (b c-a d)^2 \int \frac {1}{a \tan ^2\left (\frac {1}{2} (e+f x)\right )+2 b \tan \left (\frac {1}{2} (e+f x)\right )+a}d\tan \left (\frac {1}{2} (e+f x)\right )}{b f}+\frac {d x (2 b c-a d)}{b}}{b}-\frac {d^2 \cos (e+f x)}{b f}\)

\(\Big \downarrow \) 1083

\(\displaystyle \frac {\frac {d x (2 b c-a d)}{b}-\frac {4 (b c-a d)^2 \int \frac {1}{-\left (2 b+2 a \tan \left (\frac {1}{2} (e+f x)\right )\right )^2-4 \left (a^2-b^2\right )}d\left (2 b+2 a \tan \left (\frac {1}{2} (e+f x)\right )\right )}{b f}}{b}-\frac {d^2 \cos (e+f x)}{b f}\)

\(\Big \downarrow \) 217

\(\displaystyle \frac {\frac {2 (b c-a d)^2 \arctan \left (\frac {2 a \tan \left (\frac {1}{2} (e+f x)\right )+2 b}{2 \sqrt {a^2-b^2}}\right )}{b f \sqrt {a^2-b^2}}+\frac {d x (2 b c-a d)}{b}}{b}-\frac {d^2 \cos (e+f x)}{b f}\)

Input:

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

Output:

((d*(2*b*c - a*d)*x)/b + (2*(b*c - a*d)^2*ArcTan[(2*b + 2*a*Tan[(e + f*x)/ 
2])/(2*Sqrt[a^2 - b^2])])/(b*Sqrt[a^2 - b^2]*f))/b - (d^2*Cos[e + f*x])/(b 
*f)
 

Defintions of rubi rules used

rule 217
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^( 
-1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] & 
& (LtQ[a, 0] || LtQ[b, 0])
 

rule 1083
Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Simp[-2   Subst[I 
nt[1/Simp[b^2 - 4*a*c - x^2, x], x], x, b + 2*c*x], x] /; FreeQ[{a, b, c}, 
x]
 

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

rule 3139
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = Fre 
eFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d)   Subst[Int[1/(a + 2*b*e*x + a 
*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] && NeQ 
[a^2 - b^2, 0]
 

rule 3214
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. 
)*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d   Int[1/(c + d 
*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
 

rule 3225
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2/((c_.) + (d_.)*sin[(e_.) + (f 
_.)*(x_)]), x_Symbol] :> Simp[(-b^2)*(Cos[e + f*x]/(d*f)), x] + Simp[1/d 
Int[Simp[a^2*d - b*(b*c - 2*a*d)*Sin[e + f*x], x]/(c + d*Sin[e + f*x]), x], 
 x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
 
Maple [A] (verified)

Time = 1.04 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.26

method result size
derivativedivides \(\frac {-\frac {2 d \left (\frac {b d}{1+\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}}+\left (a d -2 b c \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )\right )}{b^{2}}+\frac {2 \left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \arctan \left (\frac {2 a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{b^{2} \sqrt {a^{2}-b^{2}}}}{f}\) \(117\)
default \(\frac {-\frac {2 d \left (\frac {b d}{1+\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}}+\left (a d -2 b c \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )\right )}{b^{2}}+\frac {2 \left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \arctan \left (\frac {2 a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{b^{2} \sqrt {a^{2}-b^{2}}}}{f}\) \(117\)
risch \(-\frac {d^{2} x a}{b^{2}}+\frac {2 d x c}{b}-\frac {d^{2} {\mathrm e}^{i \left (f x +e \right )}}{2 b f}-\frac {d^{2} {\mathrm e}^{-i \left (f x +e \right )}}{2 b f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a -a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) a^{2} d^{2}}{\sqrt {-a^{2}+b^{2}}\, f \,b^{2}}+\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a -a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) a c d}{\sqrt {-a^{2}+b^{2}}\, f b}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a -a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) c^{2}}{\sqrt {-a^{2}+b^{2}}\, f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a +a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) a^{2} d^{2}}{\sqrt {-a^{2}+b^{2}}\, f \,b^{2}}-\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a +a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) a c d}{\sqrt {-a^{2}+b^{2}}\, f b}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a +a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) c^{2}}{\sqrt {-a^{2}+b^{2}}\, f}\) \(490\)

Input:

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

Output:

1/f*(-2*d/b^2*(b*d/(1+tan(1/2*f*x+1/2*e)^2)+(a*d-2*b*c)*arctan(tan(1/2*f*x 
+1/2*e)))+2*(a^2*d^2-2*a*b*c*d+b^2*c^2)/b^2/(a^2-b^2)^(1/2)*arctan(1/2*(2* 
a*tan(1/2*f*x+1/2*e)+2*b)/(a^2-b^2)^(1/2)))
 

Fricas [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 368, normalized size of antiderivative = 3.96 \[ \int \frac {(c+d \sin (e+f x))^2}{a+b \sin (e+f x)} \, dx=\left [-\frac {2 \, {\left (a^{2} b - b^{3}\right )} d^{2} \cos \left (f x + e\right ) - 2 \, {\left (2 \, {\left (a^{2} b - b^{3}\right )} c d - {\left (a^{3} - a b^{2}\right )} d^{2}\right )} f x + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, a b \sin \left (f x + e\right ) - a^{2} - b^{2} + 2 \, {\left (a \cos \left (f x + e\right ) \sin \left (f x + e\right ) + b \cos \left (f x + e\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (f x + e\right )^{2} - 2 \, a b \sin \left (f x + e\right ) - a^{2} - b^{2}}\right )}{2 \, {\left (a^{2} b^{2} - b^{4}\right )} f}, -\frac {{\left (a^{2} b - b^{3}\right )} d^{2} \cos \left (f x + e\right ) - {\left (2 \, {\left (a^{2} b - b^{3}\right )} c d - {\left (a^{3} - a b^{2}\right )} d^{2}\right )} f x + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \sin \left (f x + e\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (f x + e\right )}\right )}{{\left (a^{2} b^{2} - b^{4}\right )} f}\right ] \] Input:

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

Output:

[-1/2*(2*(a^2*b - b^3)*d^2*cos(f*x + e) - 2*(2*(a^2*b - b^3)*c*d - (a^3 - 
a*b^2)*d^2)*f*x + (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*sqrt(-a^2 + b^2)*log(((2 
*a^2 - b^2)*cos(f*x + e)^2 - 2*a*b*sin(f*x + e) - a^2 - b^2 + 2*(a*cos(f*x 
 + e)*sin(f*x + e) + b*cos(f*x + e))*sqrt(-a^2 + b^2))/(b^2*cos(f*x + e)^2 
 - 2*a*b*sin(f*x + e) - a^2 - b^2)))/((a^2*b^2 - b^4)*f), -((a^2*b - b^3)* 
d^2*cos(f*x + e) - (2*(a^2*b - b^3)*c*d - (a^3 - a*b^2)*d^2)*f*x + (b^2*c^ 
2 - 2*a*b*c*d + a^2*d^2)*sqrt(a^2 - b^2)*arctan(-(a*sin(f*x + e) + b)/(sqr 
t(a^2 - b^2)*cos(f*x + e))))/((a^2*b^2 - b^4)*f)]
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 4032 vs. \(2 (78) = 156\).

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

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

Output:

Piecewise((zoo*x*(c + d*sin(e))**2/sin(e), Eq(a, 0) & Eq(b, 0) & Eq(f, 0)) 
, ((c**2*log(tan(e/2 + f*x/2))*tan(e/2 + f*x/2)**2/(f*tan(e/2 + f*x/2)**2 
+ f) + c**2*log(tan(e/2 + f*x/2))/(f*tan(e/2 + f*x/2)**2 + f) + 2*c*d*f*x* 
tan(e/2 + f*x/2)**2/(f*tan(e/2 + f*x/2)**2 + f) + 2*c*d*f*x/(f*tan(e/2 + f 
*x/2)**2 + f) - 2*d**2/(f*tan(e/2 + f*x/2)**2 + f))/b, Eq(a, 0)), (2*b**2* 
c*d*f*x*tan(e/2 + f*x/2)**3/(b**3*f*tan(e/2 + f*x/2)**3 + b**3*f*tan(e/2 + 
 f*x/2) - f*(b**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(b**2)**(3/2)) + 2*b**2* 
c*d*f*x*tan(e/2 + f*x/2)/(b**3*f*tan(e/2 + f*x/2)**3 + b**3*f*tan(e/2 + f* 
x/2) - f*(b**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(b**2)**(3/2)) + 4*b**2*c*d 
*tan(e/2 + f*x/2)**2/(b**3*f*tan(e/2 + f*x/2)**3 + b**3*f*tan(e/2 + f*x/2) 
 - f*(b**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(b**2)**(3/2)) + 4*b**2*c*d/(b* 
*3*f*tan(e/2 + f*x/2)**3 + b**3*f*tan(e/2 + f*x/2) - f*(b**2)**(3/2)*tan(e 
/2 + f*x/2)**2 - f*(b**2)**(3/2)) - b**2*d**2*f*x*tan(e/2 + f*x/2)**2/(b** 
3*f*tan(e/2 + f*x/2)**3 + b**3*f*tan(e/2 + f*x/2) - f*(b**2)**(3/2)*tan(e/ 
2 + f*x/2)**2 - f*(b**2)**(3/2)) - b**2*d**2*f*x/(b**3*f*tan(e/2 + f*x/2)* 
*3 + b**3*f*tan(e/2 + f*x/2) - f*(b**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(b* 
*2)**(3/2)) - 2*b**2*d**2*tan(e/2 + f*x/2)/(b**3*f*tan(e/2 + f*x/2)**3 + b 
**3*f*tan(e/2 + f*x/2) - f*(b**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(b**2)**( 
3/2)) + 2*b*c**2*sqrt(b**2)*tan(e/2 + f*x/2)**2/(b**3*f*tan(e/2 + f*x/2)** 
3 + b**3*f*tan(e/2 + f*x/2) - f*(b**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(...
 

Maxima [F(-2)]

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

integrate((c+d*sin(f*x+e))^2/(a+b*sin(f*x+e)),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 [A] (verification not implemented)

Time = 0.34 (sec) , antiderivative size = 130, normalized size of antiderivative = 1.40 \[ \int \frac {(c+d \sin (e+f x))^2}{a+b \sin (e+f x)} \, dx=\frac {\frac {{\left (2 \, b c d - a d^{2}\right )} {\left (f x + e\right )}}{b^{2}} - \frac {2 \, d^{2}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1\right )} b} + \frac {2 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{\sqrt {a^{2} - b^{2}} b^{2}}}{f} \] Input:

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

Output:

((2*b*c*d - a*d^2)*(f*x + e)/b^2 - 2*d^2/((tan(1/2*f*x + 1/2*e)^2 + 1)*b) 
+ 2*(b^2*c^2 - 2*a*b*c*d + a^2*d^2)*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn( 
a) + arctan((a*tan(1/2*f*x + 1/2*e) + b)/sqrt(a^2 - b^2)))/(sqrt(a^2 - b^2 
)*b^2))/f
 

Mupad [B] (verification not implemented)

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

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

Output:

- (2*d^2)/(b*f*(tan(e/2 + (f*x)/2)^2 + 1)) - (atan((((-(a + b)*(a - b))^(1 
/2)*(a*d - b*c)^2*((32*(a^4*b*d^4 - 4*a^3*b^2*c*d^3 + 4*a^2*b^3*c^2*d^2))/ 
b^2 - (32*tan(e/2 + (f*x)/2)*(a*b^5*c^4 + 2*a^5*b*d^4 - 2*a^3*b^3*d^4 - 8* 
a*b^5*c^2*d^2 + 8*a^2*b^4*c*d^3 - 4*a^2*b^4*c^3*d - 8*a^4*b^2*c*d^3 + 10*a 
^3*b^3*c^2*d^2))/b^3 + ((-(a + b)*(a - b))^(1/2)*(a*d - b*c)^2*((32*(a^2*b 
^4*c^2 + a^2*b^4*d^2 - 2*a*b^5*c*d))/b^2 + (32*tan(e/2 + (f*x)/2)*(2*a*b^6 
*c^2 + 2*a^3*b^4*d^2 - 4*a^2*b^5*c*d))/b^3 + ((-(a + b)*(a - b))^(1/2)*(a* 
d - b*c)^2*(32*a^2*b^3 + (32*tan(e/2 + (f*x)/2)*(3*a*b^7 - 2*a^3*b^5))/b^3 
))/(b^4 - a^2*b^2)))/(b^4 - a^2*b^2))*1i)/(b^4 - a^2*b^2) - ((-(a + b)*(a 
- b))^(1/2)*(a*d - b*c)^2*((32*tan(e/2 + (f*x)/2)*(a*b^5*c^4 + 2*a^5*b*d^4 
 - 2*a^3*b^3*d^4 - 8*a*b^5*c^2*d^2 + 8*a^2*b^4*c*d^3 - 4*a^2*b^4*c^3*d - 8 
*a^4*b^2*c*d^3 + 10*a^3*b^3*c^2*d^2))/b^3 - (32*(a^4*b*d^4 - 4*a^3*b^2*c*d 
^3 + 4*a^2*b^3*c^2*d^2))/b^2 + ((-(a + b)*(a - b))^(1/2)*(a*d - b*c)^2*((3 
2*(a^2*b^4*c^2 + a^2*b^4*d^2 - 2*a*b^5*c*d))/b^2 + (32*tan(e/2 + (f*x)/2)* 
(2*a*b^6*c^2 + 2*a^3*b^4*d^2 - 4*a^2*b^5*c*d))/b^3 - ((-(a + b)*(a - b))^( 
1/2)*(a*d - b*c)^2*(32*a^2*b^3 + (32*tan(e/2 + (f*x)/2)*(3*a*b^7 - 2*a^3*b 
^5))/b^3))/(b^4 - a^2*b^2)))/(b^4 - a^2*b^2))*1i)/(b^4 - a^2*b^2))/((64*ta 
n(e/2 + (f*x)/2)*(2*a^5*d^6 + 8*a*b^4*c^4*d^2 - 24*a^2*b^3*c^3*d^3 + 26*a^ 
3*b^2*c^2*d^4 - 12*a^4*b*c*d^5))/b^3 - (64*(a^4*c^2*d^4 - 4*a^3*b*c^3*d^3 
+ 5*a^2*b^2*c^4*d^2 - 2*a*b^3*c^5*d))/b^2 + ((-(a + b)*(a - b))^(1/2)*(...
 

Reduce [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 219, normalized size of antiderivative = 2.35 \[ \int \frac {(c+d \sin (e+f x))^2}{a+b \sin (e+f x)} \, dx=\frac {2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) a +b}{\sqrt {a^{2}-b^{2}}}\right ) a^{2} d^{2}-4 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) a +b}{\sqrt {a^{2}-b^{2}}}\right ) a b c d +2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) a +b}{\sqrt {a^{2}-b^{2}}}\right ) b^{2} c^{2}-\cos \left (f x +e \right ) a^{2} b \,d^{2}+\cos \left (f x +e \right ) b^{3} d^{2}-a^{3} d^{2} f x +2 a^{2} b c d f x +a \,b^{2} d^{2} f x -2 b^{3} c d f x}{b^{2} f \left (a^{2}-b^{2}\right )} \] Input:

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

Output:

(2*sqrt(a**2 - b**2)*atan((tan((e + f*x)/2)*a + b)/sqrt(a**2 - b**2))*a**2 
*d**2 - 4*sqrt(a**2 - b**2)*atan((tan((e + f*x)/2)*a + b)/sqrt(a**2 - b**2 
))*a*b*c*d + 2*sqrt(a**2 - b**2)*atan((tan((e + f*x)/2)*a + b)/sqrt(a**2 - 
 b**2))*b**2*c**2 - cos(e + f*x)*a**2*b*d**2 + cos(e + f*x)*b**3*d**2 - a* 
*3*d**2*f*x + 2*a**2*b*c*d*f*x + a*b**2*d**2*f*x - 2*b**3*c*d*f*x)/(b**2*f 
*(a**2 - b**2))