sech

function sech( x ) --> res

Description

Returns the hyperbolic secant of x.

Parameters

x

An angle in radians.

Return Values

res

The hyperbolic secant of x.

Code

--ZFUNC-sech-v1
local function sech( x ) --> res
   --ZFUNC-cosh-v1
   local function cosh( x )
      return ( math.exp( x ) + math.exp( -x ) ) / 2
   end

   return 1 / cosh( x )
end

return sech

Examples

local t = require( "tapered" )
local sech = require( "sech" )
-- util functions
local round = require( "round" )

t.is( 0.8868189, round( sech( 0.5 ), 7 ) )

t.done()

See also