diff --git a/build/math.js b/build/math.js index 59a3ea6..671be6f 100644 --- a/build/math.js +++ b/build/math.js @@ -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 diff --git a/docs/functions.html b/docs/functions.html index 8f08553..89ac23c 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -70,6 +70,10 @@

Circular Functions

sinc( x ) — cardinal sine of a real or complex number

+

haversine( x ) — haversine of a real or complex number

+ +

inverseHaversine( x ) — inverse haversine of a real or complex number

+

Hyperbolic Functions

diff --git a/src/functions/trigonometry.js b/src/functions/trigonometry.js index 29ea8d1..4cb04a8 100644 --- a/src/functions/trigonometry.js +++ b/src/functions/trigonometry.js @@ -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