Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello, @Nasser! This seems to be Fricas' fault, since it implements the log function, but not the ln function. However, Sage implements both; although the preferred name is log.

When you call integrate("log(t)", t, algorithm="fricas"), the following steps are executed:

ex = "log(t)"
if not isinstance(ex, Expression):
    ex = SR(ex) # here ex becomes log(t), an Expression, not a string
ex= fricas(ex) # ex is translated to fricas representation
result = ex.integrate(fricas(t)) # we call the fricas' integrate function with the variable t converted to fricas

If you could print result at this stage, you would get

t log(t) - t

which must be converted to Sage representation with the command

result.sage()

This shows you

t*log(t) - t

Notice the subtle difference between the Fricas representation and the Sage representation?

When you try to integrate an unknown function in Fricas, lets say func, Fricas returns the not satisfactory, although completely correct answer

   t
 ++
 |   func(%A)d%A
++

(This is what you get from the step result = ex.integrate(fricas(t)) that I mentioned before.) The problem here is that Fricas doesn't know how to integrate func, so it returns an abstract representation of the integral. After translating that to Sage's representation (with the step result.sage() mentioned above), it is shown as

integral(func(t), t)

which is the equivalent Sage representation of the abstract integral, and is also correct, but not satisfactory.

Remember: If you use an algorithm named as a software like fricas for integrating, or solving, or differentiating, etc., you are actually using that software, which is external to Sage (although it interfaces to Sage), so you have to stick to the rues of that software.

I hope this clarifies your doubts!

Hello, @Nasser! This seems to be Fricas' fault, since it implements the log function, but not the ln function. However, Sage implements both; although the preferred name is log.

When you call integrate("log(t)", t, algorithm="fricas"), the following steps are executed:

ex = "log(t)"
if not isinstance(ex, Expression):
    ex = SR(ex) # here ex becomes log(t), an Expression, not a string
ex= fricas(ex) # ex is translated to fricas representation
result = ex.integrate(fricas(t)) # we call the fricas' integrate function with the variable t converted to fricas

If you could print result at this stage, you would get

t log(t) - t

which must be is finally converted to Sage representation with the command

result.sage()

This shows you

t*log(t) - t

Notice the subtle difference between the Fricas representation and the Sage representation?

When you try to integrate an unknown function in Fricas, lets say func, Fricas returns the not satisfactory, although completely correct answer

   t
 ++
 |   func(%A)d%A
++

(This is what you get from the step result = ex.integrate(fricas(t)) that I mentioned before.) The problem here is that Fricas doesn't know how to integrate func, so it returns an abstract representation of the integral. After translating that to Sage's representation (with the step result.sage() mentioned above), it is shown as

integral(func(t), t)

which is the equivalent Sage representation of the abstract integral, and is also correct, but not satisfactory.

Remember: If you use an algorithm named as a software like fricas for integrating, or solving, or differentiating, etc., you are actually using that software, which is external to Sage (although it interfaces to Sage), so you have to stick to the rues of that software.

I hope this clarifies your doubts!

Hello, @Nasser! This seems to be Fricas' fault, since it implements the log function, but not the ln function. However, Sage implements both; although the preferred name is log.

When you call integrate("log(t)", t, algorithm="fricas"), the following steps are executed:

ex = "log(t)"
if not isinstance(ex, Expression):
    ex = SR(ex) # here ex becomes log(t), an Expression, not a string
ex= fricas(ex) # ex is translated to fricas representation
result = ex.integrate(fricas(t)) # we call the fricas' integrate function with the variable t converted to fricas

If you could print result at this stage, you would get

t log(t) - t

which is finally converted to Sage representation with the command

result.sage()

This shows you

t*log(t) - t

Notice the subtle difference between the Fricas representation and the Sage representation?

When you try to integrate an unknown function in Fricas, lets say func, Fricas returns the not satisfactory, although completely correct answer

   t
 ++
 |   func(%A)d%A
++

(This is what you get from the step result = ex.integrate(fricas(t)) that I mentioned before.) The problem here is that Fricas doesn't know how to integrate func, so it returns an abstract representation of the integral. After translating that to Sage's representation (with the step result.sage() mentioned above), it is shown as

integral(func(t), t)

which is the equivalent Sage representation of the abstract integral, and is also correct, but not satisfactory.

Remember: If you use an algorithm named as a software like fricas for integrating, or solving, or differentiating, etc., you are actually using

EDIT BASED ON COMMENT

This is what happens with ln, which is unknown to Fricas. However, I agree with you that software, which is external to Sage (although it interfaces to Sage), so you have to stick to the rues of that software.SageMath should be able to handle this situation, and convert ln to log before applying the integral.

I hope this clarifies your doubts!

helps!

Hello, @Nasser! This seems to be Fricas' fault, since it implements the log function, but not the ln function. However, Sage implements both; although the preferred name is log.

When you call integrate("log(t)", t, algorithm="fricas"), the following steps are executed:

ex = "log(t)"
if not isinstance(ex, Expression):
    ex = SR(ex) # here ex becomes log(t), an Expression, not a string
ex= fricas(ex) # ex is translated to fricas representation
result = ex.integrate(fricas(t)) # we call the fricas' integrate function with the variable t converted to fricas

If you could print result at this stage, you would get

t log(t) - t

which is finally converted to Sage representation with the command

result.sage()

This shows you

t*log(t) - t

Notice the subtle difference between the Fricas representation and the Sage representation?

When you try to integrate an unknown function in Fricas, lets say func, Fricas returns the not satisfactory, although completely correct answer

   t
 ++
 |   func(%A)d%A
++

(This is what you get from the step result = ex.integrate(fricas(t)) that I mentioned before.) The problem here is that Fricas doesn't know how to integrate func, so it returns an abstract representation of the integral. After translating that to Sage's representation (with the step result.sage() mentioned above), it is shown as

integral(func(t), t)

which is the equivalent Sage representation of the abstract integral, and is also correct, but not satisfactory.

EDIT BASED ON COMMENT

This is what happens with ln

EDIT Based on the answer to this question, which is unknown to Fricas. However, I agree with you must point out that SageMath the use of strings as functions, by means of the Symbolic Ring SR, is discourage and should be able to handle avoided, because it has unpleasant consequences like this situation, and convert ln to log before applying the integral.one.. This kind of use of strings seems not to be documented for that reason.

I hope this helps!