Article 3N1RW Equation to fit an egg

Equation to fit an egg

by
John
from John D. Cook on (#3N1RW)

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

egg_equation5.svg

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} ]

egg_graph.svg

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

egg_graph2.svg

Solving for parameters

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

Setting y = 0 shows that 2a 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

egg_equation6.svg

and implicit differentiation shows

egg_equation7.svg

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

egg_equation8.svg

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

implicit_curvature.svg

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

implicit_curvature_calcs.svg

And so the curvature reduces to

egg_curvature.svg

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.

Related postsu2kowJ3Cgr4
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments