Basic Spheroid Elements Calculator
Primarily for Planetary Meridian and Orbital Parameter Computations - v2.0

ENTER Spheroid Equatorial and Polar $(R ~,~ r)$ Parameters in Any Units $(R \ge r)$

On empty input, Earth spheroid $\small(WGS-84)$ parameters $(R ~,~ r)$, in meters, will be used as the default values.

The program will compute the spheroid elements from the given parameters
using the standard equations and the PHP program function following below.
SPHEROID PARAMETERS

R  = Equatorial radius    = 6378137.0000000000000000 units
r  = Polar radius         = 6356752.3142450000000000 units

f  = Flattening factor    = 0.0033528106647756233521 = 1/298.2572235604965054

e  = Eccentricity         = 0.0818191908429643023611
e²                        = 0.0066943799901974135468

Equatorial Quarter = 10018754.1713946215382942 units
Meridional Quarter = 10001965.7293125819531904 units

Circumference of Equator  = 40075016.6855784861531768 units =  Red Equatorial Circle
Circumference of Meridian = 40007862.9172503278127614 units = Cyan Meridional Ellipse
Circumference Difference  = 67153.7683281583404154 units Given The General Static Spheroid Parameters: $R ~=~$ Equatorial radius of spheroid = Length of semi-major axis ${~\large r} ~=~$ Polar radius of spheroid = Length of semi-minor axis where,  $(R > r)$ Any units of length may be assumed for $(R ~,~ r)$, such as feet, meters, kilometers, miles, etc., just as long as the same units are used consistently. If (R = r), then the form is a perfect sphere, otherwise it is an oblate spheroid or ellipsoid to some degree, generally wider between two opposite equatorial points due to a slight equatorial bulge, than between the opposite polar points. From the given parameters, the eccentricity may be computed from: $(Eq.~1):~~~~~~~~$ \begin{align*} \epsilon ~=~ \sqrt{1 - \frac{{\large r}^2}{R^2}} \end{align*} From which: $(Eq.~2):~~~~~~~~$ \begin{align*} \epsilon^2 ~=~ 1 - \frac{{\large r}^2}{R^2} \end{align*} The eccentricity is the measure of the spheroid deviation from a perfect sphere.  In the special case of a perfect sphere, $(\epsilon = 0)$. Horizontal Circumference Around the Equator A spheroid or ellipsoid has two basic circumferences - an equatorial circumference and a polar or meridian circumference.  They equate to the same numerical value only in the special case of the spheroid equating to a perfect sphere. For Earth, the equatorial horizontal circumference is the length of the equator, the solid red line in the diagram, and computing it simply amounts to computing the classical circumference of a circle of radius $(R)$.  The sphere is actually an ellipsoid with equal parameters.  One of an infinite set or family of ellipsoids, where $\left(0\le ϵ\le 1\right)$.  It just so happens that in the case of a spheroid where $(R = r)$, we call it a sphere instead, attributing to it the single radius $(R)$, resulting in the simplest possible solution to the circumference or perimeter of a spheroid. $(Eq.~3):~~~~~~~~$ $C = 2\pi R$ General Horizontal Equatorial Circumference or Vertical Meridional Circumference The general equation for computing the length of the meridional circumference of an oblate spheroid or ellipsoid can be expressed in the form of an infinite power series defined in terms of the given $(R ~,~ r)$ parameters. $(Eq.~4):~~~~~~~~$ \begin{align*} C ~=~ \large{2\pi{R}\left[ 1 - \sum_{n=1}^\infty \left(\frac{(2n-1)!!~^2}{(2n)!!~^2\cdot(2n-1)}\right) \cdot \left(1 - \large\frac{r^2}{R^2}\right)^{n}\right]} \end{align*} Since in any given instance, the eccentricity $(\epsilon)$ is constant, and recalling $(Eq. 2)$: \begin{align*} \epsilon^2 ~=~ 1 - \large\frac{r^2}{R^2} \end{align*} we can substitute $(\epsilon^2)$ in $(Eq. 4)$ above to reduce it to the simplified form: (Eq.~5):~~~~~~~~ \begin{align*} C ~=~ \large{2\pi{R}\left[ 1 - \sum_{n=1}^\infty \left(\frac{(2n-1)!!~^2}{(2n)!!~^2\cdot(2n-1)}\right) \cdot \epsilon^{2n}\right]} \end{align*} The vertical polar or meridian circumference, the solid cyan elliptical surface outline in the diagram is more complicated because due to the polar flattening, the circumference is elliptical, not circular, and is computed by evaluating the infinite series summation to the desired level of precision. $C = 2\pi R$,   when $(R = {\large r})$ or $(\large \epsilon = 0)$. When $(R \ne {\large r})$ and $(0 \lt ~\large \epsilon~ \lt 1)$, then we have a spheroid or ellipsoid and this general solution applies, which the program solves by evaluating the simplified infinite power series summation given above in terms of powers of the eccentricity $({\large \epsilon})$ and greater radius $(R)$ to compute the general circumference. Physical Applications This program can be applied to computing the lengths of meridians for ellipsoid models of the Earth or other planets like Jupiter or Saturn, the original purpose of the program, or computing the lengths of not-too-extremely-eccentric orbits.  In most practical situations, the eccentricity is generally a relatively small value, so the infinite series evaluates quickly.  An extreme ratio, in this case, means like $(R:{\large r})$ $\gt 4$, could possibly result in a script time-out. For all practical purposes, 16 decimals should be sufficiently accurate, however the PHP function source code, listed below, could be modified to be extended out to even more decimals. NOTES: The general rule is: The higher the eccentricity, or the greater the ratio $(R:{\large r})$, the longer the time it will take to evaluate the power series.  This program does NOT perform intensive error checking, so absurd or extreme input values could result in time-outs or a program crash, such as a division-by-zero or other fatal error.  Valid input should return valid output within the given constraints.  Otherwise, garbage in, garbage out, crash and burn. PLANETARY SPHEROIDS $(R ~,~ r)$ AND EQUATORIAL AND MERIDIONAL CIRCUMFERENCES Known (R, r) Parameters of Planets in Kilometers and Miles Source: NASA These planetary equatorial and meridional circumferences were computed from the given (R, r) parameters using the PHP function listed below. __________________________________________________________ Earth | 6378.1 , 6356.8 km | Equat C = 40074.8 km = 24901.3 mi R r | Diff = 1326.0 km = 824.0 mi 3963.2 , 3949.9 mi | Merid C = 40007.9 km = 24859.8 mi ____________________|_____________________________________ The Moon | 1738.1 , 1736.0 km | Equat C = 6785.8 km = 4216.5 mi R r | Diff = 6.6 km = 4.1 mi 1080.0 , 1078.7 mi | Merid C = 6781.8 km = 4214.0 mi ____________________|_____________________________________ Mars | 3396.2 , 3376.2 km | Equat C = 21339.0 km = 13259.4 mi R r | Diff = 62.8 km = 38.9 mi 2110.3 , 2097.9 mi | Merid C = 21276.2 km = 13220.5 mi ____________________|_____________________________________ Jupiter | 71492 , 66854 km | Equat C = 449197 km = 279118 mi R r | Diff = 14449 km = 8978 mi 44423 , 41541 mi | Merid C = 434749 km = 270140 mi ____________________|_____________________________________ Saturn | 60268 , 54364 km | Equat C = 378675 km = 235298 mi R r | Diff = 18309 km = 11377 mi 37449 , 33780 mi | Merid C = 360366 km = 223921 mi ____________________|_____________________________________ Uranus | 25559 , 24973 km | Equat C = 160592 km = 99787 mi R r | Diff = 1836 km = 1141 mi 15882 , 15518 mi | Merid C = 158756 km = 98647 mi ____________________|_____________________________________ Neptune | 24764 , 24341 km | Equat C = 155597 km = 96683 mi R r | Diff = 1326 km = 824 mi 15388 , 15125 mi | Merid C = 154271 km = 95859 mi  Below is a listing of the PHP function to numerically evaluate $(Eq. 5)$, upon which this program is based. Double-Click to select ALL code /* PHP Ellipse Circumference Function A high-precision numerical solution to the complete elliptic integral of the second kind. Author : Jay Tanner - 2018 License: Public Domain */ function Ellipse_Circum ($RParam='1',$rParam='1') { $R = trim($RParam); $r = trim($rParam); if (!is_numeric($R) or !is_numeric($r)) {return 'ERROR: Invalid argument. Arguments must be purely numeric.';} $TwoPi = '6.28318530717958647692528676655900576839433879875';$decimals = 16; $d =$decimals + 5; if (bccomp($R,$r, $d) < 0) {$w=$R;$R=$r;$r=$w;}$e2 = bcsub('1', bcdiv(bcmul($r,$r, $d), bcmul($R,$R,$d),$d),$d); $n =$e2n = $PrecisionLevel = 1;$sum = 0; $PrecisionLimit = '0.' . str_repeat('0',$d-1) . '1'; while (abs($PrecisionLevel) >$PrecisionLimit) { $N = 2*$n-1; $Y=1; for($n=0; $n <= ceil($N/2) - 1; $n++) {$Y = bcmul($Y,$N - 2*$n);}$Y2 = bcmul($Y,$Y,$d);$N = 2*$n;$X=1; for($n=0;$n <= ceil($N/2) - 1;$n++) {$X = bcmul($X, $N - 2*$n);} $X2 = bcmul($X,$X,$d); $e2n = bcmul($e2n, $e2,$d); $E = bcmul($Y2, $e2n,$d); $F = bcmul($X2, 2*$n-1,$d); $CurrSumTerm = bcdiv($E, $F,$d); $sum = bcadd($sum, $CurrSumTerm,$d); $PrecisionLevel = bcsub($CurrSumTerm, $PrecisionLimit,$d); $n++; }$CurrSumTerm = bcdiv(bcmul($Y2,$e2n, $d), bcmul(2*$n-1,$X2,$d),$d);$w = bcmul($TwoPi, bcmul($R, bcsub('1', $sum,$d), $d),$d); return bcadd($w, '0.'.str_repeat('0',$decimals).'5', \$decimals); } // END OF Ellipse_Circum (...)
References

The Earth Spheroid
https://en.wikipedia.org/wiki/Earth_ellipsoid

Complete Elliptic Integral of the Second Kind
https://en.wikipedia.org/wiki/Elliptic_integral#Complete_elliptic_integral_of_the_second_kind

Ordinance Survey - A Guide to Coordinate Systems in Great Britain
An introduction to mapping coordinate systems and the use of GNSS datasets with Ordnance Survey mapping
https://www.ordnancesurvey.co.uk/docs/support/guide-coordinate-systems-great-britain.pdf

A PHP Science Program by Jay Tanner - Revised: 2021 June 21 Monday at 10:54:08 AM GMT