
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
class_complex_number
Advanced tools
This add class for base support complex number in js
npm i class_complex_number
and import class Complex from this package
let Complex = require('class_complex_number');
// Complex(real, imaginary)
let cn1 = new Complex(1, 2);
let cn2 = new Complex(Math.PI, 5);
let res = Complex.add(cn1, cn2);
console.log(res.toString()); // 4.14 + 7.00i
let cn = new Complex(0, Math.PI / 2);
let res = Complex.exp(cn);
console.log(res.toTrigonom()); // 1.00(cos(1.57) + isin(1.57))
console.log(res.toExponen()); // 1.00exp(1.57i)
All methods return object complex class. All arguments should be instance Complex class
static add(cn1, cn2) // +
static sub(cn1, cn2) // -
static mul(cn1, cn2) // *
static div(cn1, cn2) // /
static sqrt(cn) // square root
static exp(cn) // complex exponent
static sin(cn) // complex sin
static cos(cn) // complex cos
static log(cn, [base]) // complex log with real base. If not base return natural log
static log10(cn) // log with base 10
Methods object for convert complex number to string. All number round to tenths (r - modulus, arg - argument)
cn.toString() // {re}+{im}i
cn.toExponen() // {r}(cos({re}) + isin({im}))
cn.toTrigonom() // {r}exp({arg}i)
Getters
cn.mod() // return modulus
cn.arg() // return argument
FAQs
add complex number in js
We found that class_complex_number 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
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.