This file is indexed.

/usr/share/doc/geographiclib/html/geodesic.html is in geographiclib-doc 1.49-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>GeographicLib: Geodesics on an ellipsoid of revolution</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="/usr/share/javascript/mathjax/MathJax.js/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">GeographicLib
   &#160;<span id="projectnumber">1.49</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Geodesics on an ellipsoid of revolution </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><center> Back to <a class="el" href="magnetic.html">Magnetic models</a>. Forward to <a class="el" href="nearest.html">Finding nearest neighbors</a>. Up to <a class="el" href="index.html#contents">Contents</a>. </center><p><a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations ">Geodesic</a> and <a class="el" href="classGeographicLib_1_1GeodesicLine.html" title="A geodesic line. ">GeodesicLine</a> provide accurate solutions to the direct and inverse geodesic problems. The <a href="GeodSolve.1.html">GeodSolve</a> utility provides an interface to these classes. <a class="el" href="classGeographicLib_1_1AzimuthalEquidistant.html" title="Azimuthal equidistant projection. ">AzimuthalEquidistant</a> implements the azimuthal equidistant projection in terms of geodesics. <a class="el" href="classGeographicLib_1_1CassiniSoldner.html" title="Cassini-Soldner projection. ">CassiniSoldner</a> implements a transverse cylindrical equidistant projection in terms of geodesics. The <a href="GeodesicProj.1.html">GeodesicProj</a> utility provides an interface to these projections.</p>
<p>The algorithms used by <a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations ">Geodesic</a> and <a class="el" href="classGeographicLib_1_1GeodesicLine.html" title="A geodesic line. ">GeodesicLine</a> are based on a Taylor expansion of the geodesic integrals valid when the flattening <em>f</em> is small. <a class="el" href="classGeographicLib_1_1GeodesicExact.html" title="Exact geodesic calculations. ">GeodesicExact</a> and <a class="el" href="classGeographicLib_1_1GeodesicLineExact.html" title="An exact geodesic line. ">GeodesicLineExact</a> evaluate the integrals exactly (in terms of incomplete elliptic integrals). For the WGS84 ellipsoid, the series solutions are about 2&ndash;3 times faster and 2&ndash;3 times more accurate (because it's easier to control round-off errors with series solutions); thus <a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations ">Geodesic</a> and <a class="el" href="classGeographicLib_1_1GeodesicLine.html" title="A geodesic line. ">GeodesicLine</a> are recommended for most geodetic applications. However, in applications where the absolute value of <em>f</em> is greater than about 0.02, the exact classes should be used.</p>
<p>Go to</p><ul>
<li><a class="el" href="geodesic.html#testgeod">Test data for geodesics</a></li>
<li><a class="el" href="geodesic.html#geodseries">Expansions for geodesics</a></li>
<li><a class="el" href="geodesic.html#geodellip">Geodesics in terms of elliptic integrals</a></li>
<li><a class="el" href="geodesic.html#meridian">Parameters for the meridian</a></li>
<li><a class="el" href="geodesic.html#geodshort">Short geodesics</a></li>
</ul>
<p>For some background information on geodesics on triaxial ellipsoids, see <a class="el" href="triaxial.html">Geodesics on a triaxial ellipsoid</a>.</p>
<p>References:</p><ul>
<li>F. W. Bessel, <a href="https://doi.org/10.1002/asna.201011352">The calculation of longitude and latitude from geodesic measurements (1825)</a>, Astron. Nachr. 331(8), 852&ndash;861 (2010); translated by C. F. F. Karney and R. E. Deakin; preprint: <a href="https://arxiv.org/abs/0908.1824">arXiv:0908.1824</a>.</li>
<li>F. R. Helmert, <a href="https://doi.org/10.5281/zenodo.32050">Mathematical and Physical Theories of Higher Geodesy, Part 1 (1880)</a>, Aeronautical Chart and Information Center (St. Louis, 1964), Chaps. 5&ndash;7.</li>
<li>J. Danielsen, The area under the geodesic, Survey Review 30(232), 61&ndash;66 (1989). DOI: <a href="https://doi.org/10.1179/003962689791474267">10.1179/003962689791474267</a></li>
<li>C. F. F. Karney, <a href="https://doi.org/10.1007/s00190-012-0578-z">Algorithms for geodesics</a>, J. Geodesy 87(1), 43&ndash;55 (2013); DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">10.1007/s00190-012-0578-z</a>; addenda: <a href="https://geographiclib.sourceforge.io/geod-addenda.html">geod-addenda.html</a>; resource page: <a href="https://geographiclib.sourceforge.io/geod.html">geod.html</a>.</li>
<li>A collection of some papers on geodesics is available at <a href="https://geographiclib.sourceforge.io/geodesic-papers/biblio.html">https://geographiclib.sourceforge.io/geodesic-papers/biblio.html</a></li>
<li>The wikipedia page, <a href="https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid">Geodesics on an ellipsoid</a>.</li>
</ul>
<h1><a class="anchor" id="testgeod"></a>
Test data for geodesics</h1>
<p>A test set a geodesics is available at</p><ul>
<li><a href="https://sourceforge.net/projects/geographiclib/files/testdata/GeodTest.dat.gz">GeodTest.dat.gz</a></li>
<li>C. F. F. Karney, <em>Test set for geodesics</em> (2010), <br />
 DOI: <a href="https://doi.org/10.5281/zenodo.32156">10.5281/zenodo.32156</a>.</li>
