User Tools

Site Tools


hyperbolic_functions_lbb

This is an old revision of the document!


by Richard Russell, April 2018

Liberty BASIC doesn't include the hyperbolic trig functions (sinh, cosh, tanh etc.) as a built-in feature, but they can easily be synthesised as user-defined functions as follows:

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 = (exp(x) - exp(-x)) / (exp(x) + exp(-x))
end function

function coth(x)
    coth = (exp(x) + exp(-x)) / (exp(x) - exp(-x))
end function

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

function csch(x)
    csch = 2 / (exp(x) - exp(-x))
end function
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
hyperbolic_functions_lbb.1523093654.txt.gz · Last modified: 2024/01/05 00:17 (external edit)