Hyperbolic functions

Code snippets illustrating how LBB can be used
guest
Site Admin
Posts: 198
Joined: Tue Apr 03, 2018 1:34 pm

Hyperbolic functions

Post by guest »

I've received a query by email about calculating hyperbolic trig functions (e.g. sinh, cosh, tanh). They are easily implemented as user-defined functions as follows:

Code: Select all

function sinh(x)
    sinh = (exp(x) - exp(-x)) / 2
end function

function cosh(x)
    cosh = (exp(x) + exp(-x)) / 2
end function

function tanh(x)
    tanh = sinh(x) / cosh(x)
end function
Richard.