
Research
Namastex.ai npm Packages Hit with TeamPCP-Style CanisterWorm Malware
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.
@sigma-js/complexes
Advanced tools
@sigma-js/complexes is a JavaScript library that provides calculation functions related to complex numbers.
Install with npm:
$ npm i @sigma-js/complexes
const Complex = require("./complexes.js");
import { Complex } from "@sigma-js/complexes";
// You can initialize complex numbers in the constructor
real = 1;
imaginary = 2;
complex = new Complex(real, imaginary);
console.log(complex.re); // Output: 1
console.log(complex.im); // Output: 2
// You can complex numbers can be set from rectangular coordinates.
complex = new Complex();
complex.rectCoords(3, 4);
console.log(complex.re); // Output: 3
console.log(complex.im); // Output: 4
// You can complex numbers can be set from polar coordinates.
complex = new Complex();
complex.polarCoords(1, Math.PI / 4);
console.log(complex.re); // Output: Math.sqrt(2) / 2
console.log(complex.im); // Output: Math.sqrt(2) / 2
// You can set complex numbers with specified precision.
complex = new Complex();
complex.precision(1, Math.PI / 4);
console.log(complex.re); // Output: Math.sqrt(2) / 2
console.log(complex.im); // Output: Math.sqrt(2) / 2
// You can set complex numbers with specified digits.
complex = new Complex(3.141592653589793, 2.718281828459045);
complex.fixed(4);
console.log(complex.re); // Output: 3.1416
console.log(complex.im); // Output: 2.7183
// You can get the complex number according to the specified value.
const inputComplex = new Complex(2, 4);
const beforeComplex = new Complex();
let retComplex = beforeComplex.fromValue(inputComplex);
retComplex.re; // Output: 2
retComplex.im; // Output: 4
retComplex = beforeComplex.fromValue("3+2i");
retComplex.re; // Output: 3
retComplex.im; // Output: 2
// You can get the absolute value of a complex number.
const complex = new Complex(3, 4);
complex.getMagnitude(); // Output: 5
// You can get the argument of a complex number.
const complex = new Complex(3, 4);
complex.getAngle(); // Output: 0.92729...
// You can get the conjugate value of a complex number.
const complex = new Complex(3, 4);
const conjugate = complex.conjugate();
conjugate.re; // Output: 3
conjugate.im; // Output: -4
// You can get the negation of a complex number.
const complex = new Complex(3, 4);
const negate = complex.negate();
conjugate.re; // Output: -3
conjugate.im; // Output: -4
// You can modification of the current instance is prohibited and a new instance is always returned if one is needed.
const complex = new Complex(2, 3);
const finalizedComplex = complex.finalize();
const newComplex = finalizedComplex.rectCoords(4, 5);
console.log(newComplex); // Output: Complex { re: 4, im: 5 }
const reDescriptor = Object.getOwnPropertyDescriptor(finalizedComplex, "re");
const imDescriptor = Object.getOwnPropertyDescriptor(finalizedComplex, "im");
console.log(reDescriptor.writable); // Output: false
console.log(imDescriptor.writable); // Output: false
// You can set the result of multiplying the specified value by a complex number.
// When specified numerically
const beforeComplex = new Complex(2, 3);
const afterComplex = beforeComplex.multiply(3);
// (2 + 3i) * 3 = 6 + 9i
console.log(afterComplex.re); // Output: 6
console.log(afterComplex.im); // Output: 9
// When specified as a string
const beforeComplex = new Complex(2, 3);
const afterComplex = beforeComplex.multiply("2+4i");
// (2 + 3i) * (2 + 4i) = -8 + 14i
console.log(afterComplex.re); // Output: -8
console.log(afterComplex.im); // Output: 14
// You can set the result of dividing the specified value by a complex number.
// When specified numerically
const beforeComplex = new Complex(6, 9);
const afterComplex = beforeComplex.divide(3);
// (6 + 9i) / 3 = 2 + 3i
console.log(afterComplex.re); // Output: 2
console.log(afterComplex.im); // Output: 3
// When specified as a string
const beforeComplex = new Complex(6, 9);
const afterComplex = beforeComplex.divide("2-4i");
// (6 + 9i) / (2 - 4i) = -1.2 + 2.1i
console.log(afterComplex.re); // Output: -2.1
console.log(afterComplex.im); // Output: 2.1
// You can get the clone of a complex number.
const complex = new Complex(2, 3);
const clone = complex.getClone();
console.log(clone.re); // Output: 2
console.log(clone.im); // Output: 3
// You can get the result of exponentialing the specified value by a complex number.
const complex = new Complex(2, 3);
const expResult = complex.exp();
console.log(expResult.re); // Output: e^2 * cos(3)
console.log(expResult.im); // Output: e^2 * sin(3)
// You can set the logarithm of the specified rotation value to a complex number.
const complex = new Complex(2, 3);
const rotatedLog = complex.log(1);
console.log(rotatedLog.re); // Output: log(√13)
console.log(rotatedLog.im); // Output: 1.57079...
// You can set the result of powing the specified value by a complex number.
const base = new Complex(2, 3);
const exponent = new Complex(1, 1);
const powResult = base.pow(exponent);
console.log(powResult.re); // Output: e^(2 - 3)
console.log(powResult.im); // Output: e^(2 - 3)
// You can set the result of square rooting a complex number.
const complex = new Complex(2, 3);
const sqrtResult = complex.sqrt();
console.log(sqrtResult.re); // Output: √(√13 + 2) / 2
console.log(sqrtResult.im); // Output: √(√13 - 2) / 2
// You can get the hyperbolic sine of the specified value.
const complex = new Complex(2, 3);
const sinhResult = complex.getSinh(2);
console.log(sinhResult); // Output: 3.62686...
// You can get the hyperbolic cosine of the specified value.
const complex = new Complex(2, 3);
const coshResult = complex.getCosh(2);
console.log(coshResult); // Output: 3.76219...
// You can set the sine of a complex number.
const re = 1, im = 2;
const complex = new Complex(re, im);
const sinResult = complex.sin();
console.log(sinResult.re); // 3.16577...
console.log(sinResult.im); // 1.95960...
// You can set the cosine of a complex number.
const re = 2, im = 3;
const complex = new Complex(re, im);
const cosResult = complex.cos();
console.log(cosResult.re); // -4.18962...
console.log(cosResult.im); // -9.10922...
// You can set the tangent of a complex number.
const re = 3, im = 4;
const complex = new Complex(re, im);
const tanResult = complex.tan();
console.log(tanResult.re); // -0.00018...
console.log(tanResult.im); // 0.99935...
// You can set the hyperbolic sine of a complex number.
const re = 1, im = 2;
const complex = new Complex(re, im);
const sinResult = complex.sinh();
console.log(sinResult.re); // -0.48905...
console.log(sinResult.im); // 1.40311...
// You can set the hyperbolic cosine of a complex number.
const re = 2, im = 3;
const complex = new Complex(re, im);
const cosResult = complex.cosh();
console.log(cosResult.re); // -3.72454...
console.log(cosResult.im); // 0.51182...
// You can set the hyperbolic tangent of a complex number.
const re = 3, im = 4;
const complex = new Complex(re, im);
const tanResult = complex.tanh();
console.log(tanResult.re); // 1.00070...
console.log(tanResult.im); // 0.00490...
// You can get complex numbers as strings.
const complex = new Complex(3, -4);
const result = complex.getString();
console.log(result); // Output: 3-4i
// You can get a complex number as a string in polar coordinate format
const complex = new Complex(3, 4);
const result = complex.getStringPolarCoords();
console.log(result); // Output: 5 0.9272952180016122
// You can obtain the result of determining whether the specified complex number and the current complex number match.
const complex1 = new Complex(2, 5);
const complex2 = new Complex(1, 5);
const result = complex1.getEquals(complex2);
console.log(result); // Output: false
Copyright (c) 2023, s-hama. Released under the MIT License.
FAQs
Provides calculation functions related to complex numbers.
We found that @sigma-js/complexes 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.

Research
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.