Re: circumference of an ellipse
- To: mathgroup at smc.vnet.net
- Subject: [mg19314] Re: [mg19299] circumference of an ellipse
- From: "Tomas Garza" <tgarza at mail.internet.com.mx>
- Date: Sat, 14 Aug 1999 23:42:47 -0400
- Sender: owner-wri-mathgroup at wolfram.com
M.J.M. Maes [mar.maes at wxs.nl] wrote: > I made a little spreadsheetfile to calculate the circumference (length) of > an ellipse using an iterative process. > When I compare the results with the results of a formula to > approximate the > lenght > - which is pi(3(a+b)-sqrt((a+3b)(3a+b))) - the difference is > greater then I > expected (a few percents). > This may be a shortcoming of the approximation formula, or of my > worksheetformulae. > Could someone please give me the exact results (in 10 or 15 > digits) of some > examples? > a=2; b=1 > a=5; b=1 > a=100; b=26 Several people have already given the answer to this problem, and Allan Hayes among them provides a neat, straightforward solution [mg19292]. I thought it might be useful to suggest an approximation based on the plot points. The equation for the ellipse is In[1]:= Clear[f]; f[x_, a_, b_] := b*Sqrt[1 - (x/a)^2] and its plot (or, rather, the upper half of its plot) is obtained through In[2]:= halfCircum = Plot[f[x, 1, 1], {x, -1, 1}]; This case is, of course, a circle of radius 1. The plot is constructed by a number of lines joining succesive points along the circumference. These points are extracted and the length of the line joining successive pairs of points is then calculated: In[3]:= ptseq = Cases[halfCircum, Line[{x__}] -> x, Infinity]; In[4]:= pairs = MapThread[ List, {ptseq, Partition[Flatten[{Rest[ptseq], First[ptseq]}], 2]}]; In[5]:= dist[{a_, b_}] := Sqrt[Plus @@ ((a - b)^2)] In[6]:= 2*Plus @@ (dist /@ Drop[pairs, -1]) (The factor 2 takes into account the other half of the circumference) Out[6]= 6.283 which is roughly 2 Pi, with an error of less than 3/10000. This simple procedure gives the following results for other cases: a = 2, b = 1; Plot approximation: 9.68828 Exact to 30 decimals (Hayes): 9.68844822054767619842850319639 a = 5, b = 1; Plot approximation: 21.0098 Exact (Hayes): 21.0100445396890009446991645885 a = 100, b = 20; Plot approximation: 420.196 Exact (Hayes): 420.200890793780018893983291769 Tomas Garza Mexico City