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( "taptest" )
local round = require( "round" )
local sech = require( "sech" )

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

t()

See also