How would you fit an equation to the shape of an egg? This site suggests an equation of the form

Note that if *k* = 0 we get an ellipse. The larger the parameter *k* is, the more asymmetric the shape is about the *y*-axis.

Let’s try that out in Mathematica:

ContourPlot[ x^2/16 + y^2 (1 + 0.1 x)/4 == 1, {x, -4, 4}, {y, -3, 3} ]

Here’s another plot with *k* = 0.05. This one’s a little closer to an ellipse.

## Solving for parameters

If you measured an egg, how would you find *a*, *b*, and *k*?

Setting *y* = 0 shows that 2*a* is the length of the egg. Setting *x* = 0 shows that *2b* is the width of the egg at the midpoint of the length. Note that it’s not the maximum height of the egg because that occurs to the left of the midpoint. (To the left if *k* is positive. The parameter *k* could be negative, which flips the egg about the *y*-axis so that the flatter side is on the right.)

To find *k* we measure the point *x* where the maximum height occurs.

We have the equation

and implicit differentiation shows

At the maximum height the derivative of *y* is zero, and so the right side also equals zero. This lets us solve for *k*.

## Curvature

As *k* increases, the egg gets flatter on the left side and more pointed on the right side. We can quantify this by calculating the curvature at both ends.

For a curve given implicitly by *F*(*x*, *y*) = 0, the curvature is given by

The expression above simplifies greatly at the two points we’re interest in, (±*a*, 0).

And so the curvature reduces to

So in our first example above, with *a* = 4, *b* = 2, and *k* = 0.1, we have a curvature of 0.6 on the left and 1.4 on the right. In the second example with *k* = 0.05, we have a curvature of 0.8 on the left and 1.2 on the right.

See the next post for the volume of an egg, assuming the equation for the shape in this post.

How would this be spun into 3D with, say, the ability to flatten along Z (like a somewhat flattened boiled egg)?

What’s the best way to fit this to data from an actual egg, ie in the presence of noise or where this function is just an approximation to the true shape?

Depends on your purpose. If you want to estimate the volume, for example, I wouldn’t fit a curve. I’d measure how much water it displaces. If you need a precise curve, you might measure a few points with calipers and join them with Bezier splines.