Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I suspect there is a way to address your first question, but I'll concentrate on the meta-questions.

The short answer is that we have had long, long discussions in the past about this, and the consensus among the developers was always that we did not want to support this. I don't think anyone was opposed to someone developing a "calculus mode", but thus far no one has implemented it; I don't think it would be trivial to do.

I was usually on the losing end in such discussions 3 or 4 years ago, but I now have seen the utility of having the "mathematically correct" answer - and I suspect that my American students are no more, or perhaps rather less, ready to see that ln(-1) exists than your Belgian ones. Certainly the idea of Inf having meaning is useful for vertical asymptotes (see Winston Churchill's thoughts on this).

I take it as a teaching opportunity, and also make sure that I try my examples ahead of time! Early in my Sage use in class, not trying things ahead of time led to surprises more than once.

I encourage you to subscribe/post to sage-edu, where people definitely have opinions and ideas about such things.

As to the specific example you gave, I agree that is very annoying. One would want primitives to be real if possible, but I don't know that Maxima would consider this to be a bug. You could try one of the other algorithms.

sage: g = integrate(f,x,algorithm='sympy')
sage: g
x |--> -1/2*log(x - 1) + 1/2*log(x + 1)  # same as Maxima
sage: g = integrate(f,x,algorithm='mathematica_free')  # Wolfram Alpha
sage: g
x |--> 1/2*log(-x - 1) - 1/2*log(x - 1)
sage: g(0.5)
0.549306144334055
sage: g(1.1)
1.52226121886171 + 1.57079632679490*I

So probably there isn't an easy way around this; no primitive will be nice for all values of $x$.

I suspect there is a way to address your first question, but I'll concentrate on the meta-questions.

The short answer is that we have had long, long discussions in the past about this, and the consensus among the developers was always that we did not want to support this. I don't think anyone was opposed to someone developing a "calculus mode", but thus far no one has implemented it; I don't think it would be trivial to do.

I was usually on the losing end in such discussions 3 or 4 years ago, but I now have seen the utility of having the "mathematically correct" answer - and I suspect that my American students are no more, or perhaps rather less, ready to see that ln(-1) exists than your Belgian ones. Certainly the idea of Inf having meaning is useful for vertical asymptotes (see Winston Churchill's thoughts on this).

I take it as a teaching opportunity, and also make sure that I try my examples ahead of time! Early in my Sage use in class, not trying things ahead of time led to surprises more than once.

I encourage you to subscribe/post to sage-edu, where people definitely have opinions and ideas about such things.

As to the specific example you gave, I agree that is very annoying. One would want primitives to be real if possible, but I don't know that Maxima would consider this to be a bug. You could try one of the other algorithms.

sage: g = integrate(f,x,algorithm='sympy')
sage: g
x |--> -1/2*log(x - 1) + 1/2*log(x + 1)  # same as Maxima
sage: g = integrate(f,x,algorithm='mathematica_free')  # Wolfram Alpha
sage: g
x |--> 1/2*log(-x - 1) - 1/2*log(x - 1)
sage: g(0.5)
0.549306144334055
sage: g(1.1)
1.52226121886171 + 1.57079632679490*I

So probably there isn't an easy way around this; no primitive will be nice for all values of $x$.

Edit: Naturally, jhpalmieri is right and I was not thinking clearly.