Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, the absolute value is omitted, as seen from integrating without limits, then differentiating the result:

sage: assume(t, 'real')
sage: integrate(abs( (exp(i*t) - 1)^2 ) * i * exp(i*t), t).diff().factor()
I*(e^(I*t) - 1)^2*e^(I*t)

The problem is that the machine was not really educated to take the absolute value correctly, here it must isolate the real and imaginary parts, compute the absolute value, then integrate this value. In giac we have the right answer:

sage: integrate(abs(exp(i*t) - 1)^2 * i * exp(i*t), (t, 0, pi), algorithm='giac')
-I*pi - 4

The expectation that the computer does and must do always the right thing is not really realistic. If it is a must, then the implementers must be written on a black list and punished. However, the implementers are on my list at the top, they did the best, and combined with human common sense and checks the work is almost always done.

In our case, let us explicitly help the integrator:

sage: integrate( (real(exp(i*t) - 1)^2 + imag(exp(i*t) - 1)^2) * i * exp(i*t), t, 0, pi)
-I*pi - 4

sage: integrate(abs((cos(t) + i*sin(t) - 1)^2) * i * exp(i*t), (t, 0, pi))
-I*pi - 4