csch.js (1440B)
1 import { factory } from '../../utils/factory.js'; 2 import { deepMap } from '../../utils/collection.js'; 3 import { cschNumber } from '../../plain/number/index.js'; 4 var name = 'csch'; 5 var dependencies = ['typed', 'BigNumber']; 6 export var createCsch = /* #__PURE__ */factory(name, dependencies, _ref => { 7 var { 8 typed, 9 BigNumber: _BigNumber 10 } = _ref; 11 12 /** 13 * Calculate the hyperbolic cosecant of a value, 14 * defined as `csch(x) = 1 / sinh(x)`. 15 * 16 * For matrices, the function is evaluated element wise. 17 * 18 * Syntax: 19 * 20 * math.csch(x) 21 * 22 * Examples: 23 * 24 * // csch(x) = 1/ sinh(x) 25 * math.csch(0.5) // returns 1.9190347513349437 26 * 1 / math.sinh(0.5) // returns 1.9190347513349437 27 * 28 * See also: 29 * 30 * sinh, sech, coth 31 * 32 * @param {number | Complex | Unit | Array | Matrix} x Function input 33 * @return {number | Complex | Array | Matrix} Hyperbolic cosecant of x 34 */ 35 return typed(name, { 36 number: cschNumber, 37 Complex: function Complex(x) { 38 return x.csch(); 39 }, 40 BigNumber: function BigNumber(x) { 41 return new _BigNumber(1).div(x.sinh()); 42 }, 43 Unit: function Unit(x) { 44 if (!x.hasBase(x.constructor.BASE_UNITS.ANGLE)) { 45 throw new TypeError('Unit in function csch is no angle'); 46 } 47 48 return this(x.value); 49 }, 50 'Array | Matrix': function ArrayMatrix(x) { 51 return deepMap(x, this); 52 } 53 }); 54 });