Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Possible bug needs confirmation: Fricas can't handle "ln"

Hello, Sage Community!

Based on this question by user @Nasser, and follow up comments, there seems to be a bug in SageMath. The following statement is syntactically correct:

integrate('ln(x)', x, algorithm='fricas')

but it returns integral(ln(x), x), which is indeed correct, but not expected. The equivalent statement

integrate(ln(x), x, algorithm='fricas')

returns the expected answer, 'x*log(x) - x'.

The problem seems to be that ln is not defined in Fricas, but log is. When Fricas receives an unknown function---let's say func---, it returns the abstract integral

 |   func(%A)d%A

which is converted by Sage to

integral(func(x), x)

And that is what happens with ln: Sage uses the Symbolic Ring SR to convert the string 'ln(x)' to a symbolic math function, but then, it doesn't convert it to log(x), and passes ln(x) to Fricas, which is a unknown function for it. So, an abstract integral is returned.

As @Nasser points out:

But I am using sagemath? If a user has to know what each other CAS system that sagemath uses prefer or not prefer in terms of the input, what is the point then of using Sagemath? One can just use the other CAS system. I mean, I am using ln(t) which Sagemath knows, right? A user should not care if the system that sagemath ends up calling to do the integration knows or not know about ln(t). Sagemath should have then converted ln(t) automatically internally to log(t) in this case. At least this is what I would have expected. But thanks for the answer. I changed my calls to use "log(t)" and issue resolved for me.

I have to agree with this statement. SageMath should handle the adequate conversion for the CAS it passes its input.

In order to see more detail about this process, and a possible point where things go wrong, please see the answer to this question.

Thanks in advance!