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

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

Optimal result

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

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

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 1.04 (sec) , antiderivative size = 286, normalized size of antiderivative = 1.18 \[ \int \frac {d+e \sin (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\frac {\frac {\left (-2 i c d+\left (i b+\sqrt {-b^2+4 a c}\right ) e\right ) \arctan \left (\frac {2 c+\left (b-i \sqrt {-b^2+4 a c}\right ) \tan \left (\frac {x}{2}\right )}{\sqrt {2} \sqrt {b^2-2 c (a+c)-i b \sqrt {-b^2+4 a c}}}\right )}{\sqrt {b^2-2 c (a+c)-i b \sqrt {-b^2+4 a c}}}+\frac {\left (2 i c d+\left (-i b+\sqrt {-b^2+4 a c}\right ) e\right ) \arctan \left (\frac {2 c+\left (b+i \sqrt {-b^2+4 a c}\right ) \tan \left (\frac {x}{2}\right )}{\sqrt {2} \sqrt {b^2-2 c (a+c)+i b \sqrt {-b^2+4 a c}}}\right )}{\sqrt {b^2-2 c (a+c)+i b \sqrt {-b^2+4 a c}}}}{\sqrt {-\frac {b^2}{2}+2 a c}} \] Input:

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

Output:

((((-2*I)*c*d + (I*b + Sqrt[-b^2 + 4*a*c])*e)*ArcTan[(2*c + (b - I*Sqrt[-b 
^2 + 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a + c) - I*b*Sqrt[-b^2 + 4 
*a*c]])])/Sqrt[b^2 - 2*c*(a + c) - I*b*Sqrt[-b^2 + 4*a*c]] + (((2*I)*c*d + 
 ((-I)*b + Sqrt[-b^2 + 4*a*c])*e)*ArcTan[(2*c + (b + I*Sqrt[-b^2 + 4*a*c]) 
*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a + c) + I*b*Sqrt[-b^2 + 4*a*c]])])/Sq 
rt[b^2 - 2*c*(a + c) + I*b*Sqrt[-b^2 + 4*a*c]])/Sqrt[-1/2*b^2 + 2*a*c]
 

Rubi [A] (verified)

Time = 0.69 (sec) , antiderivative size = 250, normalized size of antiderivative = 1.03, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3042, 3773, 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 {d+e \sin (x)}{a+b \sin (x)+c \sin ^2(x)} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3773

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3139

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

\(\Big \downarrow \) 1083

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

\(\Big \downarrow \) 217

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

Input:

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

Output:

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

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 3773
Int[((A_) + (B_.)*sin[(d_.) + (e_.)*(x_)])/((a_.) + (b_.)*sin[(d_.) + (e_.) 
*(x_)] + (c_.)*sin[(d_.) + (e_.)*(x_)]^2), x_Symbol] :> Module[{q = Rt[b^2 
- 4*a*c, 2]}, Simp[(B + (b*B - 2*A*c)/q)   Int[1/(b + q + 2*c*Sin[d + e*x]) 
, x], x] + Simp[(B - (b*B - 2*A*c)/q)   Int[1/(b - q + 2*c*Sin[d + e*x]), x 
], x]] /; FreeQ[{a, b, c, d, e, A, B}, x] && NeQ[b^2 - 4*a*c, 0]
 
Maple [A] (verified)

Time = 1.50 (sec) , antiderivative size = 263, normalized size of antiderivative = 1.09

method result size
default \(2 a \left (-\frac {\sqrt {-4 a c +b^{2}}\, \left (\sqrt {-4 a c +b^{2}}\, d -2 a e +b d \right ) \arctan \left (\frac {2 a \tan \left (\frac {x}{2}\right )+b +\sqrt {-4 a c +b^{2}}}{\sqrt {4 a c -2 b^{2}-2 b \sqrt {-4 a c +b^{2}}+4 a^{2}}}\right )}{\left (4 a c -b^{2}\right ) a \sqrt {4 a c -2 b^{2}-2 b \sqrt {-4 a c +b^{2}}+4 a^{2}}}+\frac {\left (\sqrt {-4 a c +b^{2}}\, d +2 a e -b d \right ) \sqrt {-4 a c +b^{2}}\, \arctan \left (\frac {-2 a \tan \left (\frac {x}{2}\right )+\sqrt {-4 a c +b^{2}}-b}{\sqrt {4 a c -2 b^{2}+2 b \sqrt {-4 a c +b^{2}}+4 a^{2}}}\right )}{\left (4 a c -b^{2}\right ) a \sqrt {4 a c -2 b^{2}+2 b \sqrt {-4 a c +b^{2}}+4 a^{2}}}\right )\) \(263\)
risch \(\text {Expression too large to display}\) \(8331\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 6695 vs. \(2 (208) = 416\).

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

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

Output:

Too large to include
 

Sympy [F(-1)]

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

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

Output:

Timed out
 

Maxima [F]

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

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

Output:

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

Giac [F(-1)]

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

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

Output:

Timed out
 

Mupad [B] (verification not implemented)

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

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

Output:

atan(((-(b^4*d^2 - b^4*e^2 + 8*a*c^3*d^2 + b*d^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d^2 - 8 
*a^2*c^2*e^2 - 2*b^2*c^2*d^2 - 2*a*b^3*d*e - 2*a*d*e*(-(4*a*c - b^2)^3)^(1 
/2) + 2*b^3*c*d*e - 2*c*d*e*(-(4*a*c - b^2)^3)^(1/2) - 6*a*b^2*c*d^2 + 6*a 
*b^2*c*e^2 - 8*a*b*c^2*d*e + 8*a^2*b*c*d*e)/(2*(a^2*b^4 - b^6 + 16*a^2*c^4 
 + 32*a^3*c^3 + 16*a^4*c^2 + b^4*c^2 - 8*a*b^2*c^3 - 8*a^3*b^2*c - 32*a^2* 
b^2*c^2 + 10*a*b^4*c)))^(1/2)*(tan(x/2)*(96*a*b^4 + 256*a^4*c - 64*a^3*...
 

Reduce [F]

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

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

Output:

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