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

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 {(a+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=-\frac {b (b c-2 a d) x}{d^2}+\frac {2 (b c-a d)^2 \arctan \left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{d^2 \sqrt {c^2-d^2} f}-\frac {b^2 \cos (e+f x)}{d f} \] Output:

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3225

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3214

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3139

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

\(\Big \downarrow \) 1083

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

\(\Big \downarrow \) 217

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

Input:

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

Output:

(-((b*(b*c - 2*a*d)*x)/d) + (2*(b*c - a*d)^2*ArcTan[(2*d + 2*c*Tan[(e + f* 
x)/2])/(2*Sqrt[c^2 - d^2])])/(d*Sqrt[c^2 - d^2]*f))/d - (b^2*Cos[e + f*x]) 
/(d*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.00 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.28

method result size
derivativedivides \(\frac {\frac {2 b \left (-\frac {b d}{1+\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}}+\left (2 a d -b c \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )\right )}{d^{2}}+\frac {2 \left (a^{2} d^{2}-2 a b c d +b^{2} c^{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 )}{d^{2} \sqrt {c^{2}-d^{2}}}}{f}\) \(119\)
default \(\frac {\frac {2 b \left (-\frac {b d}{1+\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}}+\left (2 a d -b c \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )\right )}{d^{2}}+\frac {2 \left (a^{2} d^{2}-2 a b c d +b^{2} c^{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 )}{d^{2} \sqrt {c^{2}-d^{2}}}}{f}\) \(119\)
risch \(\frac {2 b x a}{d}-\frac {b^{2} x c}{d^{2}}-\frac {b^{2} {\mathrm e}^{i \left (f x +e \right )}}{2 d f}-\frac {b^{2} {\mathrm e}^{-i \left (f x +e \right )}}{2 d f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c -c^{2}+d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) a^{2}}{\sqrt {-c^{2}+d^{2}}\, f}+\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c -c^{2}+d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) a b c}{\sqrt {-c^{2}+d^{2}}\, f d}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c -c^{2}+d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) b^{2} c^{2}}{\sqrt {-c^{2}+d^{2}}\, f \,d^{2}}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c +c^{2}-d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) a^{2}}{\sqrt {-c^{2}+d^{2}}\, f}-\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c +c^{2}-d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) a b c}{\sqrt {-c^{2}+d^{2}}\, f d}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-c^{2}+d^{2}}\, c +c^{2}-d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) b^{2} c^{2}}{\sqrt {-c^{2}+d^{2}}\, f \,d^{2}}\) \(490\)

Input:

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

Output:

