\(\int \frac {\sec (c+d x) (A+B \sec (c+d x)+C \sec ^2(c+d x))}{a+a \sec (c+d x)} \, dx\) [452]

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

Optimal result

Integrand size = 39, antiderivative size = 63 \[ \int \frac {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {(B-C) \text {arctanh}(\sin (c+d x))}{a d}+\frac {C \tan (c+d x)}{a d}+\frac {(A-B+C) \tan (c+d x)}{a d (1+\sec (c+d x))} \] Output:

(B-C)*arctanh(sin(d*x+c))/a/d+C*tan(d*x+c)/a/d+(A-B+C)*tan(d*x+c)/a/d/(1+s 
ec(d*x+c))
 

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(255\) vs. \(2(63)=126\).

Time = 1.93 (sec) , antiderivative size = 255, normalized size of antiderivative = 4.05 \[ \int \frac {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {4 \cos \left (\frac {1}{2} (c+d x)\right ) \cos (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \left ((A-B+C) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right )+\cos \left (\frac {1}{2} (c+d x)\right ) \left (-\left ((B-C) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )\right )+\frac {C \sin (d x)}{\left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}\right )\right )}{a d (A+2 C+2 B \cos (c+d x)+A \cos (2 (c+d x))) (1+\sec (c+d x))} \] Input:

Integrate[(Sec[c + d*x]*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/(a + a*Se 
c[c + d*x]),x]
 

Output:

(4*Cos[(c + d*x)/2]*Cos[c + d*x]*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2)*( 
(A - B + C)*Sec[c/2]*Sin[(d*x)/2] + Cos[(c + d*x)/2]*(-((B - C)*(Log[Cos[( 
c + d*x)/2] - Sin[(c + d*x)/2]] - Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]] 
)) + (C*Sin[d*x])/((Cos[c/2] - Sin[c/2])*(Cos[c/2] + Sin[c/2])*(Cos[(c + d 
*x)/2] - Sin[(c + d*x)/2])*(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])))))/(a*d* 
(A + 2*C + 2*B*Cos[c + d*x] + A*Cos[2*(c + d*x)])*(1 + Sec[c + d*x]))
 

Rubi [A] (verified)

Time = 0.56 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.03, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {3042, 4570, 3042, 4486, 3042, 4257, 4281}

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 {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a \sec (c+d x)+a} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right ) \left (A+B \csc \left (c+d x+\frac {\pi }{2}\right )+C \csc \left (c+d x+\frac {\pi }{2}\right )^2\right )}{a \csc \left (c+d x+\frac {\pi }{2}\right )+a}dx\)

\(\Big \downarrow \) 4570

\(\displaystyle \frac {\int \frac {\sec (c+d x) (a A+a (B-C) \sec (c+d x))}{\sec (c+d x) a+a}dx}{a}+\frac {C \tan (c+d x)}{a d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {\csc \left (c+d x+\frac {\pi }{2}\right ) \left (a A+a (B-C) \csc \left (c+d x+\frac {\pi }{2}\right )\right )}{\csc \left (c+d x+\frac {\pi }{2}\right ) a+a}dx}{a}+\frac {C \tan (c+d x)}{a d}\)

\(\Big \downarrow \) 4486

\(\displaystyle \frac {a (A-B+C) \int \frac {\sec (c+d x)}{\sec (c+d x) a+a}dx+(B-C) \int \sec (c+d x)dx}{a}+\frac {C \tan (c+d x)}{a d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {a (A-B+C) \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right )}{\csc \left (c+d x+\frac {\pi }{2}\right ) a+a}dx+(B-C) \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{a}+\frac {C \tan (c+d x)}{a d}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {a (A-B+C) \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right )}{\csc \left (c+d x+\frac {\pi }{2}\right ) a+a}dx+\frac {(B-C) \text {arctanh}(\sin (c+d x))}{d}}{a}+\frac {C \tan (c+d x)}{a d}\)

\(\Big \downarrow \) 4281

\(\displaystyle \frac {\frac {a (A-B+C) \tan (c+d x)}{d (a \sec (c+d x)+a)}+\frac {(B-C) \text {arctanh}(\sin (c+d x))}{d}}{a}+\frac {C \tan (c+d x)}{a d}\)

Input:

