Elliptic system

Mathematica, 87 80 78 bytes


Takes 5 inputs: [{x1, y1}, ... , {x5, y5}].

Returns an exact/symbolic value.


Let f(x, y) denote the vector (1, x, y, xy, x^2, y^2) for some x, y.

Then, the determinant of the matrix with row vectors [f(x, y), f(x1, y1), f(x2, y2), ..., f(x5, y5)] is zero iff (x, y) is a point on the ellipse we are looking for. i.e. the determinant gives the expression for the ellipse.

Since the sign of the expression might be inverted, we take the constant term and multiply the entire expression by the sign of the constant. That way, we can set the expression greater than 0 to find the area.

MATLAB, 130 124 114 bytes

The input is takean as two column vectors, one for the x- and one for the y-coordinates. This method uses a least sequares regression, which provides the exact ellipse if all points are exactly on an ellipse, and then applies the formula provided here (thanks @orlp) to calculate the area.

function A=f(x,y);p=null([x.^2,2*x.*y,y.^2,2*x,2*y,0*x+1]);A=pi*det(p([1,2,4;2,3,5;4:6]))/abs(p(1)*p(3)-p(2)^2)^1.5

By appending following lines you can even plot the curve:

[x,y] = meshgrid(linspace(-7,7,50));
W = [x(:).^2,2*x(:).*y(:),y(:).^2,2*x(:),2*y(:),0*x(:)+1];
Z=x;Z(:) = W*p;
clf;plot(X,Y,'o');hold on;contour(x,y,Z,[0,0]);

Try it online!

Mathematica 84 Bytes

I found this to be an interesting problem. Every ellipse is an affine transformation of the unit circle which can be parameterized as {x,y}={Cos(t),Sin(t)}, so the points on the circle can be mapped to the ellipse by {xE,yE}=A{x,y}+B where A is a constant matrix and B a vector. Plugging in the points yields 10 scalar equations and 11 scalar unknowns, but we can decide that the parameterization starts at t=0, so the system is solvable. The absolute value of the determinant of the matrix A is the ratio of the area of the ellipse to the unit circle so we multiply by Pi. Taking Max gets rid of the negative solution.

Max[π(a d-b c)/.Solve@MapThread[#2=={e,f}+{a,b}Cos@#+{c,d}Sin@#&,{{0,u,v,w,x},#}]]&


%@{{-2, 3}, {2, 5}, {5, 3}, {4, 0}, {1, -3}}


(1001 π)/(16 Sqrt[10])