\[ \int x^2 \cos (a+b x) \text {CosIntegral}(a+b x) \, dx \]
Optimal antiderivative \[ -\frac {x}{b^{2}}+\frac {a \cosineIntegral \! \left (2 b x +2 a \right )}{b^{3}}+\frac {2 x \cosineIntegral \! \left (b x +a \right ) \cos \! \left (b x +a \right )}{b^{2}}-\frac {a \cos \! \left (2 b x +2 a \right )}{4 b^{3}}+\frac {x \cos \! \left (2 b x +2 a \right )}{4 b^{2}}+\frac {a \ln \! \left (b x +a \right )}{b^{3}}+\frac {\sinIntegral \! \left (2 b x +2 a \right )}{b^{3}}-\frac {a^{2} \sinIntegral \! \left (2 b x +2 a \right )}{2 b^{3}}-\frac {2 \cosineIntegral \! \left (b x +a \right ) \sin \! \left (b x +a \right )}{b^{3}}+\frac {x^{2} \cosineIntegral \! \left (b x +a \right ) \sin \! \left (b x +a \right )}{b}-\frac {\cos \! \left (b x +a \right ) \sin \! \left (b x +a \right )}{b^{3}}-\frac {\sin \! \left (2 b x +2 a \right )}{8 b^{3}} \]
command
integrate(x^2*fresnel_cos(b*x+a)*cos(b*x+a),x, algorithm="giac")
Giac 1.9.0-11 via sagemath 9.6 output
\[ \text {could not integrate} \]
Giac 1.7.0 via sagemath 9.3 output
\[ {\left (\frac {2 \, x \cos \left (b x + a\right )}{b^{2}} + \frac {{\left (b^{2} x^{2} - 2\right )} \sin \left (b x + a\right )}{b^{3}}\right )} \operatorname {Ci}\left (b x + a\right ) - \frac {a^{2} \Im \left ( \operatorname {Ci}\left (2 \, b x + 2 \, a\right ) \right ) \tan \left (b x + a\right )^{2} - a^{2} \Im \left ( \operatorname {Ci}\left (-2 \, b x - 2 \, a\right ) \right ) \tan \left (b x + a\right )^{2} + 2 \, a^{2} \operatorname {Si}\left (2 \, b x + 2 \, a\right ) \tan \left (b x + a\right )^{2} + 5 \, b x \tan \left (b x + a\right )^{2} - 4 \, a \log \left ({\left | b x + a \right |}\right ) \tan \left (b x + a\right )^{2} - 2 \, a \Re \left ( \operatorname {Ci}\left (2 \, b x + 2 \, a\right ) \right ) \tan \left (b x + a\right )^{2} - 2 \, a \Re \left ( \operatorname {Ci}\left (-2 \, b x - 2 \, a\right ) \right ) \tan \left (b x + a\right )^{2} + a^{2} \Im \left ( \operatorname {Ci}\left (2 \, b x + 2 \, a\right ) \right ) - a^{2} \Im \left ( \operatorname {Ci}\left (-2 \, b x - 2 \, a\right ) \right ) + 2 \, a^{2} \operatorname {Si}\left (2 \, b x + 2 \, a\right ) - a \tan \left (b x + a\right )^{2} - 2 \, \Im \left ( \operatorname {Ci}\left (2 \, b x + 2 \, a\right ) \right ) \tan \left (b x + a\right )^{2} + 2 \, \Im \left ( \operatorname {Ci}\left (-2 \, b x - 2 \, a\right ) \right ) \tan \left (b x + a\right )^{2} - 4 \, \operatorname {Si}\left (2 \, b x + 2 \, a\right ) \tan \left (b x + a\right )^{2} + 3 \, b x - 4 \, a \log \left ({\left | b x + a \right |}\right ) - 2 \, a \Re \left ( \operatorname {Ci}\left (2 \, b x + 2 \, a\right ) \right ) - 2 \, a \Re \left ( \operatorname {Ci}\left (-2 \, b x - 2 \, a\right ) \right ) + a - 2 \, \Im \left ( \operatorname {Ci}\left (2 \, b x + 2 \, a\right ) \right ) + 2 \, \Im \left ( \operatorname {Ci}\left (-2 \, b x - 2 \, a\right ) \right ) - 4 \, \operatorname {Si}\left (2 \, b x + 2 \, a\right ) + 5 \, \tan \left (b x + a\right )}{4 \, {\left (b^{3} \tan \left (b x + a\right )^{2} + b^{3}\right )}} \]