\(\int f^{a+b x+c x^2} \cos (a+b x+e x^2) \, dx\) [146]

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

Optimal result

Integrand size = 24, antiderivative size = 209 \[ \int f^{a+b x+c x^2} \cos \left (a+b x+e x^2\right ) \, dx=\frac {e^{-\left ((i-\log (f)) \left (a-\frac {b^2 (i-\log (f))}{4 i e-4 c \log (f)}\right )\right )} \sqrt {\pi } \text {erf}\left (\frac {b (i-\log (f))+2 x (i e-c \log (f))}{2 \sqrt {i e-c \log (f)}}\right )}{4 \sqrt {i e-c \log (f)}}+\frac {e^{(i+\log (f)) \left (a-\frac {b^2 (i+\log (f))}{4 i e+4 c \log (f)}\right )} \sqrt {\pi } \text {erfi}\left (\frac {b (i+\log (f))+2 x (i e+c \log (f))}{2 \sqrt {i e+c \log (f)}}\right )}{4 \sqrt {i e+c \log (f)}} \] Output:

1/4*Pi^(1/2)*erf(1/2*(b*(I-ln(f))+2*x*(I*e-c*ln(f)))/(I*e-c*ln(f))^(1/2))/ 
exp((I-ln(f))*(a-b^2*(I-ln(f))/(4*I*e-4*c*ln(f))))/(I*e-c*ln(f))^(1/2)+1/4 
*exp((I+ln(f))*(a-b^2*(I+ln(f))/(4*I*e+4*c*ln(f))))*Pi^(1/2)*erfi(1/2*(b*( 
I+ln(f))+2*x*(I*e+c*ln(f)))/(I*e+c*ln(f))^(1/2))/(I*e+c*ln(f))^(1/2)
 

Mathematica [A] (warning: unable to verify)

Time = 1.32 (sec) , antiderivative size = 325, normalized size of antiderivative = 1.56 \[ \int f^{a+b x+c x^2} \cos \left (a+b x+e x^2\right ) \, dx=-\frac {i e^{-\frac {b^2 c \log ^3(f)}{2 \left (e^2+c^2 \log ^2(f)\right )}} f^{a-\frac {b^2}{2 (e-i c \log (f))}} \sqrt {\pi } \left (-e^{\frac {1}{4} b^2 \left (\frac {1}{-i e+c \log (f)}+\frac {\log ^2(f)}{i e+c \log (f)}\right )} f^{\frac {i b^2 c \log (f)}{e^2+c^2 \log ^2(f)}} \text {erfi}\left (\frac {-i (b+2 e x)+(b+2 c x) \log (f)}{2 \sqrt {-i e+c \log (f)}}\right ) (e-i c \log (f)) \sqrt {-i e+c \log (f)} (\cos (a)-i \sin (a))+e^{\frac {1}{4} b^2 \left (\frac {\log ^2(f)}{-i e+c \log (f)}+\frac {1}{i e+c \log (f)}\right )} \text {erfi}\left (\frac {i (b+2 e x)+(b+2 c x) \log (f)}{2 \sqrt {i e+c \log (f)}}\right ) (e+i c \log (f)) \sqrt {i e+c \log (f)} (\cos (a)+i \sin (a))\right )}{4 \left (e^2+c^2 \log ^2(f)\right )} \] Input:

Integrate[f^(a + b*x + c*x^2)*Cos[a + b*x + e*x^2],x]
 

Output:

((-1/4*I)*f^(a - b^2/(2*(e - I*c*Log[f])))*Sqrt[Pi]*(-(E^((b^2*(((-I)*e + 
c*Log[f])^(-1) + Log[f]^2/(I*e + c*Log[f])))/4)*f^((I*b^2*c*Log[f])/(e^2 + 
 c^2*Log[f]^2))*Erfi[((-I)*(b + 2*e*x) + (b + 2*c*x)*Log[f])/(2*Sqrt[(-I)* 
e + c*Log[f]])]*(e - I*c*Log[f])*Sqrt[(-I)*e + c*Log[f]]*(Cos[a] - I*Sin[a 
])) + E^((b^2*(Log[f]^2/((-I)*e + c*Log[f]) + (I*e + c*Log[f])^(-1)))/4)*E 
rfi[(I*(b + 2*e*x) + (b + 2*c*x)*Log[f])/(2*Sqrt[I*e + c*Log[f]])]*(e + I* 
c*Log[f])*Sqrt[I*e + c*Log[f]]*(Cos[a] + I*Sin[a])))/(E^((b^2*c*Log[f]^3)/ 
(2*(e^2 + c^2*Log[f]^2)))*(e^2 + c^2*Log[f]^2))
 

Rubi [A] (verified)

