Integrand size = 23, antiderivative size = 63 \[ \int \frac {a+a \sin (e+f x)}{c+d \sin (e+f x)} \, dx=\frac {a x}{d}-\frac {2 a (c-d) \arctan \left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{d \sqrt {c^2-d^2} f} \] Output:
a*x/d-2*a*(c-d)*arctan((d+c*tan(1/2*f*x+1/2*e))/(c^2-d^2)^(1/2))/d/(c^2-d^ 2)^(1/2)/f
Result contains complex when optimal does not.
Time = 1.17 (sec) , antiderivative size = 182, normalized size of antiderivative = 2.89 \[ \int \frac {a+a \sin (e+f x)}{c+d \sin (e+f x)} \, dx=\frac {a \left (-2 (c-d) \arctan \left (\frac {\sec \left (\frac {f x}{2}\right ) (\cos (e)-i \sin (e)) \left (d \cos \left (e+\frac {f x}{2}\right )+c \sin \left (\frac {f x}{2}\right )\right )}{\sqrt {c^2-d^2} \sqrt {(\cos (e)-i \sin (e))^2}}\right ) (\cos (e)-i \sin (e))+\sqrt {c^2-d^2} f x \sqrt {(\cos (e)-i \sin (e))^2}\right ) (1+\sin (e+f x))}{d \sqrt {c^2-d^2} f \sqrt {(\cos (e)-i \sin (e))^2} \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^2} \] Input:
Integrate[(a + a*Sin[e + f*x])/(c + d*Sin[e + f*x]),x]
Output:
(a*(-2*(c - d)*ArcTan[(Sec[(f*x)/2]*(Cos[e] - I*Sin[e])*(d*Cos[e + (f*x)/2 ] + c*Sin[(f*x)/2]))/(Sqrt[c^2 - d^2]*Sqrt[(Cos[e] - I*Sin[e])^2])]*(Cos[e ] - I*Sin[e]) + Sqrt[c^2 - d^2]*f*x*Sqrt[(Cos[e] - I*Sin[e])^2])*(1 + Sin[ e + f*x]))/(d*Sqrt[c^2 - d^2]*f*Sqrt[(Cos[e] - I*Sin[e])^2]*(Cos[(e + f*x) /2] + Sin[(e + f*x)/2])^2)
Time = 0.32 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.10, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {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}{c+d \sin (e+f x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {a \sin (e+f x)+a}{c+d \sin (e+f x)}dx\) |
\(\Big \downarrow \) 3214 |
\(\displaystyle \frac {a x}{d}-\frac {a (c-d) \int \frac {1}{c+d \sin (e+f x)}dx}{d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {a x}{d}-\frac {a (c-d) \int \frac {1}{c+d \sin (e+f x)}dx}{d}\) |
\(\Big \downarrow \) 3139 |
\(\displaystyle \frac {a x}{d}-\frac {2 a (c-d) \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}\) |
\(\Big \downarrow \) 1083 |
\(\displaystyle \frac {4 a (c-d) \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 {a x}{d}\) |
\(\Big \downarrow \) 217 |
\(\displaystyle \frac {a x}{d}-\frac {2 a (c-d) \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}}\) |
Input:
Int[(a + a*Sin[e + f*x])/(c + d*Sin[e + f*x]),x]
Output:
(a*x)/d - (2*a*(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)
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])
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]
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]
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]
Time = 0.40 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.14
method | result | size |
derivativedivides | \(\frac {2 a \left (\frac {\left (-c +d \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 \sqrt {c^{2}-d^{2}}}+\frac {\arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{d}\right )}{f}\) | \(72\) |
default | \(\frac {2 a \left (\frac {\left (-c +d \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 \sqrt {c^{2}-d^{2}}}+\frac {\arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{d}\right )}{f}\) | \(72\) |
risch | \(\frac {a x}{d}+\frac {\sqrt {-\left (c +d \right ) \left (c -d \right )}\, a \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 ) f d}-\frac {\sqrt {-\left (c +d \right ) \left (c -d \right )}\, a \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 ) f d}\) | \(125\) |
Input:
int((a+sin(f*x+e)*a)/(c+d*sin(f*x+e)),x,method=_RETURNVERBOSE)
Output:
2/f*a*((-c+d)/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))+1/d*arctan(tan(1/2*f*x+1/2*e)))
Time = 0.10 (sec) , antiderivative size = 228, normalized size of antiderivative = 3.62 \[ \int \frac {a+a \sin (e+f x)}{c+d \sin (e+f x)} \, dx=\left [\frac {2 \, a f x + a \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 \, d f}, \frac {a f x + a \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 )}{d f}\right ] \] Input:
integrate((a+a*sin(f*x+e))/(c+d*sin(f*x+e)),x, algorithm="fricas")
Output:
[1/2*(2*a*f*x + a*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))*sqrt(-(c - d)/(c + d)))/(d^2*cos(f*x + e)^2 - 2*c*d*sin(f*x + e) - c^2 - d^2)))/(d*f), (a*f*x + a*sqrt((c - d)/(c + d ))*arctan(-(c*sin(f*x + e) + d)*sqrt((c - d)/(c + d))/((c - d)*cos(f*x + e ))))/(d*f)]
Leaf count of result is larger than twice the leaf count of optimal. 314 vs. \(2 (49) = 98\).
Time = 14.13 (sec) , antiderivative size = 314, normalized size of antiderivative = 4.98 \[ \int \frac {a+a \sin (e+f x)}{c+d \sin (e+f x)} \, dx=\begin {cases} \frac {\tilde {\infty } x \left (a \sin {\left (e \right )} + a\right )}{\sin {\left (e \right )}} & \text {for}\: c = 0 \wedge d = 0 \wedge f = 0 \\\frac {a x + \frac {a \log {\left (\tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} \right )}}{f}}{d} & \text {for}\: c = 0 \\\frac {a x - \frac {a \cos {\left (e + f x \right )}}{f}}{c} & \text {for}\: d = 0 \\\frac {x \left (a \sin {\left (e \right )} + a\right )}{c + d \sin {\left (e \right )}} & \text {for}\: f = 0 \\\frac {a f x \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )}}{d f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - d f} - \frac {a f x}{d f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - d f} + \frac {4 a}{d f \tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} - d f} & \text {for}\: c = - d \\\frac {a x}{d} & \text {for}\: c = d \\- \frac {a c \log {\left (\tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} + \frac {d}{c} - \frac {\sqrt {- c^{2} + d^{2}}}{c} \right )}}{d f \sqrt {- c^{2} + d^{2}}} + \frac {a c \log {\left (\tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} + \frac {d}{c} + \frac {\sqrt {- c^{2} + d^{2}}}{c} \right )}}{d f \sqrt {- c^{2} + d^{2}}} + \frac {a \log {\left (\tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} + \frac {d}{c} - \frac {\sqrt {- c^{2} + d^{2}}}{c} \right )}}{f \sqrt {- c^{2} + d^{2}}} - \frac {a \log {\left (\tan {\left (\frac {e}{2} + \frac {f x}{2} \right )} + \frac {d}{c} + \frac {\sqrt {- c^{2} + d^{2}}}{c} \right )}}{f \sqrt {- c^{2} + d^{2}}} + \frac {a x}{d} & \text {otherwise} \end {cases} \] Input:
integrate((a+a*sin(f*x+e))/(c+d*sin(f*x+e)),x)
Output:
Piecewise((zoo*x*(a*sin(e) + a)/sin(e), Eq(c, 0) & Eq(d, 0) & Eq(f, 0)), ( (a*x + a*log(tan(e/2 + f*x/2))/f)/d, Eq(c, 0)), ((a*x - a*cos(e + f*x)/f)/ c, Eq(d, 0)), (x*(a*sin(e) + a)/(c + d*sin(e)), Eq(f, 0)), (a*f*x*tan(e/2 + f*x/2)/(d*f*tan(e/2 + f*x/2) - d*f) - a*f*x/(d*f*tan(e/2 + f*x/2) - d*f) + 4*a/(d*f*tan(e/2 + f*x/2) - d*f), Eq(c, -d)), (a*x/d, Eq(c, d)), (-a*c* log(tan(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)/(d*f*sqrt(-c**2 + d**2) ) + a*c*log(tan(e/2 + f*x/2) + d/c + sqrt(-c**2 + d**2)/c)/(d*f*sqrt(-c**2 + d**2)) + a*log(tan(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)/(f*sqrt(- c**2 + d**2)) - a*log(tan(e/2 + f*x/2) + d/c + sqrt(-c**2 + d**2)/c)/(f*sq rt(-c**2 + d**2)) + a*x/d, True))
Exception generated. \[ \int \frac {a+a \sin (e+f x)}{c+d \sin (e+f x)} \, dx=\text {Exception raised: ValueError} \] Input:
integrate((a+a*sin(f*x+e))/(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
Time = 0.13 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.32 \[ \int \frac {a+a \sin (e+f x)}{c+d \sin (e+f x)} \, dx=\frac {\frac {{\left (f x + e\right )} a}{d} - \frac {2 \, {\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 (a c - a d\right )}}{\sqrt {c^{2} - d^{2}} d}}{f} \] Input:
integrate((a+a*sin(f*x+e))/(c+d*sin(f*x+e)),x, algorithm="giac")
Output:
((f*x + e)*a/d - 2*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(c) + arctan((c*ta n(1/2*f*x + 1/2*e) + d)/sqrt(c^2 - d^2)))*(a*c - a*d)/(sqrt(c^2 - d^2)*d)) /f
Time = 16.77 (sec) , antiderivative size = 449, normalized size of antiderivative = 7.13 \[ \int \frac {a+a \sin (e+f x)}{c+d \sin (e+f x)} \, dx=\frac {2\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,\left (c+d\right )}-\frac {2\,a\,\mathrm {atanh}\left (\frac {3\,d^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,{\left (d^2-c^2\right )}^{3/2}-2\,c^4\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {d^2-c^2}-2\,c^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,{\left (d^2-c^2\right )}^{3/2}+d^4\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {d^2-c^2}+2\,c^2\,d^2\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {d^2-c^2}+3\,c^2\,d^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {d^2-c^2}+c\,d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,{\left (d^2-c^2\right )}^{3/2}+c\,d^3\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {d^2-c^2}+c^3\,d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {d^2-c^2}+4\,c\,d^3\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {d^2-c^2}-2\,c^3\,d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {d^2-c^2}}{2\,\left (d^2+c\,d\right )\,\left (\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,c^3+2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,c^2\,d-\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,c\,d^2-2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,d^3\right )}\right )\,\sqrt {d^2-c^2}}{d\,f\,\left (c+d\right )}+\frac {2\,a\,c\,\mathrm {atan}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{d\,f\,\left (c+d\right )} \] Input:
int((a + a*sin(e + f*x))/(c + d*sin(e + f*x)),x)
Output:
(2*a*atan(sin(e/2 + (f*x)/2)/cos(e/2 + (f*x)/2)))/(f*(c + d)) - (2*a*atanh ((3*d^2*sin(e/2 + (f*x)/2)*(d^2 - c^2)^(3/2) - 2*c^4*sin(e/2 + (f*x)/2)*(d ^2 - c^2)^(1/2) - 2*c^2*sin(e/2 + (f*x)/2)*(d^2 - c^2)^(3/2) + d^4*sin(e/2 + (f*x)/2)*(d^2 - c^2)^(1/2) + 2*c^2*d^2*cos(e/2 + (f*x)/2)*(d^2 - c^2)^( 1/2) + 3*c^2*d^2*sin(e/2 + (f*x)/2)*(d^2 - c^2)^(1/2) + c*d*cos(e/2 + (f*x )/2)*(d^2 - c^2)^(3/2) + c*d^3*cos(e/2 + (f*x)/2)*(d^2 - c^2)^(1/2) + c^3* d*cos(e/2 + (f*x)/2)*(d^2 - c^2)^(1/2) + 4*c*d^3*sin(e/2 + (f*x)/2)*(d^2 - c^2)^(1/2) - 2*c^3*d*sin(e/2 + (f*x)/2)*(d^2 - c^2)^(1/2))/(2*(c*d + d^2) *(c^3*cos(e/2 + (f*x)/2) - 2*d^3*sin(e/2 + (f*x)/2) - c*d^2*cos(e/2 + (f*x )/2) + 2*c^2*d*sin(e/2 + (f*x)/2))))*(d^2 - c^2)^(1/2))/(d*f*(c + d)) + (2 *a*c*atan(sin(e/2 + (f*x)/2)/cos(e/2 + (f*x)/2)))/(d*f*(c + d))
Time = 0.17 (sec) , antiderivative size = 61, normalized size of antiderivative = 0.97 \[ \int \frac {a+a \sin (e+f x)}{c+d \sin (e+f x)} \, dx=\frac {a \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 )+c f x +d f x \right )}{d f \left (c +d \right )} \] Input:
int((a+a*sin(f*x+e))/(c+d*sin(f*x+e)),x)
Output:
(a*( - 2*sqrt(c**2 - d**2)*atan((tan((e + f*x)/2)*c + d)/sqrt(c**2 - d**2) ) + c*f*x + d*f*x))/(d*f*(c + d))