27

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. *)
Nasser
  • 143,286
  • 11
  • 154
  • 359
qwerty
  • 1,199
  • 1
  • 7
  • 7

2 Answers2

15

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.
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Itai Seggev
  • 14,113
  • 60
  • 84
  • This seems to be an issue with any Line composed of collinear segments and having inexact numbers for coordinates. – Michael E2 Feb 07 '15 at 18:07
1

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}}]]
Nasser
  • 143,286
  • 11
  • 154
  • 359