MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / cosh

Function cosh

src/compute-engine/interval/trigonometric.ts:352–367  ·  view source on GitHub ↗
(x: Interval | IntervalResult)

Source from the content-addressed store, hash-verified

350}
351
352/**
353 * Hyperbolic cosine.
354 *
355 * Domain: all reals, minimum at x=0.
356 */
357export function cosh(x: Interval | IntervalResult): IntervalResult {
358 const unwrapped = unwrapOrPropagate(x);
359 if (!Array.isArray(unwrapped)) return unwrapped;
360 const [xVal] = unwrapped;
361 if (xVal.lo >= 0) {
362 return ok({ lo: Math.cosh(xVal.lo), hi: Math.cosh(xVal.hi) });
363 } else if (xVal.hi <= 0) {
364 return ok({ lo: Math.cosh(xVal.hi), hi: Math.cosh(xVal.lo) });
365 } else {
366 // Contains zero - minimum is cosh(0) = 1
367 return ok({
368 lo: 1,
369 hi: Math.max(Math.cosh(xVal.lo), Math.cosh(xVal.hi)),
370 });

Callers 4

cothFunction · 0.85
sechFunction · 0.85
gen_solve.pyFile · 0.85

Calls 3

unwrapOrPropagateFunction · 0.90
okFunction · 0.90
coshMethod · 0.80

Tested by

no test coverage detected