1 | initial version |
Mathematica is correct. You can see that easily by plotting the integrand from 0 to 2Pi. Clearly the area is not zero. It looks like about 8 is correct.
Here is a workaround in sagemath,
Write the integrand using trig function by converting it using Euler's formula. This will give sqrt(2-2*cos(t)) and now integrate this instead of the complex exponential. But make sure to use "fricas" as algorithm
sage: var("t")
sage: g = sqrt(2 - 2 * cos(t))
sage: integrate(g, t, 0, 2 * pi, algorithm="fricas")
8
2 | No.2 Revision |
Mathematica is correct. You can see that easily by plotting the integrand from 0 to 2Pi. Clearly the area is not zero. It looks like about 8 is correct.
Here is a workaround in sagemath,
Write the integrand using trig function by converting it using Euler's formula. This will give sqrt(2-2*cos(t)) and now integrate this instead of the complex exponential. But make sure to use "fricas" as algorithm
sage: var("t")
sage: f = sqrt((e^(I * t) - 1) * (e^(-I*t) - 1))
g = simplify(expand(sageobj(f._maxima_().demoivre())))
sqrt(cos(t)^2 + sin(t)^2 - 2*cos(t) + 1)
The above is sqrt(2 - 2 *
but for some reason simplify does not know that cos(t))
cos(t))cos(t)^2+sin(t)^2=1
? strange.
Now integrate the above, but use "fricas" to get correct answer
sage: integrate(g, t, 0, 2 * pi, algorithm="fricas")
8
3 | No.3 Revision |
Mathematica is correct. You can see that easily by plotting the integrand from 0 to 2Pi. Clearly the area is not zero. It looks like about 8 is correct.
Here is a workaround in sagemath,
Write the integrand using trig function by converting it using Euler's formula. This will give sqrt(2-2*cos(t)) sqrt(2-2*cos(t))
and now integrate this instead of the complex exponential. But make sure to use "fricas" as algorithmalgorithm. The default algorithm and others give zero which is wrong.
var("t")
f = sqrt((e^(I * t) - 1) * (e^(-I*t) - 1))
g = simplify(expand(sageobj(f._maxima_().demoivre())))
sqrt(cos(t)^2 + sin(t)^2 - 2*cos(t) + 1)
The above is sqrt(2 - 2 * cos(t))
but for some reason simplify does not know that cos(t)^2+sin(t)^2=1
? strange.
Now integrate the above, but use "fricas" to get correct answer
sage: integrate(g, t, 0, 2 * pi, algorithm="fricas")
8
4 | No.4 Revision |
Mathematica is correct. You can see that easily by plotting the integrand from 0 to 2Pi. Clearly the area is not zero. It looks like about 8 is correct.
Here is a workaround in sagemath,
Write the integrand using trig function by converting it using Euler's formula. This will give sqrt(2-2*cos(t))
and now integrate this instead of the complex exponential. But make sure to use "fricas" as algorithm. The default algorithm and others give zero which is wrong.
var("t")
f = sqrt((e^(I * t) - 1) * (e^(-I*t) - 1))
g = simplify(expand(sageobj(f._maxima_().demoivre())))
expand(sageobj(f._maxima_().demoivre())).trig_simplify()
sqrt(cos(t)^2 sqrt(-2*cos(t) + sin(t)^2 - 2*cos(t) + 1)
2)
The above is sqrt(2 - 2 * cos(t))
but for some reason simplify does not know that cos(t)^2+sin(t)^2=1
? strange.
Now integrate the above, but use "fricas" to get correct answer
sage: integrate(g, t, 0, 2 * pi, algorithm="fricas")
8
5 | No.5 Revision |
Mathematica is correct. You can see that easily by plotting the integrand from 0 to 2Pi. Clearly the area is not zero. It looks like about 8 is correct.
Here is a workaround in sagemath,
Write the integrand using trig function by converting it using Euler's formula. This will give sqrt(2-2*cos(t))
and now integrate this instead of the complex exponential. But make sure to use "fricas" as algorithm. The default algorithm and others give zero which is wrong.
var("t")
f = sqrt((e^(I * t) - 1) * (e^(-I*t) - 1))
g = expand(sageobj(f._maxima_().demoivre())).trig_simplify()
sqrt(-2*cos(t) + 2)
Now integrate the above, but use "fricas" to get correct answer
sage: integrate(g, t, 0, 2 * pi, algorithm="fricas")
8
Compare to
sage: integrate(g, t, 0, 2 * pi)
0