Integrand size = 16, antiderivative size = 107 \[ \int \cos ^2\left (\frac {a+b x}{c+d x}\right ) \, dx=\frac {(c+d x) \cos ^2\left (\frac {a+b x}{c+d x}\right )}{d}-\frac {(b c-a d) \operatorname {CosIntegral}\left (\frac {2 (b c-a d)}{d (c+d x)}\right ) \sin \left (\frac {2 b}{d}\right )}{d^2}+\frac {(b c-a d) \cos \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 (b c-a d)}{d (c+d x)}\right )}{d^2} \] Output:
(d*x+c)*cos((b*x+a)/(d*x+c))^2/d-(-a*d+b*c)*Ci(2*(-a*d+b*c)/d/(d*x+c))*sin (2*b/d)/d^2+(-a*d+b*c)*cos(2*b/d)*Si(2*(-a*d+b*c)/d/(d*x+c))/d^2
Result contains complex when optimal does not.
Time = 3.59 (sec) , antiderivative size = 497, normalized size of antiderivative = 4.64 \[ \int \cos ^2\left (\frac {a+b x}{c+d x}\right ) \, dx=\frac {c d e^{-\frac {2 i (a+b x)}{c+d x}}+c d e^{\frac {2 i (a+b x)}{c+d x}}+2 d^2 x+2 d^2 x \cos \left (\frac {2 b}{d}\right ) \cos \left (\frac {2 (-b c+a d)}{d (c+d x)}\right )-2 i (b c-a d) \operatorname {CosIntegral}\left (\frac {2 (-b c+a d)}{d (c+d x)}\right ) \left (\cos \left (\frac {2 b}{d}\right )-i \sin \left (\frac {2 b}{d}\right )\right )+2 i (b c-a d) \operatorname {CosIntegral}\left (\frac {2 b c-2 a d}{c d+d^2 x}\right ) \left (\cos \left (\frac {2 b}{d}\right )+i \sin \left (\frac {2 b}{d}\right )\right )-2 d^2 x \sin \left (\frac {2 b}{d}\right ) \sin \left (\frac {2 (-b c+a d)}{d (c+d x)}\right )-2 b c \cos \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 (-b c+a d)}{d (c+d x)}\right )+2 a d \cos \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 (-b c+a d)}{d (c+d x)}\right )-2 i b c \sin \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 (-b c+a d)}{d (c+d x)}\right )+2 i a d \sin \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 (-b c+a d)}{d (c+d x)}\right )+2 b c \cos \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 b c-2 a d}{c d+d^2 x}\right )-2 a d \cos \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 b c-2 a d}{c d+d^2 x}\right )-2 i b c \sin \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 b c-2 a d}{c d+d^2 x}\right )+2 i a d \sin \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 b c-2 a d}{c d+d^2 x}\right )}{4 d^2} \] Input:
Integrate[Cos[(a + b*x)/(c + d*x)]^2,x]
Output:
((c*d)/E^(((2*I)*(a + b*x))/(c + d*x)) + c*d*E^(((2*I)*(a + b*x))/(c + d*x )) + 2*d^2*x + 2*d^2*x*Cos[(2*b)/d]*Cos[(2*(-(b*c) + a*d))/(d*(c + d*x))] - (2*I)*(b*c - a*d)*CosIntegral[(2*(-(b*c) + a*d))/(d*(c + d*x))]*(Cos[(2* b)/d] - I*Sin[(2*b)/d]) + (2*I)*(b*c - a*d)*CosIntegral[(2*b*c - 2*a*d)/(c *d + d^2*x)]*(Cos[(2*b)/d] + I*Sin[(2*b)/d]) - 2*d^2*x*Sin[(2*b)/d]*Sin[(2 *(-(b*c) + a*d))/(d*(c + d*x))] - 2*b*c*Cos[(2*b)/d]*SinIntegral[(2*(-(b*c ) + a*d))/(d*(c + d*x))] + 2*a*d*Cos[(2*b)/d]*SinIntegral[(2*(-(b*c) + a*d ))/(d*(c + d*x))] - (2*I)*b*c*Sin[(2*b)/d]*SinIntegral[(2*(-(b*c) + a*d))/ (d*(c + d*x))] + (2*I)*a*d*Sin[(2*b)/d]*SinIntegral[(2*(-(b*c) + a*d))/(d* (c + d*x))] + 2*b*c*Cos[(2*b)/d]*SinIntegral[(2*b*c - 2*a*d)/(c*d + d^2*x) ] - 2*a*d*Cos[(2*b)/d]*SinIntegral[(2*b*c - 2*a*d)/(c*d + d^2*x)] - (2*I)* b*c*Sin[(2*b)/d]*SinIntegral[(2*b*c - 2*a*d)/(c*d + d^2*x)] + (2*I)*a*d*Si n[(2*b)/d]*SinIntegral[(2*b*c - 2*a*d)/(c*d + d^2*x)])/(4*d^2)
Time = 0.60 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.07, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.625, Rules used = {5075, 3042, 3794, 27, 3042, 3784, 25, 3042, 3780, 3783}
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 \cos ^2\left (\frac {a+b x}{c+d x}\right ) \, dx\) |
\(\Big \downarrow \) 5075 |
\(\displaystyle -\frac {\int (c+d x)^2 \cos ^2\left (\frac {b}{d}-\frac {b c-a d}{d (c+d x)}\right )d\frac {1}{c+d x}}{d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {\int (c+d x)^2 \sin \left (\frac {b}{d}-\frac {b c-a d}{d (c+d x)}+\frac {\pi }{2}\right )^2d\frac {1}{c+d x}}{d}\) |
\(\Big \downarrow \) 3794 |
\(\displaystyle -\frac {-\frac {2 (b c-a d) \int -\frac {1}{2} (c+d x) \sin \left (\frac {2 b}{d}-\frac {2 (b c-a d)}{d (c+d x)}\right )d\frac {1}{c+d x}}{d}-\left ((c+d x) \cos ^2\left (\frac {b}{d}-\frac {b c-a d}{d (c+d x)}\right )\right )}{d}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle -\frac {\frac {(b c-a d) \int (c+d x) \sin \left (\frac {2 b}{d}-\frac {2 (b c-a d)}{d (c+d x)}\right )d\frac {1}{c+d x}}{d}-(c+d x) \cos ^2\left (\frac {b}{d}-\frac {b c-a d}{d (c+d x)}\right )}{d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {\frac {(b c-a d) \int (c+d x) \sin \left (\frac {2 b}{d}-\frac {2 (b c-a d)}{d (c+d x)}\right )d\frac {1}{c+d x}}{d}-(c+d x) \cos ^2\left (\frac {b}{d}-\frac {b c-a d}{d (c+d x)}\right )}{d}\) |
\(\Big \downarrow \) 3784 |
\(\displaystyle -\frac {\frac {(b c-a d) \left (\sin \left (\frac {2 b}{d}\right ) \int (c+d x) \cos \left (\frac {2 (b c-a d)}{d (c+d x)}\right )d\frac {1}{c+d x}+\cos \left (\frac {2 b}{d}\right ) \int -\left ((c+d x) \sin \left (\frac {2 (b c-a d)}{d (c+d x)}\right )\right )d\frac {1}{c+d x}\right )}{d}-(c+d x) \cos ^2\left (\frac {b}{d}-\frac {b c-a d}{d (c+d x)}\right )}{d}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle -\frac {\frac {(b c-a d) \left (\sin \left (\frac {2 b}{d}\right ) \int (c+d x) \cos \left (\frac {2 (b c-a d)}{d (c+d x)}\right )d\frac {1}{c+d x}-\cos \left (\frac {2 b}{d}\right ) \int (c+d x) \sin \left (\frac {2 (b c-a d)}{d (c+d x)}\right )d\frac {1}{c+d x}\right )}{d}-(c+d x) \cos ^2\left (\frac {b}{d}-\frac {b c-a d}{d (c+d x)}\right )}{d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {\frac {(b c-a d) \left (\sin \left (\frac {2 b}{d}\right ) \int (c+d x) \sin \left (\frac {2 (b c-a d)}{d (c+d x)}+\frac {\pi }{2}\right )d\frac {1}{c+d x}-\cos \left (\frac {2 b}{d}\right ) \int (c+d x) \sin \left (\frac {2 (b c-a d)}{d (c+d x)}\right )d\frac {1}{c+d x}\right )}{d}-(c+d x) \cos ^2\left (\frac {b}{d}-\frac {b c-a d}{d (c+d x)}\right )}{d}\) |
\(\Big \downarrow \) 3780 |
\(\displaystyle -\frac {\frac {(b c-a d) \left (\sin \left (\frac {2 b}{d}\right ) \int (c+d x) \sin \left (\frac {2 (b c-a d)}{d (c+d x)}+\frac {\pi }{2}\right )d\frac {1}{c+d x}-\cos \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 (b c-a d)}{d (c+d x)}\right )\right )}{d}-(c+d x) \cos ^2\left (\frac {b}{d}-\frac {b c-a d}{d (c+d x)}\right )}{d}\) |
\(\Big \downarrow \) 3783 |
\(\displaystyle -\frac {\frac {(b c-a d) \left (\sin \left (\frac {2 b}{d}\right ) \operatorname {CosIntegral}\left (\frac {2 (b c-a d)}{d (c+d x)}\right )-\cos \left (\frac {2 b}{d}\right ) \text {Si}\left (\frac {2 (b c-a d)}{d (c+d x)}\right )\right )}{d}-(c+d x) \cos ^2\left (\frac {b}{d}-\frac {b c-a d}{d (c+d x)}\right )}{d}\) |
Input:
Int[Cos[(a + b*x)/(c + d*x)]^2,x]
Output:
-((-((c + d*x)*Cos[b/d - (b*c - a*d)/(d*(c + d*x))]^2) + ((b*c - a*d)*(Cos Integral[(2*(b*c - a*d))/(d*(c + d*x))]*Sin[(2*b)/d] - Cos[(2*b)/d]*SinInt egral[(2*(b*c - a*d))/(d*(c + d*x))]))/d)/d)
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[SinInte gral[e + f*x]/d, x] /; FreeQ[{c, d, e, f}, x] && EqQ[d*e - c*f, 0]
Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[CosInte gral[e - Pi/2 + f*x]/d, x] /; FreeQ[{c, d, e, f}, x] && EqQ[d*(e - Pi/2) - c*f, 0]
Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[Cos[(d* e - c*f)/d] Int[Sin[c*(f/d) + f*x]/(c + d*x), x], x] + Simp[Sin[(d*e - c* f)/d] Int[Cos[c*(f/d) + f*x]/(c + d*x), x], x] /; FreeQ[{c, d, e, f}, x] && NeQ[d*e - c*f, 0]
Int[((c_.) + (d_.)*(x_))^(m_)*sin[(e_.) + (f_.)*(x_)]^(n_), x_Symbol] :> Si mp[(c + d*x)^(m + 1)*(Sin[e + f*x]^n/(d*(m + 1))), x] - Simp[f*(n/(d*(m + 1 ))) Int[ExpandTrigReduce[(c + d*x)^(m + 1), Cos[e + f*x]*Sin[e + f*x]^(n - 1), x], x], x] /; FreeQ[{c, d, e, f, m}, x] && IGtQ[n, 1] && GeQ[m, -2] & & LtQ[m, -1]
Int[Cos[((e_.)*((a_.) + (b_.)*(x_)))/((c_.) + (d_.)*(x_))]^(n_.), x_Symbol] :> Simp[-d^(-1) Subst[Int[Cos[b*(e/d) - e*(b*c - a*d)*(x/d)]^n/x^2, x], x, 1/(c + d*x)], x] /; FreeQ[{a, b, c, d}, x] && IGtQ[n, 0] && NeQ[b*c - a* d, 0]
Time = 0.62 (sec) , antiderivative size = 195, normalized size of antiderivative = 1.82
method | result | size |
derivativedivides | \(-\frac {\left (a d -c b \right ) \left (\frac {d^{2} \left (-\frac {2 \cos \left (\frac {2 a d -2 c b}{d \left (d x +c \right )}+\frac {2 b}{d}\right )}{\left (\left (\frac {b}{d}+\frac {a d -c b}{d \left (d x +c \right )}\right ) d -b \right ) d}-\frac {2 \left (\frac {2 \,\operatorname {Si}\left (\frac {2 a d -2 c b}{d \left (d x +c \right )}\right ) \cos \left (\frac {2 b}{d}\right )}{d}+\frac {2 \,\operatorname {Ci}\left (\frac {2 a d -2 c b}{d \left (d x +c \right )}\right ) \sin \left (\frac {2 b}{d}\right )}{d}\right )}{d}\right )}{4}-\frac {d}{2 \left (\left (\frac {b}{d}+\frac {a d -c b}{d \left (d x +c \right )}\right ) d -b \right )}\right )}{d^{2}}\) | \(195\) |
default | \(-\frac {\left (a d -c b \right ) \left (\frac {d^{2} \left (-\frac {2 \cos \left (\frac {2 a d -2 c b}{d \left (d x +c \right )}+\frac {2 b}{d}\right )}{\left (\left (\frac {b}{d}+\frac {a d -c b}{d \left (d x +c \right )}\right ) d -b \right ) d}-\frac {2 \left (\frac {2 \,\operatorname {Si}\left (\frac {2 a d -2 c b}{d \left (d x +c \right )}\right ) \cos \left (\frac {2 b}{d}\right )}{d}+\frac {2 \,\operatorname {Ci}\left (\frac {2 a d -2 c b}{d \left (d x +c \right )}\right ) \sin \left (\frac {2 b}{d}\right )}{d}\right )}{d}\right )}{4}-\frac {d}{2 \left (\left (\frac {b}{d}+\frac {a d -c b}{d \left (d x +c \right )}\right ) d -b \right )}\right )}{d^{2}}\) | \(195\) |
risch | \(-\frac {{\mathrm e}^{-\frac {2 i b}{d}} \operatorname {csgn}\left (\frac {a d -c b}{d \left (d x +c \right )}\right ) \pi a}{2 d}+\frac {{\mathrm e}^{-\frac {2 i b}{d}} \operatorname {csgn}\left (\frac {a d -c b}{d \left (d x +c \right )}\right ) \pi b c}{2 d^{2}}+\frac {{\mathrm e}^{-\frac {2 i b}{d}} \operatorname {Si}\left (\frac {2 a d -2 c b}{d \left (d x +c \right )}\right ) a}{d}-\frac {{\mathrm e}^{-\frac {2 i b}{d}} \operatorname {Si}\left (\frac {2 a d -2 c b}{d \left (d x +c \right )}\right ) b c}{d^{2}}-\frac {i {\mathrm e}^{-\frac {2 i b}{d}} \operatorname {expIntegral}_{1}\left (-\frac {2 i \left (a d -c b \right )}{d \left (d x +c \right )}\right ) a}{2 d}+\frac {i {\mathrm e}^{-\frac {2 i b}{d}} \operatorname {expIntegral}_{1}\left (-\frac {2 i \left (a d -c b \right )}{d \left (d x +c \right )}\right ) b c}{2 d^{2}}+\frac {i \operatorname {expIntegral}_{1}\left (-\frac {2 i \left (a d -c b \right )}{d \left (d x +c \right )}\right ) {\mathrm e}^{\frac {2 i b}{d}} a}{2 d}-\frac {i \operatorname {expIntegral}_{1}\left (-\frac {2 i \left (a d -c b \right )}{d \left (d x +c \right )}\right ) {\mathrm e}^{\frac {2 i b}{d}} c b}{2 d^{2}}+\frac {x}{2}+\frac {\cos \left (\frac {2 b x +2 a}{d x +c}\right ) x}{2}+\frac {\cos \left (\frac {2 b x +2 a}{d x +c}\right ) c}{2 d}\) | \(339\) |
Input:
int(cos((b*x+a)/(d*x+c))^2,x,method=_RETURNVERBOSE)
Output:
-1/d^2*(a*d-b*c)*(1/4*d^2*(-2*cos(2*(a*d-b*c)/d/(d*x+c)+2*b/d)/((b/d+(a*d- b*c)/d/(d*x+c))*d-b)/d-2*(2*Si(2*(a*d-b*c)/d/(d*x+c))*cos(2*b/d)/d+2*Ci(2* (a*d-b*c)/d/(d*x+c))*sin(2*b/d)/d)/d)-1/2*d/((b/d+(a*d-b*c)/d/(d*x+c))*d-b ))
Time = 0.09 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.02 \[ \int \cos ^2\left (\frac {a+b x}{c+d x}\right ) \, dx=\frac {{\left (d^{2} x + c d\right )} \cos \left (\frac {b x + a}{d x + c}\right )^{2} - {\left (b c - a d\right )} \operatorname {Ci}\left (-\frac {2 \, {\left (b c - a d\right )}}{d^{2} x + c d}\right ) \sin \left (\frac {2 \, b}{d}\right ) - {\left (b c - a d\right )} \cos \left (\frac {2 \, b}{d}\right ) \operatorname {Si}\left (-\frac {2 \, {\left (b c - a d\right )}}{d^{2} x + c d}\right )}{d^{2}} \] Input:
integrate(cos((b*x+a)/(d*x+c))^2,x, algorithm="fricas")
Output:
((d^2*x + c*d)*cos((b*x + a)/(d*x + c))^2 - (b*c - a*d)*cos_integral(-2*(b *c - a*d)/(d^2*x + c*d))*sin(2*b/d) - (b*c - a*d)*cos(2*b/d)*sin_integral( -2*(b*c - a*d)/(d^2*x + c*d)))/d^2
Timed out. \[ \int \cos ^2\left (\frac {a+b x}{c+d x}\right ) \, dx=\text {Timed out} \] Input:
integrate(cos((b*x+a)/(d*x+c))**2,x)
Output:
Timed out
\[ \int \cos ^2\left (\frac {a+b x}{c+d x}\right ) \, dx=\int { \cos \left (\frac {b x + a}{d x + c}\right )^{2} \,d x } \] Input:
integrate(cos((b*x+a)/(d*x+c))^2,x, algorithm="maxima")
Output:
1/2*x + 1/2*integrate(cos(2*(b*x + a)/(d*x + c)), x)
Leaf count of result is larger than twice the leaf count of optimal. 683 vs. \(2 (107) = 214\).
Time = 27.16 (sec) , antiderivative size = 683, normalized size of antiderivative = 6.38 \[ \int \cos ^2\left (\frac {a+b x}{c+d x}\right ) \, dx =\text {Too large to display} \] Input:
integrate(cos((b*x+a)/(d*x+c))^2,x, algorithm="giac")
Output:
-1/2*(2*b^3*c^2*cos_integral(-2*(b - (b*x + a)*d/(d*x + c))/d)*sin(2*b/d) - 4*a*b^2*c*d*cos_integral(-2*(b - (b*x + a)*d/(d*x + c))/d)*sin(2*b/d) - 2*(b*x + a)*b^2*c^2*d*cos_integral(-2*(b - (b*x + a)*d/(d*x + c))/d)*sin(2 *b/d)/(d*x + c) + 2*a^2*b*d^2*cos_integral(-2*(b - (b*x + a)*d/(d*x + c))/ d)*sin(2*b/d) + 4*(b*x + a)*a*b*c*d^2*cos_integral(-2*(b - (b*x + a)*d/(d* x + c))/d)*sin(2*b/d)/(d*x + c) - 2*(b*x + a)*a^2*d^3*cos_integral(-2*(b - (b*x + a)*d/(d*x + c))/d)*sin(2*b/d)/(d*x + c) - 2*b^3*c^2*cos(2*b/d)*sin _integral(2*(b - (b*x + a)*d/(d*x + c))/d) + 4*a*b^2*c*d*cos(2*b/d)*sin_in tegral(2*(b - (b*x + a)*d/(d*x + c))/d) + 2*(b*x + a)*b^2*c^2*d*cos(2*b/d) *sin_integral(2*(b - (b*x + a)*d/(d*x + c))/d)/(d*x + c) - 2*a^2*b*d^2*cos (2*b/d)*sin_integral(2*(b - (b*x + a)*d/(d*x + c))/d) - 4*(b*x + a)*a*b*c* d^2*cos(2*b/d)*sin_integral(2*(b - (b*x + a)*d/(d*x + c))/d)/(d*x + c) + 2 *(b*x + a)*a^2*d^3*cos(2*b/d)*sin_integral(2*(b - (b*x + a)*d/(d*x + c))/d )/(d*x + c) - b^2*c^2*d*cos(2*(b*x + a)/(d*x + c)) + 2*a*b*c*d^2*cos(2*(b* x + a)/(d*x + c)) - a^2*d^3*cos(2*(b*x + a)/(d*x + c)) - b^2*c^2*d + 2*a*b *c*d^2 - a^2*d^3)*(b*c/(b*c - a*d)^2 - a*d/(b*c - a*d)^2)/(b*d^2 - (b*x + a)*d^3/(d*x + c))
Timed out. \[ \int \cos ^2\left (\frac {a+b x}{c+d x}\right ) \, dx=\int {\cos \left (\frac {a+b\,x}{c+d\,x}\right )}^2 \,d x \] Input:
int(cos((a + b*x)/(c + d*x))^2,x)
Output:
int(cos((a + b*x)/(c + d*x))^2, x)
\[ \int \cos ^2\left (\frac {a+b x}{c+d x}\right ) \, dx=\int \cos \left (\frac {b x +a}{d x +c}\right )^{2}d x \] Input:
int(cos((b*x+a)/(d*x+c))^2,x)
Output:
int(cos((a + b*x)/(c + d*x))**2,x)