Int[(Sec[c + d*x]*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/(a + a*Sec[c + 
d*x]),x]
 

Output:

(C*Tan[c + d*x])/(a*d) + (((B - C)*ArcTanh[Sin[c + d*x]])/d + (a*(A - B + 
C)*Tan[c + d*x])/(d*(a + a*Sec[c + d*x])))/a
 

Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 

rule 4281
Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbo 
l] :> Simp[-Cot[e + f*x]/(f*(b + a*Csc[e + f*x])), x] /; FreeQ[{a, b, e, f} 
, x] && EqQ[a^2 - b^2, 0]
 

rule 4486
Int[(csc[(e_.) + (f_.)*(x_)]*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)))/(csc[( 
e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[B/b   Int[Csc[e + f*x], 
 x], x] + Simp[(A*b - a*B)/b   Int[Csc[e + f*x]/(a + b*Csc[e + f*x]), x], x 
] /; FreeQ[{a, b, e, f, A, B}, x] && NeQ[A*b - a*B, 0]
 

rule 4570
Int[csc[(e_.) + (f_.)*(x_)]*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e 
_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_), x_S 
ymbol] :> Simp[(-C)*Cot[e + f*x]*((a + b*Csc[e + f*x])^(m + 1)/(b*f*(m + 2) 
)), x] + Simp[1/(b*(m + 2))   Int[Csc[e + f*x]*(a + b*Csc[e + f*x])^m*Simp[ 
b*A*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Csc[e + f*x], x], x], x] /; 
 FreeQ[{a, b, e, f, A, B, C, m}, x] &&  !LtQ[m, -1]
 
Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.48

method result size
parallelrisch \(\frac {-\cos \left (d x +c \right ) \left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\cos \left (d x +c \right ) \left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+\left (\left (A -B +2 C \right ) \cos \left (d x +c \right )+C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d \cos \left (d x +c \right )}\) \(93\)
derivativedivides \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C -\frac {C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-B +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d a}\) \(111\)
default \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C -\frac {C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-B +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d a}\) \(111\)
norman \(\frac {\frac {\left (A -B +C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{a d}+\frac {\left (A -B +3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}-\frac {2 \left (A -B +2 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{a d}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{2}}+\frac {\left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a d}-\frac {\left (B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a d}\) \(143\)
risch \(\frac {2 i \left (A \,{\mathrm e}^{2 i \left (d x +c \right )}-B \,{\mathrm e}^{2 i \left (d x +c \right )}+C \,{\mathrm e}^{2 i \left (d x +c \right )}+C \,{\mathrm e}^{i \left (d x +c \right )}+A -B +2 C \right )}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{a d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{a d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{a d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{a d}\) \(176\)

Input:

int(sec(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x,method=_ 
RETURNVERBOSE)
 

Output:

(-cos(d*x+c)*(B-C)*ln(tan(1/2*d*x+1/2*c)-1)+cos(d*x+c)*(B-C)*ln(tan(1/2*d* 
x+1/2*c)+1)+((A-B+2*C)*cos(d*x+c)+C)*tan(1/2*d*x+1/2*c))/a/d/cos(d*x+c)
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 128 vs. \(2 (63) = 126\).

Time = 0.08 (sec) , antiderivative size = 128, normalized size of antiderivative = 2.03 \[ \int \frac {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {{\left ({\left (B - C\right )} \cos \left (d x + c\right )^{2} + {\left (B - C\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left ({\left (B - C\right )} \cos \left (d x + c\right )^{2} + {\left (B - C\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left ({\left (A - B + 2 \, C\right )} \cos \left (d x + c\right ) + C\right )} \sin \left (d x + c\right )}{2 \, {\left (a d \cos \left (d x + c\right )^{2} + a d \cos \left (d x + c\right )\right )}} \] Input:

integrate(sec(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, a 
lgorithm="fricas")
 

Output:

1/2*(((B - C)*cos(d*x + c)^2 + (B - C)*cos(d*x + c))*log(sin(d*x + c) + 1) 
 - ((B - C)*cos(d*x + c)^2 + (B - C)*cos(d*x + c))*log(-sin(d*x + c) + 1) 
+ 2*((A - B + 2*C)*cos(d*x + c) + C)*sin(d*x + c))/(a*d*cos(d*x + c)^2 + a 
*d*cos(d*x + c))
 

Sympy [F]

\[ \int \frac {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {\int \frac {A \sec {\left (c + d x \right )}}{\sec {\left (c + d x \right )} + 1}\, dx + \int \frac {B \sec ^{2}{\left (c + d x \right )}}{\sec {\left (c + d x \right )} + 1}\, dx + \int \frac {C \sec ^{3}{\left (c + d x \right )}}{\sec {\left (c + d x \right )} + 1}\, dx}{a} \] Input:

integrate(sec(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)**2)/(a+a*sec(d*x+c)),x)
 

Output:

(Integral(A*sec(c + d*x)/(sec(c + d*x) + 1), x) + Integral(B*sec(c + d*x)* 
*2/(sec(c + d*x) + 1), x) + Integral(C*sec(c + d*x)**3/(sec(c + d*x) + 1), 
 x))/a
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 218 vs. \(2 (63) = 126\).

Time = 0.04 (sec) , antiderivative size = 218, normalized size of antiderivative = 3.46 \[ \int \frac {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=-\frac {C {\left (\frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} - \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} - \frac {2 \, \sin \left (d x + c\right )}{{\left (a - \frac {a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - B {\left (\frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} - \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - \frac {A \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}}{d} \] Input:

integrate(sec(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, a 
lgorithm="maxima")
 

Output:

-(C*(log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a - log(sin(d*x + c)/(cos(d* 
x + c) + 1) - 1)/a - 2*sin(d*x + c)/((a - a*sin(d*x + c)^2/(cos(d*x + c) + 
 1)^2)*(cos(d*x + c) + 1)) - sin(d*x + c)/(a*(cos(d*x + c) + 1))) - B*(log 
(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a - log(sin(d*x + c)/(cos(d*x + c) + 
 1) - 1)/a - sin(d*x + c)/(a*(cos(d*x + c) + 1))) - A*sin(d*x + c)/(a*(cos 
(d*x + c) + 1)))/d
                                                                                    
                                                                                    
 

Giac [A] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.89 \[ \int \frac {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {\frac {{\left (B - C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} - \frac {{\left (B - C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a} + \frac {A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a} - \frac {2 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} a}}{d} \] Input:

integrate(sec(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x, a 
lgorithm="giac")
 

Output:

((B - C)*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a - (B - C)*log(abs(tan(1/2*d* 
x + 1/2*c) - 1))/a + (A*tan(1/2*d*x + 1/2*c) - B*tan(1/2*d*x + 1/2*c) + C* 
tan(1/2*d*x + 1/2*c))/a - 2*C*tan(1/2*d*x + 1/2*c)/((tan(1/2*d*x + 1/2*c)^ 
2 - 1)*a))/d
 

Mupad [B] (verification not implemented)

Time = 12.30 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.25 \[ \int \frac {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A-B+C\right )}{a\,d}+\frac {2\,C\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a-a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\right )}+\frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (B-C\right )}{a\,d} \] Input:

int((A + B/cos(c + d*x) + C/cos(c + d*x)^2)/(cos(c + d*x)*(a + a/cos(c + d 
*x))),x)
 

Output:

(tan(c/2 + (d*x)/2)*(A - B + C))/(a*d) + (2*C*tan(c/2 + (d*x)/2))/(d*(a - 
a*tan(c/2 + (d*x)/2)^2)) + (2*atanh(tan(c/2 + (d*x)/2))*(B - C))/(a*d)
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 194, normalized size of antiderivative = 3.08 \[ \int \frac {\sec (c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {-\cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \sin \left (d x +c \right ) b +\cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \sin \left (d x +c \right ) c +\cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \sin \left (d x +c \right ) b -\cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \sin \left (d x +c \right ) c +\cos \left (d x +c \right ) a -\cos \left (d x +c \right ) b +\cos \left (d x +c \right ) c +\sin \left (d x +c \right )^{2} a -\sin \left (d x +c \right )^{2} b +2 \sin \left (d x +c \right )^{2} c -a +b -c}{\cos \left (d x +c \right ) \sin \left (d x +c \right ) a d} \] Input:

int(sec(d*x+c)*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c)),x)
 

Output:

( - cos(c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)*b + cos(c + d*x)*l 
og(tan((c + d*x)/2) - 1)*sin(c + d*x)*c + cos(c + d*x)*log(tan((c + d*x)/2 
) + 1)*sin(c + d*x)*b - cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x 
)*c + cos(c + d*x)*a - cos(c + d*x)*b + cos(c + d*x)*c + sin(c + d*x)**2*a 
 - sin(c + d*x)**2*b + 2*sin(c + d*x)**2*c - a + b - c)/(cos(c + d*x)*sin( 
c + d*x)*a*d)