# Sage returning 0 for curve arc length (integrals)

I'm using Sage to calculate a curve arc length.

Basically, the curve is given by this equation:

In sage, I'm calculating it's arc length by using this formula:

var('t')
integral(sqrt((derivative(t - sin(t)))^2 + (derivative(1 - cos(t)))^2 + (derivative(4 * cos(t/2)))^2), t, 0, 8*pi);


The formula is from here: http://www.mathwords.com/a/arc_length_of_a_curve.htm

Basically, it should return

32 * sqrt(2)

but it always returns 0.

Could anyone tell me why? I probably did something wrong with the syntax, but can't figure out where.

-
I deleted my answer because it is indeed a branch problem and not a syntax problem. – Phira May 20 '12 at 23:13
var('t'); f = sqrt(sin(t)^2); integral(f,t,0,2*pi) <-- this throws an error, asking for an assumption on the sign of sin(t). If assume(sin(t)>0) is added [though false], the answer is 0. As much as I like open-source software, I guess the message is to look elsewhere when you need symbolic integration. – user31373 May 20 '12 at 23:18

Probably Sage did not keep track of branches, and used a discontinuous anti-derivative. Maple, also, has a discontinuous anti-derivative. But Maple manages to take the jumps into account and gets the right answer. \begin{align} &\int 2 \sqrt{2} \mathrm{sgn} \Biggl(\operatorname{sin} \biggl(\frac{t}{2}\biggr)\Biggr) \operatorname{sin} \biggl(\frac{t}{2}\biggr) d t = -4\sqrt{2} \mathrm{sgn} \Biggl(\operatorname{sin} \biggl(\frac{t}{2}\biggr)\Biggr) \operatorname{cos} \biggl(\frac{t}{2}\biggr) \\ &\int_{0}^{8 \pi} 2 \sqrt{2} \mathrm{sgn} \Biggl(\operatorname{sin} \biggl(\frac{t}{2}\biggr)\Biggr) \operatorname{sin} \biggl(\frac{t}{2}\biggr) d t = 32 \sqrt{2} \end{align}