@rayyamhk/complex
Version:
A lightweight and easy-to-use library for you to manipulate complex numbers
20 lines (17 loc) • 432 B
JavaScript
;
/**
* Calculates the sine of a Complex Number.
* @memberof Complex
* @static
* @param {Complex} num - Any Complex Number
* @returns {Complex} The result of sine function
*/
function sin(num) {
if (!(num instanceof this)) {
return this.NaN;
}
var a = num.getReal();
var b = num.getImaginary();
return new this(Math.sin(a) * Math.cosh(b), Math.cos(a) * Math.sinh(b));
}
module.exports = sin;