Ptolemy's theorem トレミーの定理

  • 円に内接する四角形ABCDがあった時|AC|\times |BD| = |AB| \times |CD| + |BC| \times |DA|が成り立つそうだ

en.wikipedia.org

t <- sort(runif(4) * 2 * pi)
x <- cos(t)
y <- sin(t)
xy <- cbind(x,y)
d <- as.matrix(dist(xy))
d

d[1,3] * d[2,4] - (d[1,2] * d[3,4] + d[2,3] * d[4,1])
> t <- sort(runif(4) * 2 * pi)
> x <- cos(t)
> y <- sin(t)
> xy <- cbind(x,y)
> d <- as.matrix(dist(xy))
> d
         1        2        3        4
1 0.000000 0.855728 1.940275 1.976644
2 0.855728 0.000000 1.546143 1.656181
3 1.940275 1.546143 0.000000 0.183788
4 1.976644 1.656181 0.183788 0.000000
> d[1,3] * d[2,4] - (d[1,2] * d[3,4] + d[2,3] * d[4,1])
[1] 4.440892e-16
  • 単位球面上の四角形では成り立たないようだが、双曲面の場合に、単位円板の円周上の点(無限遠点)を頂点とする四角形の場合には、距離の取り方をちゃんとすると成り立つらしい

https://www.maths.gla.ac.uk/wws/cabripages/hyperbolic/hybrid1.html