@rayyamhk/complex
Version:
A lightweight and easy-to-use library for you to manipulate complex numbers
18 lines (15 loc) • 400 B
JavaScript
;
/**
* Calculates the complex conjugate of the Complex Number.
* @memberof Complex
* @static
* @param {Complex} num - Complex number
* @returns {Complex} The complex conjugate of the Complex Number
*/
function conjugate(num) {
if (!(num instanceof this)) {
return this.NaN;
}
return new this(num.getReal(), num.getImaginary() * -1);
}
module.exports = conjugate;