Time = 0.81 (sec) , antiderivative size = 209, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {4976, 2009}

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 f^{a+b x+c x^2} \cos \left (a+b x+e x^2\right ) \, dx\)

\(\Big \downarrow \) 4976

\(\displaystyle \int \left (\frac {1}{2} e^{-i a-i b x-i e x^2} f^{a+b x+c x^2}+\frac {1}{2} e^{i a+i b x+i e x^2} f^{a+b x+c x^2}\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {\sqrt {\pi } \exp \left (-\left ((-\log (f)+i) \left (a-\frac {b^2 (-\log (f)+i)}{-4 c \log (f)+4 i e}\right )\right )\right ) \text {erf}\left (\frac {b (-\log (f)+i)+2 x (-c \log (f)+i e)}{2 \sqrt {-c \log (f)+i e}}\right )}{4 \sqrt {-c \log (f)+i e}}+\frac {\sqrt {\pi } \exp \left ((\log (f)+i) \left (a-\frac {b^2 (\log (f)+i)}{4 c \log (f)+4 i e}\right )\right ) \text {erfi}\left (\frac {b (\log (f)+i)+2 x (c \log (f)+i e)}{2 \sqrt {c \log (f)+i e}}\right )}{4 \sqrt {c \log (f)+i e}}\)

Input:

Int[f^(a + b*x + c*x^2)*Cos[a + b*x + e*x^2],x]
 

Output:

(Sqrt[Pi]*Erf[(b*(I - Log[f]) + 2*x*(I*e - c*Log[f]))/(2*Sqrt[I*e - c*Log[ 
f]])])/(4*E^((I - Log[f])*(a - (b^2*(I - Log[f]))/((4*I)*e - 4*c*Log[f]))) 
*Sqrt[I*e - c*Log[f]]) + (E^((I + Log[f])*(a - (b^2*(I + Log[f]))/((4*I)*e 
 + 4*c*Log[f])))*Sqrt[Pi]*Erfi[(b*(I + Log[f]) + 2*x*(I*e + c*Log[f]))/(2* 
Sqrt[I*e + c*Log[f]])])/(4*Sqrt[I*e + c*Log[f]])
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 4976
Int[Cos[v_]^(n_.)*(F_)^(u_), x_Symbol] :> Int[ExpandTrigToExp[F^u, Cos[v]^n 
, x], x] /; FreeQ[F, x] && (LinearQ[u, x] || PolyQ[u, x, 2]) && (LinearQ[v, 
 x] || PolyQ[v, x, 2]) && IGtQ[n, 0]
 
Maple [A] (verified)

Time = 0.79 (sec) , antiderivative size = 215, normalized size of antiderivative = 1.03

method result size
risch \(-\frac {\sqrt {\pi }\, f^{a} {\mathrm e}^{-\frac {\ln \left (f \right )^{2} b^{2}+4 i \ln \left (f \right ) a c -2 i \ln \left (f \right ) b^{2}+4 a e -b^{2}}{4 \left (-i e +c \ln \left (f \right )\right )}} \operatorname {erf}\left (-\sqrt {i e -c \ln \left (f \right )}\, x +\frac {b \ln \left (f \right )-i b}{2 \sqrt {i e -c \ln \left (f \right )}}\right )}{4 \sqrt {i e -c \ln \left (f \right )}}-\frac {\sqrt {\pi }\, f^{a} {\mathrm e}^{\frac {-\ln \left (f \right )^{2} b^{2}+4 i \ln \left (f \right ) a c -2 i \ln \left (f \right ) b^{2}-4 a e +b^{2}}{4 i e +4 c \ln \left (f \right )}} \operatorname {erf}\left (-\sqrt {-c \ln \left (f \right )-i e}\, x +\frac {b \ln \left (f \right )+i b}{2 \sqrt {-c \ln \left (f \right )-i e}}\right )}{4 \sqrt {-c \ln \left (f \right )-i e}}\) \(215\)

Input:

int(f^(c*x^2+b*x+a)*cos(e*x^2+b*x+a),x,method=_RETURNVERBOSE)
 

Output:

-1/4*Pi^(1/2)*f^a*exp(-1/4*(ln(f)^2*b^2+4*I*ln(f)*a*c-2*I*ln(f)*b^2+4*a*e- 
b^2)/(-I*e+c*ln(f)))/(I*e-c*ln(f))^(1/2)*erf(-(I*e-c*ln(f))^(1/2)*x+1/2*(b 
*ln(f)-I*b)/(I*e-c*ln(f))^(1/2))-1/4*Pi^(1/2)*f^a*exp(1/4*(-ln(f)^2*b^2+4* 
I*ln(f)*a*c-2*I*ln(f)*b^2-4*a*e+b^2)/(I*e+c*ln(f)))/(-c*ln(f)-I*e)^(1/2)*e 
rf(-(-c*ln(f)-I*e)^(1/2)*x+1/2*(b*ln(f)+I*b)/(-c*ln(f)-I*e)^(1/2))
 

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 381 vs. \(2 (153) = 306\).

Time = 0.09 (sec) , antiderivative size = 381, normalized size of antiderivative = 1.82 \[ \int f^{a+b x+c x^2} \cos \left (a+b x+e x^2\right ) \, dx=-\frac {\sqrt {\pi } {\left (c \log \left (f\right ) - i \, e\right )} \sqrt {-c \log \left (f\right ) - i \, e} \operatorname {erf}\left (\frac {{\left (2 \, e^{2} x + {\left (2 \, c^{2} x + b c\right )} \log \left (f\right )^{2} + b e + {\left (i \, b c - i \, b e\right )} \log \left (f\right )\right )} \sqrt {-c \log \left (f\right ) - i \, e}}{2 \, {\left (c^{2} \log \left (f\right )^{2} + e^{2}\right )}}\right ) e^{\left (-\frac {{\left (b^{2} c - 4 \, a c^{2}\right )} \log \left (f\right )^{3} + i \, b^{2} e - 4 i \, a e^{2} - {\left (-2 i \, b^{2} c + 4 i \, a c^{2} + i \, b^{2} e\right )} \log \left (f\right )^{2} - {\left (b^{2} c - 2 \, b^{2} e + 4 \, a e^{2}\right )} \log \left (f\right )}{4 \, {\left (c^{2} \log \left (f\right )^{2} + e^{2}\right )}}\right )} + \sqrt {\pi } {\left (c \log \left (f\right ) + i \, e\right )} \sqrt {-c \log \left (f\right ) + i \, e} \operatorname {erf}\left (\frac {{\left (2 \, e^{2} x + {\left (2 \, c^{2} x + b c\right )} \log \left (f\right )^{2} + b e + {\left (-i \, b c + i \, b e\right )} \log \left (f\right )\right )} \sqrt {-c \log \left (f\right ) + i \, e}}{2 \, {\left (c^{2} \log \left (f\right )^{2} + e^{2}\right )}}\right ) e^{\left (-\frac {{\left (b^{2} c - 4 \, a c^{2}\right )} \log \left (f\right )^{3} - i \, b^{2} e + 4 i \, a e^{2} - {\left (2 i \, b^{2} c - 4 i \, a c^{2} - i \, b^{2} e\right )} \log \left (f\right )^{2} - {\left (b^{2} c - 2 \, b^{2} e + 4 \, a e^{2}\right )} \log \left (f\right )}{4 \, {\left (c^{2} \log \left (f\right )^{2} + e^{2}\right )}}\right )}}{4 \, {\left (c^{2} \log \left (f\right )^{2} + e^{2}\right )}} \] Input:

integrate(f^(c*x^2+b*x+a)*cos(e*x^2+b*x+a),x, algorithm="fricas")
 

Output:

-1/4*(sqrt(pi)*(c*log(f) - I*e)*sqrt(-c*log(f) - I*e)*erf(1/2*(2*e^2*x + ( 
2*c^2*x + b*c)*log(f)^2 + b*e + (I*b*c - I*b*e)*log(f))*sqrt(-c*log(f) - I 
*e)/(c^2*log(f)^2 + e^2))*e^(-1/4*((b^2*c - 4*a*c^2)*log(f)^3 + I*b^2*e - 
4*I*a*e^2 - (-2*I*b^2*c + 4*I*a*c^2 + I*b^2*e)*log(f)^2 - (b^2*c - 2*b^2*e 
 + 4*a*e^2)*log(f))/(c^2*log(f)^2 + e^2)) + sqrt(pi)*(c*log(f) + I*e)*sqrt 
(-c*log(f) + I*e)*erf(1/2*(2*e^2*x + (2*c^2*x + b*c)*log(f)^2 + b*e + (-I* 
b*c + I*b*e)*log(f))*sqrt(-c*log(f) + I*e)/(c^2*log(f)^2 + e^2))*e^(-1/4*( 
(b^2*c - 4*a*c^2)*log(f)^3 - I*b^2*e + 4*I*a*e^2 - (2*I*b^2*c - 4*I*a*c^2 
- I*b^2*e)*log(f)^2 - (b^2*c - 2*b^2*e + 4*a*e^2)*log(f))/(c^2*log(f)^2 + 
e^2)))/(c^2*log(f)^2 + e^2)
 

Sympy [F]

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

integrate(f**(c*x**2+b*x+a)*cos(e*x**2+b*x+a),x)
                                                                                    
                                                                                    
 

Output:

Integral(f**(a + b*x + c*x**2)*cos(a + b*x + e*x**2), x)
 

Maxima [C] (verification not implemented)

Result contains higher order function than in optimal. Order 9 vs. order 4.

Time = 0.09 (sec) , antiderivative size = 1058, normalized size of antiderivative = 5.06 \[ \int f^{a+b x+c x^2} \cos \left (a+b x+e x^2\right ) \, dx=\text {Too large to display} \] Input:

integrate(f^(c*x^2+b*x+a)*cos(e*x^2+b*x+a),x, algorithm="maxima")
 

Output:

1/8*sqrt(pi)*((f^(1/4*b^2*c/(c^2*log(f)^2 + e^2))*f^a*(cos(1/2*arctan2(e, 
-c*log(f))) + I*sin(1/2*arctan2(e, -c*log(f))))*cos(-1/4*(b^2*e - 4*a*e^2 
+ (2*b^2*c - 4*a*c^2 - b^2*e)*log(f)^2)/(c^2*log(f)^2 + e^2)) - f^(1/4*b^2 
*c/(c^2*log(f)^2 + e^2))*f^a*(-I*cos(1/2*arctan2(e, -c*log(f))) + sin(1/2* 
arctan2(e, -c*log(f))))*sin(-1/4*(b^2*e - 4*a*e^2 + (2*b^2*c - 4*a*c^2 - b 
^2*e)*log(f)^2)/(c^2*log(f)^2 + e^2)))*erf(x*conjugate(sqrt(-c*log(f) + I* 
e)) - 1/2*(b*log(f) + I*b)*conjugate(1/sqrt(-c*log(f) + I*e))) + (f^(1/4*b 
^2*c/(c^2*log(f)^2 + e^2))*f^a*(cos(1/2*arctan2(e, -c*log(f))) - I*sin(1/2 
*arctan2(e, -c*log(f))))*cos(-1/4*(b^2*e - 4*a*e^2 + (2*b^2*c - 4*a*c^2 - 
b^2*e)*log(f)^2)/(c^2*log(f)^2 + e^2)) - f^(1/4*b^2*c/(c^2*log(f)^2 + e^2) 
)*f^a*(I*cos(1/2*arctan2(e, -c*log(f))) + sin(1/2*arctan2(e, -c*log(f))))* 
sin(-1/4*(b^2*e - 4*a*e^2 + (2*b^2*c - 4*a*c^2 - b^2*e)*log(f)^2)/(c^2*log 
(f)^2 + e^2)))*erf(x*conjugate(sqrt(-c*log(f) - I*e)) - 1/2*(b*log(f) - I* 
b)*conjugate(1/sqrt(-c*log(f) - I*e))) + (f^(1/4*b^2*c/(c^2*log(f)^2 + e^2 
))*f^a*(cos(1/2*arctan2(e, -c*log(f))) - I*sin(1/2*arctan2(e, -c*log(f)))) 
*cos(-1/4*(b^2*e - 4*a*e^2 + (2*b^2*c - 4*a*c^2 - b^2*e)*log(f)^2)/(c^2*lo 
g(f)^2 + e^2)) - f^(1/4*b^2*c/(c^2*log(f)^2 + e^2))*f^a*(I*cos(1/2*arctan2 
(e, -c*log(f))) + sin(1/2*arctan2(e, -c*log(f))))*sin(-1/4*(b^2*e - 4*a*e^ 
2 + (2*b^2*c - 4*a*c^2 - b^2*e)*log(f)^2)/(c^2*log(f)^2 + e^2)))*erf(1/2*( 
2*(c*log(f) - I*e)*x + b*log(f) - I*b)*sqrt(-c*log(f) + I*e)/(c*log(f) ...
 

Giac [F]

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

integrate(f^(c*x^2+b*x+a)*cos(e*x^2+b*x+a),x, algorithm="giac")
 

Output:

integrate(f^(c*x^2 + b*x + a)*cos(e*x^2 + b*x + a), x)
 

Mupad [F(-1)]

Timed out. \[ \int f^{a+b x+c x^2} \cos \left (a+b x+e x^2\right ) \, dx=\int f^{c\,x^2+b\,x+a}\,\cos \left (e\,x^2+b\,x+a\right ) \,d x \] Input:

int(f^(a + b*x + c*x^2)*cos(a + b*x + e*x^2),x)
 

Output:

int(f^(a + b*x + c*x^2)*cos(a + b*x + e*x^2), x)
 

Reduce [F]

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

int(f^(c*x^2+b*x+a)*cos(e*x^2+b*x+a),x)
 

Output:

f**a*int(f**(b*x + c*x**2)*cos(a + b*x + e*x**2),x)