Ask Your Question

Revision history [back]

We have

sage: var('a b c d')
(a, b, c, d)
sage: anti = integrate(cos(b*x + a)*cos_integral(d*x + c)/x, x, algorithm="fricas")
sage: anti
integral(cos(b*x + a)*cos_integral(d*x + c)/x, x)
sage: anti.operator()
integral
sage: type(anti.operator())
<class 'sage.symbolic.function_factory.NewSymbolicFunction'>

So, integral in anti is a NewSymbolicFunction. I would say this reflects a bad conversion of the FriCAS integral to a SageMath integral. Indeed, the derivative treats integral as an ordinary (generic) function, not as an antiderivative, as you can see from the D[0](integral) and D[1](integral) below:

sage: diff(anti, x)
-(b*cos_integral(d*x + c)*sin(b*x + a)/x - d*cos(b*x + a)*cos(d*x + c)/((d*x + c)*x) + cos(b*x + a)*cos_integral(d*x + c)/x^2)*D[0](integral)(cos(b*x + a)*cos_integral(d*x + c)/x, x) + D[1](integral)(cos(b*x + a)*cos_integral(d*x + c)/x, x)

As a workaround, you can substitute the fake integral by the true SageMath integral:

sage: anti2 = anti.substitute_function(anti.operator(), integrate)
sage: anti2
integrate(cos(b*x + a)*cos_integral(d*x + c)/x, x)
sage: diff(anti2, x)
cos(b*x + a)*cos_integral(d*x + c)/x