0

Is it possible to integrate a function that would give the perimeter of an ellipse?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

2 Answers2

5

$c = 4 a \int\limits_{\theta = 0}^{\pi/2} \sqrt{1 - e^2 \sin^2(\theta)} d\theta = a \pi (2 + e^2)$,

where

$a$ is the semi-major axis length and $e$ the eccentricity.

c[a_, e_] := 4 a Integrate[1 + e^2 Sin[θ]^2, {θ, 0, π/2}]

You can visualize the ellipse by:

ellipseplotter[a_, e_] := 
 ParametricPlot[
  a {Cos[θ], e Sin[θ]}, {θ, 0, 2π}]

ellipseplotter[1, .5]

enter image description here

David G. Stork
  • 41,180
  • 3
  • 34
  • 96
  • first formula shows one minus, but the same (?) formula in the definition of c says one plus... did I miss something? – Michael Sep 06 '20 at 05:47
  • $a \pi (2 + e^2)$ is NOT the perimeter. The integral you start with is correct but you have missed the Sqrt when evaluating this integral. The correct expression is c[a_, e_] = 4 a Integrate[Sqrt[1 - e^2 Sin[θ]^2], {θ, 0, π/2}, Assumptions -> {0 < e < 1}] which yields 4 a EllipticE[e^2] – lakshayg Sep 06 '20 at 18:23
  • The ellipseplotter expression is a little misleading as well, the parametric equation of an ellipse is {a Cos[θ], b Sin[θ]} which is equivalent to a {Cos[θ], Sqrt[1 - e^2] Sin[θ]}. The equation that you have used represents an ellipse with eccentricity $\sqrt{1 - e^2}$ and not $e$ – lakshayg Sep 06 '20 at 18:38
3

To illustrate parametric approach and ArcLength (I acknowledge this was mentioned by @Carl Woll):

r[a_, b_, u_] := {a Cos[u], b Sin[u]}
perimeter[a_, b_] := 
 NIntegrate[
  Sqrt[FullSimplify[D[r[a, b, u], u].D[r[a, b, u], u]]], {u, 0, 2 Pi}]
Manipulate[
 ParametricPlot[r[a, b, t], {t, 0, 2 Pi}, 
  PlotLabel -> 
   Grid[{{"perimeter:", perimeter[a, b]}, {Style["ArcLength", Bold], 
      ArcLength[r[a, b, u], {u, 0, 2 Pi}]}}], 
  PlotRange -> Table[{-3, 3}, 2]], {a, 1, 3}, {b, 1, 3}]

enter image description here

ubpdqn
  • 60,617
  • 3
  • 59
  • 148