
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
imagine-node
Advanced tools
module to work with complex numbers
npm install imagine-node
const complex = new Complex(1, 1);
complex.toString() // 1+i
const chainingComplex = complex
.add({ real: 2, imaginary:3 })
.sub({ real: 1, imaginary:1 })
.multiply({ real: 2, imaginary:-3 })
.div({ real: 2, imaginary:3 });
assert(chainingComplex.real === 2);
assert(chainingComplex.imaginary === -3);ç
complex
.ln()
.multiply({ real:1, imaginary:1 })
.exp()
// Definitions and usage examples
cos() {
return this
.multiply({ imaginary:1 })
.exp()
.add(
this.multiply({ imaginary:-1 }).exp()
)
.div({ real:2 });
}
acos() {
return this
.add(this.pow(2).sub(1).sqrt()[0])
.ln()
.multiply(Complex.im(-1));
}
asin() {
return this
.multiply(Complex.im())
.add(Complex.re(1).sub(this.pow(2)).sqrt()[0])
.ln()
.multiply(Complex.im(-1));
}
atang() {
return Complex.re(1)
.sub(this.multiply(Complex.im()))
.ln()
.sub(Complex
.re(1)
.add(this.multiply(Complex.im()))
.ln()
)
.multiply(Complex.im(0.5));
}
sin() {
return this
.multiply({ imaginary:1 })
.exp()
.sub(
this.multiply({ imaginary:-1 }).exp()
)
.div({ imaginary: 2 });
}
return a complex number with only imaginary part equal to number given
return a complex number with only real part equal to number given
return a imaginary number
return a complex number with only imaginary part
return a complex number with only real part
FAQs
node module to work with complex numbers
The npm package imagine-node receives a total of 1 weekly downloads. As such, imagine-node popularity was classified as not popular.
We found that imagine-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.