1/f*(2*b/d^2*(-b*d/(1+tan(1/2*f*x+1/2*e)^2)+(2*a*d-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)/d^2/(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 = 375, normalized size of antiderivative = 4.03 \[ \int \frac {(a+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=\left [-\frac {2 \, {\left (b^{2} c^{3} - 2 \, a b c^{2} d - b^{2} c d^{2} + 2 \, a b d^{3}\right )} f x + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {-c^{2} + d^{2}} \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 (c \cos \left (f x + e\right ) \sin \left (f x + e\right ) + d \cos \left (f x + e\right )\right )} \sqrt {-c^{2} + d^{2}}}{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 (b^{2} c^{2} d - b^{2} d^{3}\right )} \cos \left (f x + e\right )}{2 \, {\left (c^{2} d^{2} - d^{4}\right )} f}, -\frac {{\left (b^{2} c^{3} - 2 \, a b c^{2} d - b^{2} c d^{2} + 2 \, a b d^{3}\right )} f x + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {c^{2} - d^{2}} \arctan \left (-\frac {c \sin \left (f x + e\right ) + d}{\sqrt {c^{2} - d^{2}} \cos \left (f x + e\right )}\right ) + {\left (b^{2} c^{2} d - b^{2} d^{3}\right )} \cos \left (f x + e\right )}{{\left (c^{2} d^{2} - d^{4}\right )} f}\right ] \] Input:

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

Output:

[-1/2*(2*(b^2*c^3 - 2*a*b*c^2*d - b^2*c*d^2 + 2*a*b*d^3)*f*x + (b^2*c^2 - 
2*a*b*c*d + a^2*d^2)*sqrt(-c^2 + d^2)*log(((2*c^2 - d^2)*cos(f*x + e)^2 - 
2*c*d*sin(f*x + e) - c^2 - d^2 + 2*(c*cos(f*x + e)*sin(f*x + e) + d*cos(f* 
x + e))*sqrt(-c^2 + d^2))/(d^2*cos(f*x + e)^2 - 2*c*d*sin(f*x + e) - c^2 - 
 d^2)) + 2*(b^2*c^2*d - b^2*d^3)*cos(f*x + e))/((c^2*d^2 - d^4)*f), -((b^2 
*c^3 - 2*a*b*c^2*d - b^2*c*d^2 + 2*a*b*d^3)*f*x + (b^2*c^2 - 2*a*b*c*d + a 
^2*d^2)*sqrt(c^2 - d^2)*arctan(-(c*sin(f*x + e) + d)/(sqrt(c^2 - d^2)*cos( 
f*x + e))) + (b^2*c^2*d - b^2*d^3)*cos(f*x + e))/((c^2*d^2 - d^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 = 147.31 (sec) , antiderivative size = 4032, normalized size of antiderivative = 43.35 \[ \int \frac {(a+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=\text {Too large to display} \] Input:

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

Output:

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

Maxima [F(-2)]

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

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

Giac [A] (verification not implemented)

Time = 0.14 (sec) , antiderivative size = 130, normalized size of antiderivative = 1.40 \[ \int \frac {(a+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=-\frac {\frac {{\left (b^{2} c - 2 \, a b d\right )} {\left (f x + e\right )}}{d^{2}} + \frac {2 \, b^{2}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1\right )} d} - \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 (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 )}}{\sqrt {c^{2} - d^{2}} d^{2}}}{f} \] Input:

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

Output:

-((b^2*c - 2*a*b*d)*(f*x + e)/d^2 + 2*b^2/((tan(1/2*f*x + 1/2*e)^2 + 1)*d) 
 - 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 
(c) + arctan((c*tan(1/2*f*x + 1/2*e) + d)/sqrt(c^2 - d^2)))/(sqrt(c^2 - d^ 
2)*d^2))/f
 

Mupad [B] (verification not implemented)

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

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

Output:

(2*b*atan((64*b^6*c^4*tan(e/2 + (f*x)/2))/(64*b^6*c^4 + 128*a^2*b^4*c^4 - 
512*a^3*b^3*c*d^3 - 512*a^3*b^3*c^3*d + 768*a^2*b^4*c^2*d^2 + 576*a^4*b^2* 
c^2*d^2 - 384*a*b^5*c^3*d - 128*a^5*b*c*d^3) + (384*a*b^5*c^3*tan(e/2 + (f 
*x)/2))/(384*a*b^5*c^3 + 512*a^3*b^3*c^3 - (64*b^6*c^4)/d - 768*a^2*b^4*c^ 
2*d + 512*a^3*b^3*c*d^2 - 576*a^4*b^2*c^2*d - (128*a^2*b^4*c^4)/d + 128*a^ 
5*b*c*d^2) + (768*a^2*b^4*c^2*tan(e/2 + (f*x)/2))/(768*a^2*b^4*c^2 + 576*a 
^4*b^2*c^2 + (64*b^6*c^4)/d^2 - (384*a*b^5*c^3)/d - 128*a^5*b*c*d - (512*a 
^3*b^3*c^3)/d + (128*a^2*b^4*c^4)/d^2 - 512*a^3*b^3*c*d) + (576*a^4*b^2*c^ 
2*tan(e/2 + (f*x)/2))/(768*a^2*b^4*c^2 + 576*a^4*b^2*c^2 + (64*b^6*c^4)/d^ 
2 - (384*a*b^5*c^3)/d - 128*a^5*b*c*d - (512*a^3*b^3*c^3)/d + (128*a^2*b^4 
*c^4)/d^2 - 512*a^3*b^3*c*d) + (512*a^3*b^3*c^3*tan(e/2 + (f*x)/2))/(384*a 
*b^5*c^3 + 512*a^3*b^3*c^3 - (64*b^6*c^4)/d - 768*a^2*b^4*c^2*d + 512*a^3* 
b^3*c*d^2 - 576*a^4*b^2*c^2*d - (128*a^2*b^4*c^4)/d + 128*a^5*b*c*d^2) + ( 
128*a^2*b^4*c^4*tan(e/2 + (f*x)/2))/(64*b^6*c^4 + 128*a^2*b^4*c^4 - 512*a^ 
3*b^3*c*d^3 - 512*a^3*b^3*c^3*d + 768*a^2*b^4*c^2*d^2 + 576*a^4*b^2*c^2*d^ 
2 - 384*a*b^5*c^3*d - 128*a^5*b*c*d^3) - (128*a^5*b*c*d*tan(e/2 + (f*x)/2) 
)/(768*a^2*b^4*c^2 + 576*a^4*b^2*c^2 + (64*b^6*c^4)/d^2 - (384*a*b^5*c^3)/ 
d - 128*a^5*b*c*d - (512*a^3*b^3*c^3)/d + (128*a^2*b^4*c^4)/d^2 - 512*a^3* 
b^3*c*d) - (512*a^3*b^3*c*d*tan(e/2 + (f*x)/2))/(768*a^2*b^4*c^2 + 576*a^4 
*b^2*c^2 + (64*b^6*c^4)/d^2 - (384*a*b^5*c^3)/d - 128*a^5*b*c*d - (512*...
 

Reduce [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 219, normalized size of antiderivative = 2.35 \[ \int \frac {(a+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=\frac {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 ) a^{2} d^{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 ) a b c d +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 ) b^{2} c^{2}-\cos \left (f x +e \right ) b^{2} c^{2} d +\cos \left (f x +e \right ) b^{2} d^{3}+2 a b \,c^{2} d f x -2 a b \,d^{3} f x -b^{2} c^{3} f x +b^{2} c \,d^{2} f x}{d^{2} f \left (c^{2}-d^{2}\right )} \] Input:

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

Output:

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