Package Exports
- vtr-complex-numbers
- vtr-complex-numbers/dist/complex.cjs.js
- vtr-complex-numbers/dist/complex.esm.js
- vtr-complex-numbers/dist/complex.min.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vtr-complex-numbers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Complex Number Library
A simple library for working with complex numbers.
Installation
npm install complex-number-library
API
addComplex(a, b)
Adds two complex numbers.
const { addComplex } = require('complex-number-library')
const num1 = { real: 2, imag: 3 }
const num2 = { real: 1, imag: 4 }
const sum = addComplex(num1, num2)
console.log(`Sum: ${sum.real} + ${sum.imag}i`)
subtractComplex(a, b)
Subtracts the second complex number from the first.
const { subtractComplex } = require('complex-number-library')
const num1 = { real: 2, imag: 3 }
const num2 = { real: 1, imag: 4 }
const difference = subtractComplex(num1, num2)
console.log(`Difference: ${difference.real} + ${difference.imag}i`)
multiplyComplex(a, b)
Multiplies two complex numbers.
const { multiplyComplex } = require('complex-number-library')
const num1 = { real: 2, imag: 3 }
const num2 = { real: 1, imag: 4 }
const product = multiplyComplex(num1, num2)
console.log(`Product: ${product.real} + ${product.imag}i`)