</ul>
<p>This is about 39 MB (compressed). This consists of a set of geodesics for the WGS84 ellipsoid. A subset of this (consisting of 1/50 of the members &mdash; about 690 kB, compressed) is available at</p><ul>
<li><a href="https://sourceforge.net/projects/geographiclib/files/testdata/GeodTest-short.dat.gz">GeodTest-short.dat.gz</a></li>
</ul>
<p>Each line of the test set gives 10 space delimited numbers</p><ul>
<li>latitude at point 1, <em>lat1</em> (degrees, exact)</li>
<li>longitude at point 1, <em>lon1</em> (degrees, always 0)</li>
<li>azimuth at point 1, <em>azi1</em> (clockwise from north in degrees, exact)</li>
<li>latitude at point 2, <em>lat2</em> (degrees, accurate to 10<sup>&minus;18</sup> deg)</li>
<li>longitude at point 2, <em>lon2</em> (degrees, accurate to 10<sup>&minus;18</sup> deg)</li>
<li>azimuth at point 2, <em>azi2</em> (degrees, accurate to 10<sup>&minus;18</sup> deg)</li>
<li>geodesic distance from point 1 to point 2, <em>s12</em> (meters, exact)</li>
<li>arc distance on the auxiliary sphere, <em>a12</em> (degrees, accurate to 10<sup>&minus;18</sup> deg)</li>
<li>reduced length of the geodesic, <em>m12</em> (meters, accurate to 0.1&#160;pm)</li>
<li>the area under the geodesic, <em>S12</em> (m<sup>2</sup>, accurate to 1&#160;mm<sup>2</sup>)</li>
</ul>
<p>These are computed using as direct geodesic calculations with the given <em>lat1</em>, <em>lon1</em>, <em>azi1</em>, and <em>s12</em>. The distance <em>s12</em> always corresponds to an arc length <em>a12</em> &le; 180&deg;, so the given geodesics give the shortest paths from point 1 to point 2. For simplicity and without loss of generality, <em>lat1</em> is chosen in [0&deg;, 90&deg;], <em>lon1</em> is taken to be zero, <em>azi1</em> is chosen in [0&deg;, 180&deg;]. Furthermore, <em>lat1</em> and <em>azi1</em> are taken to be multiples of 10<sup>&minus;12</sup> deg and <em>s12</em> is a multiple of 0.1&#160;&mu;m in [0&#160;m, 20003931.4586254&#160;m]. This results in <em>lon2</em> in [0&deg;, 180&deg;] and <em>azi2</em> in [0&deg;, 180&deg;].</p>
<p>The direct calculation uses an expansion of the geodesic equations accurate to <em>f</em><sup>30</sup> (approximately 1 part in 10<sup>50</sup>) and is computed with with <a href="https://en.wikipedia.org/wiki/Maxima_(software)">Maxima</a>'s bfloats and fpprec set to 100 (so the errors in the data are probably 1/2 of the values quoted above).</p>
<p>The contents of the file are as follows:</p><ul>
<li>100000 entries randomly distributed</li>
<li>50000 entries which are nearly antipodal</li>
<li>50000 entries with short distances</li>
<li>50000 entries with one end near a pole</li>
<li>50000 entries with both ends near opposite poles</li>
<li>50000 entries which are nearly meridional</li>
<li>50000 entries which are nearly equatorial</li>
<li>50000 entries running between vertices (<em>azi1</em> = <em>azi2</em> = 90&deg;)</li>
<li>50000 entries ending close to vertices</li>
</ul>
<p>(a total of 500000 entries). The values for <em>s12</em> for the geodesics running between vertices are truncated to a multiple of 0.1&#160;pm and this is used to determine point 2.</p>
<p>This data can be fed to the <a href="GeodSolve.1.html">GeodSolve</a> utility as follows</p><ul>
<li>Direct from point 1: <pre class="fragment">  gunzip -c GeodTest.dat.gz | cut -d' ' -f1,2,3,7 | ./GeodSolve
</pre> This should yield columns 4, 5, 6, and 9 of the test set.</li>
<li>Direct from point 2: <pre class="fragment">  gunzip -c GeodTest.dat.gz | cut -d' ' -f4,5,6,7 |
  sed "s/ \([^ ]*$\)/ -\1/" | ./GeodSolve
</pre> (The sed command negates the distance.) This should yield columns 1, 2, and 3, and the negative of column 9 of the test set.</li>
<li>Inverse between points 1 and 2: <pre class="fragment">  gunzip -c GeodTest.dat.gz | cut -d' ' -f1,2,4,5 | ./GeodSolve -i
</pre> This should yield columns 3, 6, 7, and 9 of the test set.</li>
</ul>
<p>Add, e.g., "-p 6", to the call to GeodSolve to change the precision of the output. Adding "-f" causes GeodSolve to print 12 fields specifying the geodesic; these include the 10 fields in the test set plus the geodesic scales <em>M12</em> and <em>M21</em> which are inserted between <em>m12</em> and <em>S12</em>.</p>
<p>Code for computing arbitrarily accurate geodesics in maxima is available in <a href="geodesic.mac">geodesic.mac</a> (this depends on <a href="ellint.mac">ellint.mac</a> and uses the series computed by <a href="geod.mac">geod.mac</a>). This solve both the direct and inverse geodesic problems and offers the ability to solve the problems either using series expansions (similar to <a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations ">Geodesic</a>) or in terms of elliptic integrals (similar to <a class="el" href="classGeographicLib_1_1GeodesicExact.html" title="Exact geodesic calculations. ">GeodesicExact</a>).</p>
<h1><a class="anchor" id="geodseries"></a>
Expansions for geodesics</h1>
<p>We give here the series expansions for the various geodesic integrals valid to order <em>f</em><sup>10</sup>. In this release of the code, we use a 6th-order expansions. This is sufficient to maintain accuracy for doubles for the SRMmax ellipsoid (<em>a</em> = 6400&#160;km, <em>f</em> = 1/150). However, the preprocessor macro GEOGRAPHICLIB_GEODESIC_ORDER can be used to select an order from 3 thru 8. (If using long doubles, with a 64-bit fraction, the default order is 7.) The series expanded to order <em>f</em><sup>30</sup> are given in <a href="geodseries30.html">geodseries30.html</a>.</p>
<p>In the formulas below ^ indicates exponentiation (<em>f</em>^3 = <em>f</em><sup>3</sup>) and / indicates real division (3/5 = 0.6). The equations need to be converted to Horner form, but are here left in expanded form so that they can be easily truncated to lower order. These expansions were obtained using the Maxima code, <a href="geod.mac">geod.mac</a>.</p>
<p>In the expansions below, we have</p><ul>
<li>\( \alpha \) is the azimuth</li>
<li>\( \alpha_0 \) is the azimuth at the equator crossing</li>
<li>\( \lambda \) is the longitude measured from the equator crossing</li>
<li>\( \sigma \) is the spherical arc length</li>
<li>\( \omega = \tan^{-1}(\sin\alpha_0\tan\sigma) \) is the spherical longitude</li>
<li>\( a \) is the equatorial radius</li>
<li>\( b \) is the polar semi-axis</li>
<li>\( f \) is the flattening</li>
<li>\( e^2 = f(2 - f) \)</li>
<li>\( e&#39;^2 = e^2/(1-e^2) \)</li>
<li>\( k^2 = e&#39;^2 \cos^2\alpha_0 = 4 \epsilon / (1 - \epsilon)^2 \)</li>
<li>\( n = f / (2 - f) \)</li>
<li>\( c^2 = a^2/2 + b^2/2 (\tanh^{-1}e)/e \)</li>
<li><em>ep2</em> = \( e&#39;^2 \)</li>
<li><em>k2</em> = \( k^2 \)</li>
<li><em>eps</em> = \( \epsilon = k^2 / (\sqrt{1 + k^2} + 1)^2\)</li>
</ul>
<p>The formula for distance is </p><p class="formulaDsp">
\[ \frac sb = I_1(\sigma) \]
</p>
<p> where </p><p class="formulaDsp">
\[ \begin{align} I_1(\sigma) &amp;= A_1\bigl(\sigma + B_1(\sigma)\bigr) \\ B_1(\sigma) &amp;= \sum_{j=1} C_{1j} \sin 2j\sigma \end{align} \]
</p>
<p> and </p><pre class="fragment">A1 = (1 + 1/4 * eps^2
        + 1/64 * eps^4
        + 1/256 * eps^6
        + 25/16384 * eps^8
        + 49/65536 * eps^10) / (1 - eps);
</pre> <pre class="fragment">C1[1] = - 1/2 * eps
        + 3/16 * eps^3
        - 1/32 * eps^5
        + 19/2048 * eps^7
        - 3/4096 * eps^9;
C1[2] = - 1/16 * eps^2
        + 1/32 * eps^4
        - 9/2048 * eps^6
        + 7/4096 * eps^8
        + 1/65536 * eps^10;
C1[3] = - 1/48 * eps^3
        + 3/256 * eps^5
        - 3/2048 * eps^7
        + 17/24576 * eps^9;
C1[4] = - 5/512 * eps^4
        + 3/512 * eps^6
        - 11/16384 * eps^8
        + 3/8192 * eps^10;
C1[5] = - 7/1280 * eps^5
        + 7/2048 * eps^7
        - 3/8192 * eps^9;
C1[6] = - 7/2048 * eps^6
        + 9/4096 * eps^8
        - 117/524288 * eps^10;
C1[7] = - 33/14336 * eps^7
        + 99/65536 * eps^9;
C1[8] = - 429/262144 * eps^8
        + 143/131072 * eps^10;
C1[9] = - 715/589824 * eps^9;
C1[10] = - 2431/2621440 * eps^10;
</pre><p>The function \( \tau(\sigma) = s/(b A_1) = \sigma + B_1(\sigma) \) may be inverted by series reversion giving </p><p class="formulaDsp">
\[ \sigma(\tau) = \tau + \sum_{j=1} C&#39;_{1j} \sin 2j\sigma \]
</p>
<p> where </p><pre class="fragment">C1'[1] = + 1/2 * eps
         - 9/32 * eps^3
         + 205/1536 * eps^5
         - 4879/73728 * eps^7
         + 9039/327680 * eps^9;
C1'[2] = + 5/16 * eps^2
         - 37/96 * eps^4
         + 1335/4096 * eps^6
         - 86171/368640 * eps^8
         + 4119073/28311552 * eps^10;
C1'[3] = + 29/96 * eps^3
         - 75/128 * eps^5
         + 2901/4096 * eps^7
         - 443327/655360 * eps^9;
C1'[4] = + 539/1536 * eps^4
         - 2391/2560 * eps^6
         + 1082857/737280 * eps^8
         - 2722891/1548288 * eps^10;
C1'[5] = + 3467/7680 * eps^5
         - 28223/18432 * eps^7
         + 1361343/458752 * eps^9;
C1'[6] = + 38081/61440 * eps^6
         - 733437/286720 * eps^8
         + 10820079/1835008 * eps^10;
C1'[7] = + 459485/516096 * eps^7
         - 709743/163840 * eps^9;
C1'[8] = + 109167851/82575360 * eps^8
         - 550835669/74317824 * eps^10;
C1'[9] = + 83141299/41287680 * eps^9;
C1'[10] = + 9303339907/2972712960 * eps^10;
</pre><p>The reduced length is given by </p><p class="formulaDsp">
\[ \begin{align} \frac mb &amp;= \sqrt{1 + k^2 \sin^2\sigma_2} \cos\sigma_1 \sin\sigma_2 \\ &amp;\quad {}-\sqrt{1 + k^2 \sin^2\sigma_1} \sin\sigma_1 \cos\sigma_2 \\ &amp;\quad {}-\cos\sigma_1 \cos\sigma_2 \bigl(J(\sigma_2) - J(\sigma_1)\bigr) \end{align} \]
</p>
<p> where </p><p class="formulaDsp">
\[ \begin{align} J(\sigma) &amp;= I_1(\sigma) - I_2(\sigma) \\ I_2(\sigma) &amp;= A_2\bigl(\sigma + B_2(\sigma)\bigr) \\ B_2(\sigma) &amp;= \sum_{j=1} C_{2j} \sin 2j\sigma \end{align} \]
</p>
 <pre class="fragment">A2 = (1 - 3/4 * eps^2
        - 7/64 * eps^4
        - 11/256 * eps^6
        - 375/16384 * eps^8
        - 931/65536 * eps^10) / (1 + eps);
</pre> <pre class="fragment">C2[1] = + 1/2 * eps
        + 1/16 * eps^3
        + 1/32 * eps^5
        + 41/2048 * eps^7
        + 59/4096 * eps^9;
C2[2] = + 3/16 * eps^2
        + 1/32 * eps^4
        + 35/2048 * eps^6
        + 47/4096 * eps^8
        + 557/65536 * eps^10;
C2[3] = + 5/48 * eps^3
        + 5/256 * eps^5
        + 23/2048 * eps^7
        + 191/24576 * eps^9;
C2[4] = + 35/512 * eps^4
        + 7/512 * eps^6
        + 133/16384 * eps^8
        + 47/8192 * eps^10;
C2[5] = + 63/1280 * eps^5
        + 21/2048 * eps^7
        + 51/8192 * eps^9;
C2[6] = + 77/2048 * eps^6
        + 33/4096 * eps^8
        + 2607/524288 * eps^10;
C2[7] = + 429/14336 * eps^7
        + 429/65536 * eps^9;
C2[8] = + 6435/262144 * eps^8
        + 715/131072 * eps^10;
C2[9] = + 12155/589824 * eps^9;
C2[10] = + 46189/2621440 * eps^10;
</pre><p>The longitude is given in terms of the spherical longitude by </p><p class="formulaDsp">
\[ \lambda = \omega - f \sin\alpha_0 I_3(\sigma) \]
</p>
<p> where </p><p class="formulaDsp">
\[ \begin{align} I_3(\sigma) &amp;= A_3\bigl(\sigma + B_3(\sigma)\bigr) \\ B_3(\sigma) &amp;= \sum_{j=1} C_{3j} \sin 2j\sigma \end{align} \]
</p>
<p> and </p><pre class="fragment">A3 = 1 - (1/2 - 1/2*n) * eps
       - (1/4 + 1/8*n - 3/8*n^2) * eps^2
       - (1/16 + 3/16*n + 1/16*n^2 - 5/16*n^3) * eps^3
       - (3/64 + 1/32*n + 5/32*n^2 + 5/128*n^3 - 35/128*n^4) * eps^4
       - (3/128 + 5/128*n + 5/256*n^2 + 35/256*n^3 + 7/256*n^4) * eps^5
       - (5/256 + 15/1024*n + 35/1024*n^2 + 7/512*n^3) * eps^6
       - (25/2048 + 35/2048*n + 21/2048*n^2) * eps^7
       - (175/16384 + 35/4096*n) * eps^8
       - 245/32768 * eps^9;
</pre> <pre class="fragment">C3[1] = + (1/4 - 1/4*n) * eps
        + (1/8 - 1/8*n^2) * eps^2
        + (3/64 + 3/64*n - 1/64*n^2 - 5/64*n^3) * eps^3
        + (5/128 + 1/64*n + 1/64*n^2 - 1/64*n^3 - 7/128*n^4) * eps^4
        + (3/128 + 11/512*n + 3/512*n^2 + 1/256*n^3 - 7/512*n^4) * eps^5
        + (21/1024 + 5/512*n + 13/1024*n^2 + 1/512*n^3) * eps^6
        + (243/16384 + 189/16384*n + 83/16384*n^2) * eps^7
        + (435/32768 + 109/16384*n) * eps^8
        + 345/32768 * eps^9;
C3[2] = + (1/16 - 3/32*n + 1/32*n^2) * eps^2
        + (3/64 - 1/32*n - 3/64*n^2 + 1/32*n^3) * eps^3
        + (3/128 + 1/128*n - 9/256*n^2 - 3/128*n^3 + 7/256*n^4) * eps^4
        + (5/256 + 1/256*n - 1/128*n^2 - 7/256*n^3 - 3/256*n^4) * eps^5
        + (27/2048 + 69/8192*n - 39/8192*n^2 - 47/4096*n^3) * eps^6
        + (187/16384 + 39/8192*n + 31/16384*n^2) * eps^7
        + (287/32768 + 47/8192*n) * eps^8
        + 255/32768 * eps^9;
C3[3] = + (5/192 - 3/64*n + 5/192*n^2 - 1/192*n^3) * eps^3
        + (3/128 - 5/192*n - 1/64*n^2 + 5/192*n^3 - 1/128*n^4) * eps^4
        + (7/512 - 1/384*n - 77/3072*n^2 + 5/3072*n^3 + 65/3072*n^4) * eps^5
        + (3/256 - 1/1024*n - 71/6144*n^2 - 47/3072*n^3) * eps^6
        + (139/16384 + 143/49152*n - 383/49152*n^2) * eps^7
        + (243/32768 + 95/49152*n) * eps^8
        + 581/98304 * eps^9;
C3[4] = + (7/512 - 7/256*n + 5/256*n^2 - 7/1024*n^3 + 1/1024*n^4) * eps^4
        + (7/512 - 5/256*n - 7/2048*n^2 + 9/512*n^3 - 21/2048*n^4) * eps^5
        + (9/1024 - 43/8192*n - 129/8192*n^2 + 39/4096*n^3) * eps^6
        + (127/16384 - 23/8192*n - 165/16384*n^2) * eps^7
        + (193/32768 + 3/8192*n) * eps^8
        + 171/32768 * eps^9;
C3[5] = + (21/2560 - 9/512*n + 15/1024*n^2 - 7/1024*n^3 + 9/5120*n^4) * eps^5
        + (9/1024 - 15/1024*n + 3/2048*n^2 + 57/5120*n^3) * eps^6
        + (99/16384 - 91/16384*n - 781/81920*n^2) * eps^7
        + (179/32768 - 55/16384*n) * eps^8
        + 141/32768 * eps^9;
C3[6] = + (11/2048 - 99/8192*n + 275/24576*n^2 - 77/12288*n^3) * eps^6
        + (99/16384 - 275/24576*n + 55/16384*n^2) * eps^7
        + (143/32768 - 253/49152*n) * eps^8
        + 33/8192 * eps^9;
C3[7] = + (429/114688 - 143/16384*n + 143/16384*n^2) * eps^7
        + (143/32768 - 143/16384*n) * eps^8
        + 429/131072 * eps^9;
C3[8] = + (715/262144 - 429/65536*n) * eps^8
        + 429/131072 * eps^9;
C3[9] = + 2431/1179648 * eps^9;
</pre><p>The formula for area between the geodesic and the equator is given in Sec. 6 of <a href="https://doi.org/10.1007/s00190-012-0578-z">Algorithms for geodesics</a> in terms of <em>S</em>, </p><p class="formulaDsp">
\[ S = c^2 \alpha + e^2 a^2 \cos\alpha_0 \sin\alpha_0 I_4(\sigma) \]
</p>
<p> where </p><p class="formulaDsp">
\[ I_4(\sigma) = \sum_{j=0} C_{4j} \cos(2j+1)\sigma \]
</p>
<p> In the paper, this was expanded in \( e&#39;^2 \) and \( k^2 \). However, the series converges faster for eccentric ellipsoids if the expansion is in \( n \) and \( \epsilon \). The series to order \( f^{10} \) becomes </p><pre class="fragment">C4[0] = + (2/3 - 4/15*n + 8/105*n^2 + 4/315*n^3 + 16/3465*n^4 + 20/9009*n^5 + 8/6435*n^6 + 28/36465*n^7 + 32/62985*n^8 + 4/11305*n^9)
        - (1/5 - 16/35*n + 32/105*n^2 - 16/385*n^3 - 64/15015*n^4 - 16/15015*n^5 - 32/85085*n^6 - 112/692835*n^7 - 128/1616615*n^8) * eps
        - (2/105 + 32/315*n - 1088/3465*n^2 + 1184/5005*n^3 - 128/3465*n^4 - 3232/765765*n^5 - 1856/1616615*n^6 - 6304/14549535*n^7) * eps^2
        + (11/315 - 368/3465*n - 32/6435*n^2 + 976/4095*n^3 - 154048/765765*n^4 + 368/11115*n^5 + 5216/1322685*n^6) * eps^3
        + (4/1155 + 1088/45045*n - 128/1287*n^2 + 64/3927*n^3 + 2877184/14549535*n^4 - 370112/2078505*n^5) * eps^4
        + (97/15015 - 464/45045*n + 4192/153153*n^2 - 88240/969969*n^3 + 31168/1322685*n^4) * eps^5
        + (10/9009 + 4192/765765*n - 188096/14549535*n^2 + 23392/855855*n^3) * eps^6
        + (193/85085 - 6832/2078505*n + 106976/14549535*n^2) * eps^7
        + (632/1322685 + 3456/1616615*n) * eps^8
        + 107/101745 * eps^9;
C4[1] = + (1/45 - 16/315*n + 32/945*n^2 - 16/3465*n^3 - 64/135135*n^4 - 16/135135*n^5 - 32/765765*n^6 - 112/6235515*n^7 - 128/14549535*n^8) * eps
        - (2/105 - 64/945*n + 128/1485*n^2 - 1984/45045*n^3 + 256/45045*n^4 + 64/109395*n^5 + 128/855855*n^6 + 2368/43648605*n^7) * eps^2
        - (1/105 - 16/2079*n - 5792/135135*n^2 + 3568/45045*n^3 - 103744/2297295*n^4 + 264464/43648605*n^5 + 544/855855*n^6) * eps^3
        + (4/1155 - 2944/135135*n + 256/9009*n^2 + 17536/765765*n^3 - 3053056/43648605*n^4 + 1923968/43648605*n^5) * eps^4
        + (1/9009 + 16/19305*n - 2656/153153*n^2 + 65072/2078505*n^3 + 526912/43648605*n^4) * eps^5
        + (10/9009 - 1472/459459*n + 106112/43648605*n^2 - 204352/14549535*n^3) * eps^6
        + (349/2297295 + 28144/43648605*n - 32288/8729721*n^2) * eps^7
        + (632/1322685 - 44288/43648605*n) * eps^8
        + 43/479655 * eps^9;
C4[2] = + (4/525 - 32/1575*n + 64/3465*n^2 - 32/5005*n^3 + 128/225225*n^4 + 32/765765*n^5 + 64/8083075*n^6 + 32/14549535*n^7) * eps^2
        - (8/1575 - 128/5775*n + 256/6825*n^2 - 6784/225225*n^3 + 4608/425425*n^4 - 128/124355*n^5 - 5888/72747675*n^6) * eps^3
        - (8/1925 - 1856/225225*n - 128/17325*n^2 + 42176/1276275*n^3 - 2434816/72747675*n^4 + 195136/14549535*n^5) * eps^4
        + (8/10725 - 128/17325*n + 64256/3828825*n^2 - 128/25935*n^3 - 266752/10392525*n^4) * eps^5
        - (4/25025 + 928/3828825*n + 292288/72747675*n^2 - 106528/6613425*n^3) * eps^6
        + (464/1276275 - 17152/10392525*n + 83456/72747675*n^2) * eps^7
        + (1168/72747675 + 128/1865325*n) * eps^8
        + 208/1119195 * eps^9;
C4[3] = + (8/2205 - 256/24255*n + 512/45045*n^2 - 256/45045*n^3 + 1024/765765*n^4 - 256/2909907*n^5 - 512/101846745*n^6) * eps^3
        - (16/8085 - 1024/105105*n + 2048/105105*n^2 - 1024/51051*n^3 + 4096/373065*n^4 - 1024/357357*n^5) * eps^4
        - (136/63063 - 256/45045*n + 512/1072071*n^2 + 494336/33948915*n^3 - 44032/1996995*n^4) * eps^5
        + (64/315315 - 16384/5360355*n + 966656/101846745*n^2 - 868352/101846745*n^3) * eps^6
        - (16/97461 + 14848/101846745*n + 74752/101846745*n^2) * eps^7
        + (5024/33948915 - 96256/101846745*n) * eps^8
        - 1744/101846745 * eps^9;
C4[4] = + (64/31185 - 512/81081*n + 1024/135135*n^2 - 512/109395*n^3 + 2048/1247103*n^4 - 2560/8729721*n^5) * eps^4
        - (128/135135 - 2048/405405*n + 77824/6891885*n^2 - 198656/14549535*n^3 + 8192/855855*n^4) * eps^5
        - (512/405405 - 2048/530145*n + 299008/130945815*n^2 + 280576/43648605*n^3) * eps^6
        + (128/2297295 - 2048/1438965*n + 241664/43648605*n^2) * eps^7
        - (17536/130945815 + 1024/43648605*n) * eps^8
        + 2944/43648605 * eps^9;
C4[5] = + (128/99099 - 2048/495495*n + 4096/765765*n^2 - 6144/1616615*n^3 + 8192/4849845*n^4) * eps^5
        - (256/495495 - 8192/2807805*n + 376832/53348295*n^2 - 8192/855855*n^3) * eps^6
        - (6784/8423415 - 432128/160044885*n + 397312/160044885*n^2) * eps^7
        + (512/53348295 - 16384/22863555*n) * eps^8
        - 16768/160044885 * eps^9;
C4[6] = + (512/585585 - 4096/1422135*n + 8192/2078505*n^2 - 4096/1322685*n^3) * eps^6
        - (1024/3318315 - 16384/9006855*n + 98304/21015995*n^2) * eps^7
        - (103424/189143955 - 8192/4203199*n) * eps^8
        - 1024/189143955 * eps^9;
C4[7] = + (1024/1640925 - 65536/31177575*n + 131072/43648605*n^2) * eps^7
        - (2048/10392525 - 262144/218243025*n) * eps^8
        - 84992/218243025 * eps^9;
C4[8] = + (16384/35334585 - 131072/82447365*n) * eps^8
        - 32768/247342095 * eps^9;
C4[9] = + 32768/92147055 * eps^9;
</pre><h1><a class="anchor" id="geodellip"></a>
Geodesics in terms of elliptic integrals</h1>
<p><a class="el" href="classGeographicLib_1_1GeodesicExact.html" title="Exact geodesic calculations. ">GeodesicExact</a> and <a class="el" href="classGeographicLib_1_1GeodesicLineExact.html" title="An exact geodesic line. ">GeodesicLineExact</a> solve the geodesic problem using elliptic integrals. The formulation of geodesic in terms of incomplete elliptic integrals is given in</p><ul>
<li>C. F. F. Karney, <a href="https://arxiv.org/abs/1102.1215v1">Geodesics on an ellipsoid of revolution</a>, Feb. 2011; preprint <a href="https://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.</li>
</ul>
<p>It is most convenient to use the form derived for a prolate ellipsoid in Appendix D. For an oblate ellipsoid this results in elliptic integrals with an imaginary modulus. However, the integrals themselves are real and the algorithms used to compute the elliptic integrals handles the case of an imaginary modulus using real arithmetic.</p>
<p>The key relations used by <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> are </p><p class="formulaDsp">
\[ \begin{align} \frac sb &amp;= E(\sigma, ik), \\ \lambda &amp;= (1 - f) \sin\alpha_0 G(\sigma, \cos^2\alpha_0, ik) \\ &amp;= \chi - \frac{e&#39;^2}{\sqrt{1+e&#39;^2}}\sin\alpha_0 H(\sigma, -e&#39;^2, ik), \\ J(\sigma) &amp;= k^2 D(\sigma, ik), \end{align} \]
</p>
<p> where \( \chi \) is a modified spherical longitude given by </p><p class="formulaDsp">
\[ \tan\chi = \sqrt{\frac{1+e&#39;^2}{1+k^2\sin^2\sigma}}\tan\omega, \]
</p>
<p> and </p><p class="formulaDsp">
\[ \begin{align} D(\phi,k) &amp;= \int_0^\phi \frac{\sin^2\theta}{\sqrt{1 - k^2\sin^2\theta}}\,d\theta\\ &amp;=\frac{F(\phi, k) - E(\phi, k)}{k^2},\\ G(\phi,\alpha^2,k) &amp;= \int_0^\phi \frac{\sqrt{1 - k^2\sin^2\theta}}{1 - \alpha^2\sin^2\theta}\,d\theta\\ &amp;=\frac{k^2}{\alpha^2}F(\phi, k) +\biggl(1-\frac{k^2}{\alpha^2}\biggr)\Pi(\phi, \alpha^2, k),\\ H(\phi, \alpha^2, k) &amp;= \int_0^\phi \frac{\cos^2\theta}{(1-\alpha^2\sin^2\theta)\sqrt{1-k^2\sin^2\theta}} \,d\theta \\ &amp;= \frac1{\alpha^2} F(\phi, k) + \biggl(1 - \frac1{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k), \end{align} \]
</p>
<p> and \(F(\phi, k)\), \(E(\phi, k)\), \(D(\phi, k)\), and \(\Pi(\phi, \alpha^2, k)\), are incomplete elliptic integrals (see <a href="http://dlmf.nist.gov/19.2.ii">http://dlmf.nist.gov/19.2.ii</a>). The formula for \( s \) and the first expression for \( \lambda \) are given by Legendre (1811) and are the most common representation of geodesics in terms of elliptic integrals. The second (equivalent) expression for \( \lambda \), which was given by Cayley (1870), is useful in that the elliptic integral is relegated to a small correction term. This form allows the longitude to be computed more accurately and is used in <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a>. (The equivalence of the two expressions for \( \lambda \) follows from <a href="http://dlmf.nist.gov/19.7.E8">http://dlmf.nist.gov/19.7.E8</a>.)</p>
<p>Nominally, <a class="el" href="classGeographicLib_1_1GeodesicExact.html" title="Exact geodesic calculations. ">GeodesicExact</a> and <a class="el" href="classGeographicLib_1_1GeodesicLineExact.html" title="An exact geodesic line. ">GeodesicLineExact</a> will give "exact" results for any value of the flattening. However, the geographic latitude is a distorted measure of distance from the equator with very eccentric ellipsoids and this introducing an irreducible representational error in the algorithms in this case. It is therefore recommended to restrict the use of these classes to <em>b</em>/<em>a</em> &isin; [0.01, 100] or <em>f</em> &isin; [&minus;99, 0.99]. Note that <a class="el" href="classGeographicLib_1_1GeodesicExact.html" title="Exact geodesic calculations. ">GeodesicExact</a> still uses a series expansion for the area <em>S12</em>. However the series is taken out to 30th order and gives accurate results for <em>b</em>/<em>a</em> &isin; [1/2, 2]; the accuracy is about 8 decimal digits for <em>b</em>/<em>a</em> &isin; [1/4, 4]. Additional work planned for this aspect of the geodesic problem:</p><ul>
<li>formulate the area integral <em>S12</em> in terms of elliptic integrals;</li>
<li>generate accurate test geodesics for highly eccentric ellipsoids so that the roundoff errors can be quantified.</li>
</ul>
<p>Thomas (1952) and Rollins (2010) use a different independent variable for geodesics, \(\theta\) instead of \(\sigma\), where \( \tan\theta = \sqrt{1 + k^2} \tan\sigma \). The corresponding expressions for \( s \) and \( \lambda \) are given here for completeness: </p><p class="formulaDsp">
\[ \begin{align} \frac sb &amp;= \sqrt{1-k&#39;^2} \Pi(\theta, k&#39;^2, k&#39;), \\ \lambda &amp;= (1-f) \sqrt{1-k&#39;^2} \sin\alpha_0 \Pi(\theta, k&#39;^2/e^2, k&#39;), \end{align} \]
</p>
<p> where \( k&#39; = k/\sqrt{1 + k^2} \). The expression for \( s \) can be written in terms of elliptic integrals of the second kind and Cayley's technique can be used to subtract out the leading order behavior of \( \lambda \) to give </p><p class="formulaDsp">
\[ \begin{align} \frac sb &amp;=\frac1{\sqrt{1-k&#39;^2}} \biggl( E(\theta, k&#39;) - \frac{k&#39;^2 \sin\theta \cos\theta}{\sqrt{1-k&#39;^2\sin^2\theta}} \biggr), \\ \lambda &amp;= \psi + (1-f) \sqrt{1-k&#39;^2} \sin\alpha_0 \bigl( F(\theta, k&#39;) - \Pi(\theta, e^2, k&#39;) \bigr), \end{align} \]
</p>
<p> where </p><p class="formulaDsp">
\[ \begin{align} \tan\psi &amp;= \sqrt{\frac{1+k^2\sin^2\sigma}{1+e&#39;^2}}\tan\omega \\ &amp;= \sqrt{\frac{1-e^2}{1+k^2\cos^2\theta}}\sin\alpha_0\tan\theta. \end{align} \]
</p>
<p> The tangents of the three "longitude-like" angles are in geometric progression, \( \tan\chi/\tan\omega = \tan\omega/\tan\psi \).</p>
<h1><a class="anchor" id="meridian"></a>
Parameters for the meridian</h1>
<p>The formulas for \( s \) given in the previous section are the same as those for the distance along a meridian for an ellipsoid with equatorial radius \( a \sqrt{1 - e^2 \sin^2\alpha_0} \) and polar semi-axis \( b \). Here is a list of possible ways of expressing the meridian distance in terms of elliptic integrals using the notation:</p><ul>
<li>\( a \), equatorial axis,</li>
<li>\( b \), polar axis,</li>
<li>\( e = \sqrt{(a^2 - b^2)/a^2} \), eccentricity,</li>
<li>\( e&#39; = \sqrt{(a^2 - b^2)/b^2} \), second eccentricity,</li>
<li>\( \phi = \mathrm{am}(u, e) \), the geographic latitude,</li>
<li>\( \phi&#39; = \mathrm{am}(v&#39;, ie&#39;) = \pi/2 - \phi \), the geographic colatitude,</li>
<li>\( \beta = \mathrm{am}(v, ie&#39;) \), the parametric latitude ( \( \tan^2\beta = (1 - e^2) \tan^2\phi \)),</li>
<li>\( \beta&#39; = \mathrm{am}(u&#39;, e) = \pi/2 - \beta \), the parametric colatitude,</li>
<li>\( M \), the length of a quarter meridian (equator to pole),</li>
<li>\( y \), the distance along the meridian (measured from the equator).</li>
<li>\( y&#39; = M -y \), the distance along the meridian (measured from the pole).</li>
</ul>
<p>The eccentricities \( (e, e&#39;) \) are real (resp. imaginary) for oblate (resp. prolate) ellipsoids. The elliptic variables \((u, u&#39;)\) and \((v, v&#39;)\) are defined by</p><ul>
<li>\( u = F(\phi, e) ,\quad u&#39; = F(\beta&#39;, e) \)</li>
<li>\( v = F(\beta, ie&#39;) ,\quad v&#39; = F(\phi&#39;, ie&#39;) \),</li>
</ul>
<p>and are linearly related by</p><ul>
<li>\( u + u&#39; = K(e) ,\quad v + v&#39; = K(ie&#39;) \)</li>
<li>\( v = \sqrt{1-e^2} u ,\quad u = \sqrt{1+e&#39;^2} v \).</li>
</ul>
<p>The cartesian coordinates for the meridian \( (x, z) \) are given by </p><p class="formulaDsp">
\[ \begin{align} x &amp;= a \cos\beta = a \cos\phi / \sqrt{1 - e^2 \sin^2\phi} \\ &amp;= a \sin\beta&#39; = (a^2/b) \sin\phi&#39; / \sqrt{1 + e&#39;^2 \sin^2\phi&#39;} \\ &amp;= a \,\mathrm{cn}(v, ie) = a \,\mathrm{cd}(u, e) \\ &amp;= a \,\mathrm{sn}(u&#39;, e) = (a^2/b) \,\mathrm{sd}(v&#39;, ie&#39;), \end{align} \]
</p>
 <p class="formulaDsp">
\[ \begin{align} z &amp;= b \sin\beta = (b^2/a) \sin\phi / \sqrt{1 - e^2 \sin^2\phi} \\ &amp;= b \cos\beta&#39; = b \cos\phi&#39; / \sqrt{1 + e&#39;^2 \sin^2\phi&#39;} \\ &amp;= b \,\mathrm{sn}(v, ie) = (b^2/a) \,\mathrm{sd}(u, e) \\ &amp;= b \,\mathrm{cn}(u&#39;, e) = b \,\mathrm{cd}(v&#39;, ie&#39;). \end{align} \]
</p>
<p> The distance along the meridian can be expressed variously as </p><p class="formulaDsp">
\[ \begin{align} y &amp;= b \int \sqrt{1 + e&#39;^2 \sin^2\beta}\, d\beta = b E(\beta, ie&#39;) \\ &amp;= \frac{b^2}a \int \frac1{(1 - e^2 \sin^2\phi)^{3/2}}\, d\phi = \frac{b^2}a \Pi(\phi, e^2, e) \\ &amp;= a \biggl(E(\phi, e) - \frac{e^2\sin\phi \cos\phi}{\sqrt{1 - e^2\sin^2\phi}}\biggr) \\ &amp;= b \int \mathrm{dn}^2(v, ie&#39;)\, dv = \frac{b^2}a \int \mathrm{nd}^2(u, e)\, du = \cal E(v, ie&#39;), \end{align} \]
</p>
 <p class="formulaDsp">
\[ \begin{align} y&#39; &amp;= a \int \sqrt{1 - e^2 \sin^2\beta&#39;}\, d\beta&#39; = a E(\beta&#39;, e) \\ &amp;= \frac{a^2}b \int \frac1{(1 + e&#39;^2 \sin^2\phi&#39;)^{3/2}}\, d\phi&#39; = \frac{a^2}b \Pi(\phi&#39;, -e&#39;^2, ie&#39;) \\ &amp;= b \biggl(E(\phi&#39;, ie&#39;) + \frac{e&#39;^2\sin\phi&#39; \cos\phi&#39;}{\sqrt{1 + e&#39;^2\sin^2\phi&#39;}}\biggr) \\ &amp;= a \int \mathrm{dn}^2(u&#39;, e)\, du&#39; = \frac{a^2}b \int \mathrm{nd}^2(v&#39;, ie&#39;)\, dv&#39; = \cal E(u&#39;, e), \end{align} \]
</p>
<p> with the quarter meridian distance given by </p><p class="formulaDsp">
\[ M = aE(e) = bE(ie&#39;) = (b^2/a)\Pi(e^2,e) = (a^2/b)\Pi(-e&#39;^2,ie&#39;). \]
</p>
<p> (Here \( E, F, \Pi \) are elliptic integrals defined in <a href="http://dlmf.nist.gov/19.2.ii">http://dlmf.nist.gov/19.2.ii</a>. \( \cal E, \mathrm{am}, \mathrm{sn}, \mathrm{cn}, \mathrm{sd}, \mathrm{cd}, \mathrm{dn}, \mathrm{nd} \) are Jacobi elliptic functions defined in <a href="http://dlmf.nist.gov/22.2">http://dlmf.nist.gov/22.2</a> and <a href="http://dlmf.nist.gov/22.16">http://dlmf.nist.gov/22.16</a>.)</p>
<p>There are several considerations in the choice of independent variable for evaluate the meridian distance</p><ul>
<li>The use of an imaginary modulus (namely, \( ie&#39; \), above) is of no practical concern. The integrals are real in this case and modern methods (<a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> uses the method given in <a href="http://dlmf.nist.gov/19.36.i">http://dlmf.nist.gov/19.36.i</a>) for computing integrals handles this case using just real arithmetic.</li>
<li>If the "natural" origin is the equator, choose one of \( \phi, \beta, u, v \) (this might be preferred in geodesy). If it's the pole, choose one of the complementary quantities \( \phi&#39;, \beta&#39;, u&#39;, v&#39; \) (this might be preferred by mathematicians).</li>
<li>Applying these formulas to the geodesic problems, \( \beta \) becomes the arc length, \( \sigma \), on the auxiliary sphere. This is the traditional method of solution used by Legendre (1806), Oriani (1806), Bessel (1825), Helmert (1880), Rainsford (1955), Thomas (1970), Vincenty (1975), Rapp (1993), and so on. Many of the solutions in terms of elliptic functions use one of the elliptic variables ( \( u \) or \( v \)), see, for example, Jacobi (1855), Halphen (1888), Forsyth (1896). In the context of geodesics \( \phi \) becomes Thomas' variable \( \theta \); this is used by Thomas (1952) and Rollins (2010) in their formulation of the geodesic problem (see the previous section).</li>
<li>For highly eccentric ellipsoids the variation of the meridian with respect to \( \beta \) is considerably "better behaved" than other choices (see the figure below). The choice of \( \phi \) is probably a poor one in this case.</li>
</ul>
<p><a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> uses the geodesic generalization of \( y = b E(\beta, ie&#39;) \), namely \( s = b E(\sigma, ik) \). See <a class="el" href="geodesic.html#geodellip">Geodesics in terms of elliptic integrals</a>.</p>
<div class="image">
<img src="meridian-measures.png" alt="meridian-measures.png"/>
<div class="caption">
Comparison of meridian measures</div></div>
 <h1><a class="anchor" id="geodshort"></a>
Short geodesics</h1>
<p>Here we describe Bowring's method for solving the inverse geodesic problem in the limit of short geodesics and contrast it with the great circle solution using Bessel's auxiliary sphere. References:</p><ul>
<li>B. R. Bowring, The Direct and Inverse Problems for Short <a class="el" href="classGeographicLib_1_1Geodesic.html" title="Geodesic calculations ">Geodesic</a> Lines on the <a class="el" href="classGeographicLib_1_1Ellipsoid.html" title="Properties of an ellipsoid. ">Ellipsoid</a>, Surveying and Mapping 41(2), 135&ndash;141 (1981).</li>
<li>R. H. Rapp, <a href="http://hdl.handle.net/1811/24333">Geometric Geodesy, Part I</a>, Ohio State Univ. (1991), Sec. 6.5.</li>
</ul>
<p>Bowring considers the conformal mapping of the ellipsoid to a sphere of radius \( R \) such that circles of latitude and meridians are preserved (and hence the azimuth of a line is preserved). Let \( (\phi, \lambda) \) and \( (\phi&#39;, \lambda&#39;) \) be the latitude and longitude on the ellipsoid and sphere respectively. Define isometric latitudes for the sphere and the ellipsoid as </p><p class="formulaDsp">
\[ \begin{align} \psi&#39; &amp;= \sinh^{-1} \tan \phi&#39;, \\ \psi &amp;= \sinh^{-1} \tan \phi - e \tanh^{-1}(e \sin\phi). \end{align} \]
</p>
<p> The most general conformal mapping satisfying Bowring's conditions is </p><p class="formulaDsp">
\[ \psi&#39; = A \psi + K, \quad \lambda&#39; = A \lambda, \]
</p>
<p> where \( A \) and \( K \) are constants. (In fact a constant can be added to the equation for \( \lambda&#39; \), but this does affect the analysis.) The scale of this mapping is </p><p class="formulaDsp">
\[ m(\phi) = \frac{AR}{\nu}\frac{\cos\phi&#39;}{\cos\phi}, \]
</p>
<p> where \( \nu = a/\sqrt{1 - e^2\sin^2\phi} \) is the transverse radius of curvature. (Note that in Bowring's Eq. (10), \( \phi \) should be replaced by \( \phi&#39; \).) The mapping from the ellipsoid to the sphere depends on three parameters \( R, A, K \). These will be selected to satisfy certain conditions at some representative latitude \( \phi_0 \). Two possible choices are given below.</p>
<h2><a class="anchor" id="bowring"></a>
Bowring's method</h2>
<p>Bowring (1981) requires that </p><p class="formulaDsp">
\[ m(\phi_0) = 1,\quad \left.\frac{dm(\phi)}{d\phi}\right|_{\phi=\phi_0} = 0,\quad \left.\frac{d^2m(\phi)}{d\phi^2}\right|_{\phi=\phi_0} = 0, \]
</p>
<p> i.e, \(m\approx 1\) in the vicinity of \(\phi = \phi_0\). This gives </p><p class="formulaDsp">
\[ \begin{align} R &amp;= \frac{\sqrt{1 + e&#39;^2}}{B^2} a, \\ A &amp;= \sqrt{1 + e&#39;^2 \cos^4\phi_0}, \\ \tan\phi&#39;_0 &amp;= \frac1B \tan\phi_0, \end{align} \]
</p>
<p> where \( e&#39; = e/\sqrt{1-e^2} \) is the second eccentricity, \( B = \sqrt{1+e&#39;^2\cos^2\phi_0} \), and \( K \) is defined implicitly by the equation for \(\phi&#39;_0\). The radius \( R \) is the (Gaussian) mean radius of curvature of the ellipsoid at \(\phi_0\) (so near \(\phi_0\) the ellipsoid can be deformed to fit the sphere snugly). The third derivative of \( m \) is given by </p><p class="formulaDsp">
\[ \left.\frac{d^3m(\phi)}{d\phi^3}\right|_{\phi=\phi_0} = \frac{-2e&#39;^2\sin2\phi_0}{B^4}. \]
</p>
<p>The method for solving the inverse problem between two nearby points \( (\phi_1, \lambda_1) \) and \( (\phi_2, \lambda_2) \) is as follows: Set \(\phi_0 = (\phi_1 + \phi_2)/2\). Compute \( R, A, \phi&#39;_0 \), and hence find \( (\phi&#39;_1, \lambda&#39;_1) \) and \( (\phi&#39;_2, \lambda&#39;_2) \). Finally, solve for the great circle on a sphere of radius \( R \); the resulting distance and azimuths are good approximations for the corresponding quantities for the ellipsoidal geodesic.</p>
<p>Consistent with the accuracy of this method, we can compute \(\phi&#39;_1\) and \(\phi&#39;_2\) using a Taylor expansion about \(\phi_0\). This also avoids numerical errors that arise from subtracting nearly equal quantities when using the equation for \(\phi&#39;\) directly. Write \(\Delta \phi = \phi - \phi_0\) and \(\Delta \phi&#39; = \phi&#39; - \phi&#39;_0\); then we have </p><p class="formulaDsp">
\[ \Delta\phi&#39; \approx \frac{\Delta\phi}B \biggl[1 + \frac{\Delta\phi}{B^2}\frac{e&#39;^2}2 \biggl(3\sin\phi_0\cos\phi_0 + \frac{\Delta\phi}{B^2} \bigl(B^2 - \sin^2\phi_0(2 - 3 e&#39;^2 \cos^2\phi_0)\bigr)\biggr)\biggr], \]
</p>
<p> where the error is \(O(f\Delta\phi^4)\). This is essentially Bowring's method. Significant differences between this result, "Bowring (improved)", compared to Bowring's paper, "Bowring
(original)", are:</p><ul>
<li>Bowring elects to use \(\phi_0 = \phi_1\). This simplifies the calculations somewhat but increases the error by about a factor of 4.</li>
<li>Bowring's expression for \( \Delta\phi&#39; \) is only accurate in the limit \( e&#39; \rightarrow 0 \).</li>
</ul>
<p>In fact, arguably, the highest order \(O(f\Delta\phi^3)\) terms should be dropped altogether. Their inclusion does result in a better estimate for the distance. However, if your goal is to generate both accurate distances <em>and</em> accurate azimuths, then \(\Delta\phi\) needs to be restricted sufficiently to allow these terms to be dropped to give the "Bowring (truncated)" method.</p>
<p>With highly eccentric ellipsoids, the parametric latitude \( \beta \) is a better behaved independent variable to use. In this case, \( \phi_0 \) is naturally defined using \(\beta_0 = (\beta_1 + \beta_2)/2\) and in terms of \(\Delta\beta = \beta - \beta_0\), we have </p><p class="formulaDsp">
\[ \Delta\phi&#39; \approx \frac{\Delta\beta}{B&#39;} \biggl[1 + \frac{\Delta\beta}{B&#39;^2}\frac{e&#39;^2}2 \biggl(\sin\beta_0\cos\beta_0 + \frac{\Delta\beta}{3B&#39;^2} \bigl( \cos^2\beta_0 - \sin^2\beta_0 B&#39;^2\bigr) \biggr)\biggr], \]
</p>
<p> where \(B&#39; = \sqrt{1+e&#39;^2\sin^2\beta_0} = \sqrt{1+e&#39;^2}/B\), and the error once again is \(O(f\Delta\phi^4)\). This is the &quot;Bowring (using \(\beta\))&quot; method.</p>
<h2><a class="anchor" id="auxsphere"></a>
Bessel's auxiliary sphere</h2>
<p><a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a>'s uses the auxiliary sphere method of Legendre, Bessel, and Helmert. For short geodesics, this is equivalent to picking \( R, A, K \) so that </p><p class="formulaDsp">
\[ m(\phi_0) = 1,\quad \left.\frac{dm(\phi)}{d\phi}\right|_{\phi=\phi_0} = 0,\quad \tan\phi&#39;_0 = (1 - f) \tan\phi_0. \]
</p>
<p> Bowring's requirement that the second derivative of \(m\) vanish has been replaced by the last relation which states that \(\phi&#39;_0 = \beta_0\), the parametric latitude corresponding to \(\phi_0\). This gives </p><p class="formulaDsp">
\[ \begin{align} R &amp;= B&#39;(1-f)a, \\ A &amp;= \frac1{B&#39;(1-f)}, \\ \left.\frac{d^2m(\phi)}{d\phi^2}\right|_{\phi=\phi_0} &amp;= -e^2B&#39;^2\sin^2\phi_0. \end{align} \]
</p>
<p>Similar to Bowring's method, we can compute \(\phi&#39;_1\) and \(\phi&#39;_2\) using a Taylor expansion about \(\beta_0\). This results in the simple expression </p><p class="formulaDsp">
\[ \Delta\phi&#39; \approx \Delta\beta, \]
</p>
<p> where the error is \(O(f\Delta\beta^2)\).</p>
<h2><a class="anchor" id="shorterr"></a>
Estimating the accuracy</h2>
<p>In assessing the accuracy of these methods we use two metrics:</p><ul>
<li>The absolute error in the distance.</li>
<li>The consistency of the predicted azimuths. Imagine starting ellipsoidal geodesics at \( (\phi_1, \lambda_1) \) and \( (\phi_2, \lambda_2) \) with the predicted azimuths. What is the distance between them when they are extended a distance \( a \) beyond the second point?</li>
</ul>
<p>(The second metric is much more stringent.) We may now compare the methods by asking for a bound to the length of a geodesic which ensures that the one or other of the errors fall below 1&#160;mm (an "engineering" definition of accurate) or 1&#160;nm (1 nanometer, about the round-off limit).</p>
<center> <a class="anchor" id=""></a>
<table class="doxtable">
<caption>Maximum distance that can be used in various methods for computing short geodesics while keeping the errors within prescribed bounds</caption>
<tr>
<th rowspan="2">method </th><th colspan="2"><center>distance metric</center> </th><th colspan="2"><center>azimuth metric</center> </th></tr>
<tr>
<th>1 mm error </th><th>1 nm error </th><th>1 mm error </th><th>1 nm error </th></tr>
<tr>
<td>Bowring (original) </td><td><center>87 km</center> </td><td><center>870 m</center> </td><td><center>35 km</center> </td><td><center>350 m</center> </td></tr>
<tr>
<td>Bowring (improved) </td><td><center>180 km</center> </td><td><center>1.8 km</center> </td><td><center>58 km</center> </td><td><center>580 m</center> </td></tr>
<tr>
<td>Bowring (truncated) </td><td><center>52 km</center> </td><td><center>520 m</center> </td><td><center>52 km</center> </td><td><center>520 m</center> </td></tr>
<tr>
<td>Bowring (using \(\beta\)) </td><td><center>380 km</center> </td><td><center>24 km</center> </td><td><center>60 km</center> </td><td><center>600 m</center> </td></tr>
<tr>
<td>Bessel's aux. sphere </td><td><center>42 km</center> </td><td><center>420 m</center> </td><td><center>1.7 km</center> </td><td><center>1.7 m</center> </td></tr>
</table>
</center><p>For example, if you're only interested in measuring distances and an accuracy of 1&#160;mm is sufficient, then Bowring's improved method can be used for distances up to 180&#160;km. On the other hand, <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> uses Bessel's auxiliary sphere and we require both the distance and the azimuth to be accurate, so the great circle approximation can only be used for distances less than 1.7&#160;m. The reason that <a class="el" href="namespaceGeographicLib.html" title="Namespace for GeographicLib. ">GeographicLib</a> does not use Bowring's method is that the information necessary for auxiliary sphere method is already available as part of the general solution and, as much as possible, we allow all geodesics to be computed by the general method.</p>
<center> Back to <a class="el" href="magnetic.html">Magnetic models</a>. Forward to <a class="el" href="nearest.html">Finding nearest neighbors</a>. Up to <a class="el" href="index.html#contents">Contents</a>. </center> </div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>