9
Introduction
Given five points in the plane, your task is to compute the area of the ellipse passing through these points.
You can assume that exactly one non-degenerate ellipse can be constructed with the given input values.
Rules
Input is 10
integers in any convenient form, corresponding to the x
and y
coordinates of the points. For example, you could take input as a list of 10
integers [x1, y1, x2, y2, ..., x5, y5]
, or as [[x1, y1], [x2, y2], ..., [x5, y5]]
, etc.. You may also handle decimal numbers, but only integers are required.
Output is a representation of the area of the ellipse. This may be some symbolic expression, or a decimal value with at least 8
digits of precision.
This is code-golf, so the shortest answer in bytes wins.
Example Input and Output
Input:
[-2, 3, 2, 5, 5, 3, 4, 0, 1, -3]
Output:
62.15326783788685
A depiction of the ellipse passing through these points:
More examples:
f(60, -92, -31, -10, 78, -19, -27, -35, 91, -37) = 9882.59540465108
f(-9, -4, 7, 7, 10, 1, -7, -10, 0, 7) = 269.5966648188643
f(-3, 2, 0, -5, 4, 0, -4, 1, -1, 2) = 98.54937293879908
Was this by any chance inspired by this SPOJ problem? http://www.spoj.com/problems/ELLIPSE/
– xnor – 2017-10-03T08:42:23.040It was not. I am not active on that site. – Ethan Ward – 2017-10-03T08:45:50.097
What does it mean that the output may be a symbolic expression? – xnor – 2017-10-03T09:21:39.677
@xnor Perhaps an (unevaluated) elliptic integral? – Mego – 2017-10-03T09:28:19.353
@xnor I think it means that it can be an exact answer, if the language supports it. – numbermaniac – 2017-10-04T00:53:34.643
2Annnnd the best tool for the job goes tooooooo: Mathematics graphing programs! Go figure :P. – Magic Octopus Urn – 2017-10-04T16:26:12.670