Find the area of a polygon
Python 2, 191 bytes
from math import*
C=sorted(input());l,h=C[-1]/2,sum(C)
while h-l>1e-9:m=l+h;a=[asin(c/m)for c in C[:-1]];f=pi-sum(a);l,h=[l,m/2,h][m*sin(f)<C[-1]:][:2]
print sum(l*l*sin(2*t)for t in a+[f])/2
Uses a binary search to find the radius, then calculates the area of each segment by the angle/radius.
It finds the radius by first summing all but the largest chord angle, and checking the remaining angle to the remaining chord. Those angles are then also used to compute the area of each segment. A segment's area can be negative, if it's angle is bigger than 180 degrees.
Readable implementation:
import math
def segment_angles(line_segments, r):
return [2*math.asin(c/(2*r)) for c in line_segments]
def cyclic_ngon_area(line_segments):
line_segments = list(sorted(line_segments))
lo, hi = max(line_segments) / 2, sum(line_segments)
while hi - lo > 1e-9:
mid = (lo + hi) / 2
angles = segment_angles(line_segments[:-1], mid)
angles.append(2*math.pi - sum(angles))
if 2 * mid * math.sin(angles[-1]/2) < line_segments[-1]:
lo = mid
else:
hi = mid
return sum([lo*lo * math.sin(a) / 2 for a in angles])