27
$\begingroup$

fixed in 10.1 (windows)


With Mathematica 10.0.2:

ArcLength[Line[{{0, 0}, {1, 0}, {2, 0}}]]
ArcLength[Line[{{0}, {1}, {2}}]]
(* 2 *)
(* 2 *)

However,

ArcLength[Line[{{0, 0}, {1, 0}, {2.0, 0}}]]
ArcLength[Line[{{0}, {1}, {2.0}}]]
(* 1. *)
(* 1. *)
$\endgroup$
  • 1
    $\begingroup$ Certainly looks like a bug, especially since ArcLength[{{0.0},{1},{2}}] = 2. $\endgroup$ – David G. Stork Dec 16 '14 at 2:36
  • 2
    $\begingroup$ And ArcLength[Line[{{0, 0}, {1, 0}, {2.000001, 0}}]] is back to 2. again... $\endgroup$ – bill s Dec 16 '14 at 3:05
  • 4
    $\begingroup$ Confirmed on 10.0.1 on Windows 7(64). This is quite horrible. $\endgroup$ – Yves Klett Dec 16 '14 at 7:06
  • 5
    $\begingroup$ The bug is actually in RegionMeasure. Try RegionMeasure[Line[{{0, 0}, {1, 0}, {2., 0}}], 1] and RegionMeasure[Line[{{0, 0}, {1, 0}, {2, 0}}], 1] $\endgroup$ – Rolf Mertig Dec 16 '14 at 10:00
  • 3
    $\begingroup$ Has this been reported to support@wolfram.com? $\endgroup$ – Sjoerd C. de Vries Dec 16 '14 at 11:35
15
$\begingroup$

Yes, this is a bug in the more general function RegionMeasure. I knew there were some edge cases in the handling of inexact numerics, but I was unaware of such a simple example. I will forward this bug internally.

Workarounds include using the parametric (2-argument) form of ArcLength, and using DiscretizeRegion to pre-process regions before sending them to ArcLength/RegionMeausure:

In[21]:= ArcLength[DiscretizeRegion@Line[{{0, 0}, {1, 0}, {2.0, 0}}]]

Out[21]= 2.

In[22]:= ArcLength[DiscretizeRegion@Line[{{0}, {1}, {2.0}}]]

Out[22]= 2.
$\endgroup$
  • $\begingroup$ This seems to be an issue with any Line composed of collinear segments and having inexact numbers for coordinates. $\endgroup$ – Michael E2 Feb 7 '15 at 18:07
1
$\begingroup$

bug fixed in 10.1 (windows)

Mathematica graphics


Mathematica graphics

code

ArcLength[Line[{{0, 0}, {1, 0}, {2, 0}}]]
ArcLength[Line[{{0}, {1}, {2}}]]
ArcLength[Line[{{0, 0}, {1, 0}, {2.0, 0}}]]
ArcLength[Line[{{0}, {1}, {2.0}}]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.