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

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [F(-1)]
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 = 112 \[ \int \frac {(a+a \sin (e+f x))^2}{(c+d \sin (e+f x))^2} \, dx=\frac {a^2 x}{d^2}-\frac {2 a^2 (c-d)^2 (c+2 d) \arctan \left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{d^2 \left (c^2-d^2\right )^{3/2} f}+\frac {a^2 (c-d) \cos (e+f x)}{d (c+d) f (c+d \sin (e+f x))} \] Output:

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.52 (sec) , antiderivative size = 128, normalized size of antiderivative = 1.14, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.360, Rules used = {3042, 3241, 25, 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 {(a \sin (e+f x)+a)^2}{(c+d \sin (e+f x))^2} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3241

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3214

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3139

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

\(\Big \downarrow \) 1083

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

\(\Big \downarrow \) 217

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

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 3241
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + 
(f_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b^2)*(b*c - a*d)*Cos[e + f*x]*(a + b 
*Sin[e + f*x])^(m - 2)*((c + d*Sin[e + f*x])^(n + 1)/(d*f*(n + 1)*(b*c + a* 
d))), x] + Simp[b^2/(d*(n + 1)*(b*c + a*d))   Int[(a + b*Sin[e + f*x])^(m - 
 2)*(c + d*Sin[e + f*x])^(n + 1)*Simp[a*c*(m - 2) - b*d*(m - 2*n - 4) - (b* 
c*(m - 1) - a*d*(m + 2*n + 1))*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, 
d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] 
 && GtQ[m, 1] && LtQ[n, -1] && (IntegersQ[2*m, 2*n] || IntegerQ[m + 1/2] || 
 (IntegerQ[m] && EqQ[c, 0]))
 
Maple [A] (verified)

Time = 0.64 (sec) , antiderivative size = 160, normalized size of antiderivative = 1.43

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

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F(-1)]

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

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

Output:

Timed out
 

Maxima [F(-2)]

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

integrate((a+a*sin(f*x+e))^2/(c+d*sin(f*x+e))^2,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*d^2-4*c^2>0)', see `assume?` f 
or more de
 

Giac [A] (verification not implemented)

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

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

Output:

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

Mupad [B] (verification not implemented)

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

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

Output:

((2*(a^2*c - a^2*d))/(d*(c + d)) + (2*a^2*tan(e/2 + (f*x)/2)*(c - d))/(c*( 
c + d)))/(f*(c + 2*d*tan(e/2 + (f*x)/2) + c*tan(e/2 + (f*x)/2)^2)) + (2*a^ 
2*atan((192*a^6*c^3*d*tan(e/2 + (f*x)/2))/((128*a^6*c^3*d^5)/(2*c*d^3 + d^ 
4 + c^2*d^2) - (512*a^6*c^2*d^6)/(2*c*d^3 + d^4 + c^2*d^2) - (320*a^6*c*d^ 
7)/(2*c*d^3 + d^4 + c^2*d^2) + (512*a^6*c^4*d^4)/(2*c*d^3 + d^4 + c^2*d^2) 
 + (192*a^6*c^5*d^3)/(2*c*d^3 + d^4 + c^2*d^2)) - (320*a^6*c*d^3*tan(e/2 + 
 (f*x)/2))/((128*a^6*c^3*d^5)/(2*c*d^3 + d^4 + c^2*d^2) - (512*a^6*c^2*d^6 
)/(2*c*d^3 + d^4 + c^2*d^2) - (320*a^6*c*d^7)/(2*c*d^3 + d^4 + c^2*d^2) + 
(512*a^6*c^4*d^4)/(2*c*d^3 + d^4 + c^2*d^2) + (192*a^6*c^5*d^3)/(2*c*d^3 + 
 d^4 + c^2*d^2)) + (128*a^6*c^2*d^2*tan(e/2 + (f*x)/2))/((128*a^6*c^3*d^5) 
/(2*c*d^3 + d^4 + c^2*d^2) - (512*a^6*c^2*d^6)/(2*c*d^3 + d^4 + c^2*d^2) - 
 (320*a^6*c*d^7)/(2*c*d^3 + d^4 + c^2*d^2) + (512*a^6*c^4*d^4)/(2*c*d^3 + 
d^4 + c^2*d^2) + (192*a^6*c^5*d^3)/(2*c*d^3 + d^4 + c^2*d^2))))/(d^2*f) + 
(a^2*atan(((a^2*(-(c + d)^3*(c - d))^(1/2)*(c + 2*d)*((32*(a^4*c^4*d + a^4 
*c^2*d^3 + 2*a^4*c^3*d^2))/(2*c*d^3 + d^4 + c^2*d^2) - (32*tan(e/2 + (f*x) 
/2)*(2*a^4*c*d^5 + 2*a^4*c^5*d - 8*a^4*c^2*d^4 - 4*a^4*c^3*d^3 + 4*a^4*c^4 
*d^2))/(2*c*d^4 + d^5 + c^2*d^3) + (a^2*(-(c + d)^3*(c - d))^(1/2)*(c + 2* 
d)*((32*tan(e/2 + (f*x)/2)*(4*a^2*c*d^7 + 2*a^2*c^2*d^6 - 4*a^2*c^3*d^5 - 
2*a^2*c^4*d^4))/(2*c*d^4 + d^5 + c^2*d^3) - (32*(a^2*c*d^6 - a^2*c^3*d^4)) 
/(2*c*d^3 + d^4 + c^2*d^2) + (a^2*((32*(c^2*d^7 + 2*c^3*d^6 + c^4*d^5))...
 

Reduce [B] (verification not implemented)

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

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

Output:

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