Skip to content

Commit

Permalink
Add haversine and inverse
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmasson committed Jun 18, 2021
1 parent 5559263 commit 14c364a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -3674,6 +3674,10 @@ function sinc( x ) {

}

function haversine( x ) { return div( sub( 1, cos(x) ), 2 ); }

function inverseHaversine( x ) { return arccos( sub( 1, mul(2,x) ) ); }


// analyticphysics.com / The Complex Gudermannian Function

Expand Down
4 changes: 4 additions & 0 deletions docs/functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ <h1>Circular Functions</h1>

<p><a href="functions/sinc.html"><b>sinc( <i>x</i> )</b></a> &mdash; cardinal sine of a real or complex number</p>

<p><b>haversine( <i>x</i> )</b> &mdash; haversine of a real or complex number</p>

<p><b>inverseHaversine( <i>x</i> )</b> &mdash; inverse haversine of a real or complex number</p>

<br id="hyperbolic"/>
<h1>Hyperbolic Functions</h1>

Expand Down
4 changes: 4 additions & 0 deletions src/functions/trigonometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ function sinc( x ) {

}

function haversine( x ) { return div( sub( 1, cos(x) ), 2 ); }

function inverseHaversine( x ) { return arccos( sub( 1, mul(2,x) ) ); }


// analyticphysics.com / The Complex Gudermannian Function

Expand Down

0 comments on commit 14c364a

Please sign in to comment.