
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
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
The npm package class_complex_number receives a total of 0 weekly downloads. As such, class_complex_number popularity was classified as not popular.
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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.