(参考)方べきの定理(方冪の定理、ほうべきのていり)
https://ja.wikipedia.org/wiki/%E6%96%B9%E3%81%B9%E3%81%8D%E3%81%AE%E5%AE%9A%E7%90%86
https://en.wikipedia.org/wiki/Intersecting_chords_theorem
r,角度に値を入力しています。
from sympy import *
var('r tA tB tC tD')
def fnoKeisan(AA,BB,CC,DD):
P = Line(AA, BB).intersection(Line(CC, DD))
f = P[0].distance(A) * P[0].distance(B) - P[0].distance(C) * P[0].distance(D)
return f
print('図1-------------------------------------')
r=1000
tA = pi / 180 * (135)
tB = pi / 180 * (315)
tC = pi / 180 * (225)
tD = pi / 180 * ( 45)
A = Point(r * cos(tA), r * sin(tA))
B = Point(r * cos(tB), r * sin(tB))
C = Point(r * cos(tC), r * sin(tC))
D = Point(r * cos(tD), r * sin(tD))
print('#PA・PB-PC・PD=',fnoKeisan(A,B,C,D))
print('#PA・PB-PC・PD=',float(fnoKeisan(A,B,C,D)))
print('図2-------------------------------------')
r=1000
tA = pi / 180 * (175)
tB = pi / 180 * (10)
tC = pi / 180 * (190)
tD = pi / 180 * (315)
A = Point(r * cos(tA), r * sin(tA))
B = Point(r * cos(tB), r * sin(tB))
C = Point(r * cos(tC), r * sin(tC))
D = Point(r * cos(tD), r * sin(tD))
print('#PA・PB-PC・PD=',fnoKeisan(A,B,C,D))
print('#PA・PB-PC・PD=',float(fnoKeisan(A,B,C,D)))
#PA・PB-PC・PD= 0
#PA・PB-PC・PD= 0.0
-------------------------------------------------
#PA・PB-PC・PD= -sqrt((500*(-2*s.....つづく......
#PA・PB-PC・PD= 2.4784588255035637e-119