cosh()
Returns the hyperbolic cosine of the argument.
Syntax
cosh(argument)
Parameters
Parameter | Definition |
---|---|
argument | numeric value whose hyperbolic cosine is to be determined*Valid Values* |
Description
The cosh() function returns the hyperbolic cosine of argument . The hyperbolic cosine is defined by the expression:
cosh❌️ = (ex + e-x)/2
where e is the base for the natural logarithms (e =2.71828 . . .). The output range for the cosh() function is 1 ≤ cosh() ≤∞.
Example
The following example uses the cosh() function to numerically check the hyperbolic cosine definition:
function main() {
print("Test cosh(x) = 0.5 * (exp(x) + exp(-x))\n");
print("over the interval from -5 to 5\n\n");
print(" x cosh(x) 0.5 * (exp(x) + exp(-x))\n");
print("---------- ---------- ------------------------\n");
i = - 5;
while (i <= 5) {
coshdef = 0.5 * (exp(i) + exp(-i));
printf("%+10.6f %+10.6f %+10.6f\n",i,cosh(i),coshdef);
i++;
}
}
print("Test cosh(x) = 0.5 * (exp(x) + exp(-x))\n");
print("over the interval from -5 to 5\n\n");
print(" x cosh(x) 0.5 * (exp(x) + exp(-x))\n");
print("---------- ---------- ------------------------\n");
i = - 5;
while (i <= 5) {
coshdef = 0.5 * (exp(i) + exp(-i));
printf("%+10.6f %+10.6f %+10.6f\n",i,cosh(i),coshdef);
i++;
}
}