Hyperbolic functions

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

Hyperbolic functions

Post by guest » Fri Apr 06, 2018 2:32 pm

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.

Post Reply