Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello, @Nasser! I may have an idea of what is going on, and I think you found a bug! (Although I am not 100% sure.) Here is what I can deduce from reading lots of line of Sage code.

If you want to do some integration using Giac, what really happens at a low level is the following:

ex = (x+1)._giac_()
result = ex.integrate(x._giac_())

The result is obviously x^2/2+x. The first line converts the x+1 from Sage representation to Giac representation, and stores it in ex. The second line calls the Giac integrate method (since the expression is now converted), which asks to integrate with respect to x; but, once again, you have to do it converting x to Giac representation (that's the x._giac_()). Finally, the third line converts the result back to Sage representation, so you can work with that within Sage itself

Now, let's go to your example. The same process is performed:

ex = ((1-2*x^(1/3))^(3/4)/x)._giac_()
result = ex.integrate(x._giac_())

If you could print result in this stage, you would see the answer

Evaluation time: 1.28

The difference with the previous example is that there is this Evaluation time: 1.28, which Giac seems to add as part of the result when the computation takes a little longer than usual (like 1.28 seconds). That is when Sage fails, because the line


is executed, but Sage is expecting a function, not the new string of evaluation time.

My suggestion: Use Giac to integrate simple functions until the bug is fixed (I will report it right now). But, if you really want to use it to integrate a function like this, execute the two previous steps (without result._sage_()), ten redefine x with x = var('x'), and copy what result shows in your screen, without the "Evaluation time" part. You have to be careful to replace every ln with log, which is one of the things that the _sage_() method should do automatically.

I hope this helps!