Integrand size = 22, antiderivative size = 119 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)+c \sin (x)} \, dx=\frac {(b B+c C) x}{b^2+c^2}-\frac {2 a (b B+c C) \arctan \left (\frac {c+(a-b) \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2-c^2}}\right )}{\sqrt {a^2-b^2-c^2} \left (b^2+c^2\right )}+\frac {(B c-b C) \log (a+b \cos (x)+c \sin (x))}{b^2+c^2} \] Output:
(B*b+C*c)*x/(b^2+c^2)-2*a*(B*b+C*c)*arctan((c+(a-b)*tan(1/2*x))/(a^2-b^2-c ^2)^(1/2))/(a^2-b^2-c^2)^(1/2)/(b^2+c^2)+(B*c-C*b)*ln(a+b*cos(x)+c*sin(x)) /(b^2+c^2)
Time = 0.45 (sec) , antiderivative size = 98, normalized size of antiderivative = 0.82 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)+c \sin (x)} \, dx=\frac {(b B+c C) x+\frac {2 a (b B+c C) \text {arctanh}\left (\frac {c+(a-b) \tan \left (\frac {x}{2}\right )}{\sqrt {-a^2+b^2+c^2}}\right )}{\sqrt {-a^2+b^2+c^2}}+(B c-b C) \log (a+b \cos (x)+c \sin (x))}{b^2+c^2} \] Input:
Integrate[(B*Cos[x] + C*Sin[x])/(a + b*Cos[x] + c*Sin[x]),x]
Output:
((b*B + c*C)*x + (2*a*(b*B + c*C)*ArcTanh[(c + (a - b)*Tan[x/2])/Sqrt[-a^2 + b^2 + c^2]])/Sqrt[-a^2 + b^2 + c^2] + (B*c - b*C)*Log[a + b*Cos[x] + c* Sin[x]])/(b^2 + c^2)
Time = 0.38 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.05, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.273, Rules used = {3042, 3615, 3042, 3603, 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 {B \cos (x)+C \sin (x)}{a+b \cos (x)+c \sin (x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)+c \sin (x)}dx\) |
\(\Big \downarrow \) 3615 |
\(\displaystyle -\frac {a (b B+c C) \int \frac {1}{a+b \cos (x)+c \sin (x)}dx}{b^2+c^2}+\frac {(B c-b C) \log (a+b \cos (x)+c \sin (x))}{b^2+c^2}+\frac {x (b B+c C)}{b^2+c^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {a (b B+c C) \int \frac {1}{a+b \cos (x)+c \sin (x)}dx}{b^2+c^2}+\frac {(B c-b C) \log (a+b \cos (x)+c \sin (x))}{b^2+c^2}+\frac {x (b B+c C)}{b^2+c^2}\) |
\(\Big \downarrow \) 3603 |
\(\displaystyle -\frac {2 a (b B+c C) \int \frac {1}{(a-b) \tan ^2\left (\frac {x}{2}\right )+2 c \tan \left (\frac {x}{2}\right )+a+b}d\tan \left (\frac {x}{2}\right )}{b^2+c^2}+\frac {(B c-b C) \log (a+b \cos (x)+c \sin (x))}{b^2+c^2}+\frac {x (b B+c C)}{b^2+c^2}\) |
\(\Big \downarrow \) 1083 |
\(\displaystyle \frac {4 a (b B+c C) \int \frac {1}{-\left (2 c+2 (a-b) \tan \left (\frac {x}{2}\right )\right )^2-4 \left (a^2-b^2-c^2\right )}d\left (2 c+2 (a-b) \tan \left (\frac {x}{2}\right )\right )}{b^2+c^2}+\frac {(B c-b C) \log (a+b \cos (x)+c \sin (x))}{b^2+c^2}+\frac {x (b B+c C)}{b^2+c^2}\) |
\(\Big \downarrow \) 217 |
\(\displaystyle -\frac {2 a (b B+c C) \arctan \left (\frac {2 (a-b) \tan \left (\frac {x}{2}\right )+2 c}{2 \sqrt {a^2-b^2-c^2}}\right )}{\left (b^2+c^2\right ) \sqrt {a^2-b^2-c^2}}+\frac {(B c-b C) \log (a+b \cos (x)+c \sin (x))}{b^2+c^2}+\frac {x (b B+c C)}{b^2+c^2}\) |
Input:
Int[(B*Cos[x] + C*Sin[x])/(a + b*Cos[x] + c*Sin[x]),x]
Output:
((b*B + c*C)*x)/(b^2 + c^2) - (2*a*(b*B + c*C)*ArcTan[(2*c + 2*(a - b)*Tan [x/2])/(2*Sqrt[a^2 - b^2 - c^2])])/(Sqrt[a^2 - b^2 - c^2]*(b^2 + c^2)) + ( (B*c - b*C)*Log[a + b*Cos[x] + c*Sin[x]])/(b^2 + c^2)
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[(cos[(d_.) + (e_.)*(x_)]*(b_.) + (a_) + (c_.)*sin[(d_.) + (e_.)*(x_)])^ (-1), x_Symbol] :> Module[{f = FreeFactors[Tan[(d + e*x)/2], x]}, Simp[2*(f /e) Subst[Int[1/(a + b + 2*c*f*x + (a - b)*f^2*x^2), x], x, Tan[(d + e*x) /2]/f], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[a^2 - b^2 - c^2, 0]
Int[((A_.) + cos[(d_.) + (e_.)*(x_)]*(B_.) + (C_.)*sin[(d_.) + (e_.)*(x_)]) /((a_.) + cos[(d_.) + (e_.)*(x_)]*(b_.) + (c_.)*sin[(d_.) + (e_.)*(x_)]), x _Symbol] :> Simp[(b*B + c*C)*(x/(b^2 + c^2)), x] + (Simp[(c*B - b*C)*(Log[a + b*Cos[d + e*x] + c*Sin[d + e*x]]/(e*(b^2 + c^2))), x] + Simp[(A*(b^2 + c ^2) - a*(b*B + c*C))/(b^2 + c^2) Int[1/(a + b*Cos[d + e*x] + c*Sin[d + e* x]), x], x]) /; FreeQ[{a, b, c, d, e, A, B, C}, x] && NeQ[b^2 + c^2, 0] && NeQ[A*(b^2 + c^2) - a*(b*B + c*C), 0]
Time = 0.33 (sec) , antiderivative size = 217, normalized size of antiderivative = 1.82
method | result | size |
default | \(\frac {\left (-B c +b C \right ) \ln \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )+2 \left (B b +C c \right ) \arctan \left (\tan \left (\frac {x}{2}\right )\right )}{b^{2}+c^{2}}+\frac {\frac {2 \left (a B c -b B c -a b C +b^{2} C \right ) \ln \left (\tan \left (\frac {x}{2}\right )^{2} a -b \tan \left (\frac {x}{2}\right )^{2}+2 c \tan \left (\frac {x}{2}\right )+a +b \right )}{2 a -2 b}+\frac {2 \left (-a b B +B \,c^{2}-a c C -C b c -\frac {\left (a B c -b B c -a b C +b^{2} C \right ) c}{a -b}\right ) \arctan \left (\frac {2 \left (a -b \right ) \tan \left (\frac {x}{2}\right )+2 c}{2 \sqrt {a^{2}-b^{2}-c^{2}}}\right )}{\sqrt {a^{2}-b^{2}-c^{2}}}}{b^{2}+c^{2}}\) | \(217\) |
risch | \(\text {Expression too large to display}\) | \(4907\) |
Input:
int((B*cos(x)+C*sin(x))/(a+b*cos(x)+c*sin(x)),x,method=_RETURNVERBOSE)
Output:
2/(b^2+c^2)*(1/2*(-B*c+C*b)*ln(1+tan(1/2*x)^2)+(B*b+C*c)*arctan(tan(1/2*x) ))+2/(b^2+c^2)*(1/2*(B*a*c-B*b*c-C*a*b+C*b^2)/(a-b)*ln(tan(1/2*x)^2*a-b*ta n(1/2*x)^2+2*c*tan(1/2*x)+a+b)+(-a*b*B+B*c^2-a*c*C-C*b*c-(B*a*c-B*b*c-C*a* b+C*b^2)*c/(a-b))/(a^2-b^2-c^2)^(1/2)*arctan(1/2*(2*(a-b)*tan(1/2*x)+2*c)/ (a^2-b^2-c^2)^(1/2)))
Leaf count of result is larger than twice the leaf count of optimal. 266 vs. \(2 (114) = 228\).
Time = 0.14 (sec) , antiderivative size = 687, normalized size of antiderivative = 5.77 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)+c \sin (x)} \, dx =\text {Too large to display} \] Input:
integrate((B*cos(x)+C*sin(x))/(a+b*cos(x)+c*sin(x)),x, algorithm="fricas")
Output:
[-1/2*((B*a*b + C*a*c)*sqrt(-a^2 + b^2 + c^2)*log((a^2*b^2 - 2*b^4 - c^4 - (a^2 + 3*b^2)*c^2 - (2*a^2*b^2 - b^4 - 2*a^2*c^2 + c^4)*cos(x)^2 - 2*(a*b ^3 + a*b*c^2)*cos(x) - 2*(a*b^2*c + a*c^3 - (b*c^3 - (2*a^2*b - b^3)*c)*co s(x))*sin(x) - 2*(2*a*b*c*cos(x)^2 - a*b*c + (b^2*c + c^3)*cos(x) - (b^3 + b*c^2 + (a*b^2 - a*c^2)*cos(x))*sin(x))*sqrt(-a^2 + b^2 + c^2))/(2*a*b*co s(x) + (b^2 - c^2)*cos(x)^2 + a^2 + c^2 + 2*(b*c*cos(x) + a*c)*sin(x))) - 2*(B*a^2*b - B*b^3 - B*b*c^2 - C*c^3 + (C*a^2 - C*b^2)*c)*x + (C*a^2*b - C *b^3 - C*b*c^2 + B*c^3 - (B*a^2 - B*b^2)*c)*log(2*a*b*cos(x) + (b^2 - c^2) *cos(x)^2 + a^2 + c^2 + 2*(b*c*cos(x) + a*c)*sin(x)))/(a^2*b^2 - b^4 - c^4 + (a^2 - 2*b^2)*c^2), -1/2*(2*(B*a*b + C*a*c)*sqrt(a^2 - b^2 - c^2)*arcta n(-(a*b*cos(x) + a*c*sin(x) + b^2 + c^2)*sqrt(a^2 - b^2 - c^2)/((c^3 - (a^ 2 - b^2)*c)*cos(x) + (a^2*b - b^3 - b*c^2)*sin(x))) - 2*(B*a^2*b - B*b^3 - B*b*c^2 - C*c^3 + (C*a^2 - C*b^2)*c)*x + (C*a^2*b - C*b^3 - C*b*c^2 + B*c ^3 - (B*a^2 - B*b^2)*c)*log(2*a*b*cos(x) + (b^2 - c^2)*cos(x)^2 + a^2 + c^ 2 + 2*(b*c*cos(x) + a*c)*sin(x)))/(a^2*b^2 - b^4 - c^4 + (a^2 - 2*b^2)*c^2 )]
Timed out. \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)+c \sin (x)} \, dx=\text {Timed out} \] Input:
integrate((B*cos(x)+C*sin(x))/(a+b*cos(x)+c*sin(x)),x)
Output:
Timed out
Exception generated. \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)+c \sin (x)} \, dx=\text {Exception raised: ValueError} \] Input:
integrate((B*cos(x)+C*sin(x))/(a+b*cos(x)+c*sin(x)),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(c^2+b^2-a^2>0)', see `assume?` f or more de
Time = 0.27 (sec) , antiderivative size = 187, normalized size of antiderivative = 1.57 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)+c \sin (x)} \, dx=\frac {{\left (B b + C c\right )} x}{b^{2} + c^{2}} - \frac {{\left (C b - B c\right )} \log \left (-a \tan \left (\frac {1}{2} \, x\right )^{2} + b \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, c \tan \left (\frac {1}{2} \, x\right ) - a - b\right )}{b^{2} + c^{2}} + \frac {{\left (C b - B c\right )} \log \left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )}{b^{2} + c^{2}} + \frac {2 \, {\left (B a b + C a c\right )} {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, x\right ) - b \tan \left (\frac {1}{2} \, x\right ) + c}{\sqrt {a^{2} - b^{2} - c^{2}}}\right )\right )}}{\sqrt {a^{2} - b^{2} - c^{2}} {\left (b^{2} + c^{2}\right )}} \] Input:
integrate((B*cos(x)+C*sin(x))/(a+b*cos(x)+c*sin(x)),x, algorithm="giac")
Output:
(B*b + C*c)*x/(b^2 + c^2) - (C*b - B*c)*log(-a*tan(1/2*x)^2 + b*tan(1/2*x) ^2 - 2*c*tan(1/2*x) - a - b)/(b^2 + c^2) + (C*b - B*c)*log(tan(1/2*x)^2 + 1)/(b^2 + c^2) + 2*(B*a*b + C*a*c)*(pi*floor(1/2*x/pi + 1/2)*sgn(-2*a + 2* b) + arctan(-(a*tan(1/2*x) - b*tan(1/2*x) + c)/sqrt(a^2 - b^2 - c^2)))/(sq rt(a^2 - b^2 - c^2)*(b^2 + c^2))
Time = 46.29 (sec) , antiderivative size = 1864, normalized size of antiderivative = 15.66 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)+c \sin (x)} \, dx=\text {Too large to display} \] Input:
int((B*cos(x) + C*sin(x))/(a + b*cos(x) + c*sin(x)),x)
Output:
(log(tan(x/2) - 1i)*(B + C*1i))/(b*1i - c) - (log(tan(x/2) + 1i)*(B - C*1i ))/(b*1i + c) - (log(32*B^3*a^2 + 32*B*C^2*a^2 + 32*B*C^2*b^2 + 32*tan(x/2 )*(a - b)*(2*C^3*a + B^3*c - 2*C^3*b + 2*B^2*C*a - B^2*C*b + 2*B*C^2*c) - 32*B^3*a*b - 64*B*C^2*a*b + 32*B^2*C*a*c - 32*B^2*C*b*c + ((C*b^3 - B*c^3 + B*a^2*c - C*a^2*b - B*b^2*c + C*b*c^2 + B*a*b*(b^2 - a^2 + c^2)^(1/2) + C*a*c*(b^2 - a^2 + c^2)^(1/2))*(32*B^2*b^2*c - 32*B^2*a^2*c + 32*C^2*a^2*c + 32*C^2*b^2*c + 32*tan(x/2)*(a - b)*(2*B^2*a^2 + B^2*b^2 - 2*C^2*a^2 - 3 *B^2*c^2 + 2*C^2*c^2 - 2*B^2*a*b + 2*C^2*a*b - 4*B*C*a*c + 6*B*C*b*c) - 12 8*B*C*a^3 - 64*B*C*b^3 + 192*B*C*a^2*b + 64*B*C*a*c^2 - 64*B*C*b*c^2 - 64* C^2*a*b*c + ((C*b^3 - B*c^3 + B*a^2*c - C*a^2*b - B*b^2*c + C*b*c^2 + B*a* b*(b^2 - a^2 + c^2)^(1/2) + C*a*c*(b^2 - a^2 + c^2)^(1/2))*(32*B*b^4 + 32* B*a^2*b^2 - 32*B*a^2*c^2 - 64*B*b^2*c^2 - 32*tan(x/2)*(a - b)*(B*c^3 - 2*C *b^3 + 2*C*a*b^2 + 4*B*b^2*c - 2*C*a*c^2 + C*b*c^2 - 4*B*a*b*c) - 64*B*a*b ^3 + 32*C*a*c^3 - 32*C*b*c^3 + 64*C*b^3*c + 96*B*a*b*c^2 - 128*C*a*b^2*c + 64*C*a^2*b*c + (32*(a - b)*(C*b^3 - B*c^3 + B*a^2*c - C*a^2*b - B*b^2*c + C*b*c^2 + B*a*b*(b^2 - a^2 + c^2)^(1/2) + C*a*c*(b^2 - a^2 + c^2)^(1/2))* (3*c^4*tan(x/2) + a*c^3 + 3*b*c^3 + 3*b^3*c + 2*a^2*b^2*tan(x/2) - 2*a^2*c ^2*tan(x/2) + 3*b^2*c^2*tan(x/2) - 2*a*b^3*tan(x/2) + a*b^2*c - 4*a^2*b*c - 2*a*b*c^2*tan(x/2)))/((b^2 + c^2)*(b^2 - a^2 + c^2))))/((b^2 + c^2)*(b^2 - a^2 + c^2))))/((b^2 + c^2)*(b^2 - a^2 + c^2)))*(C*b^3 - B*c^3 + B*a^...
Time = 0.19 (sec) , antiderivative size = 87, normalized size of antiderivative = 0.73 \[ \int \frac {B \cos (x)+C \sin (x)}{a+b \cos (x)+c \sin (x)} \, dx=\frac {-2 \sqrt {a^{2}-b^{2}-c^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {x}{2}\right ) a -\tan \left (\frac {x}{2}\right ) b +c}{\sqrt {a^{2}-b^{2}-c^{2}}}\right ) a +a^{2} x -b^{2} x -c^{2} x}{a^{2}-b^{2}-c^{2}} \] Input:
int((B*cos(x)+C*sin(x))/(a+b*cos(x)+c*sin(x)),x)
Output:
( - 2*sqrt(a**2 - b**2 - c**2)*atan((tan(x/2)*a - tan(x/2)*b + c)/sqrt(a** 2 - b**2 - c**2))*a + a**2*x - b**2*x - c**2*x)/(a**2 - b**2 - c**2)