Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

complex.js

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

complex.js

A complex numbers library

  • 2.4.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
966K
decreased by-16.75%
Maintainers
1
Weekly downloads
 
Created

What is complex.js?

The complex.js npm package is a library for complex number arithmetic in JavaScript. It provides a comprehensive set of functions to perform operations on complex numbers, including basic arithmetic, trigonometric functions, and more.

What are complex.js's main functionalities?

Basic Arithmetic

This feature allows you to perform basic arithmetic operations such as addition, subtraction, multiplication, and division on complex numbers.

const Complex = require('complex.js');
const a = new Complex(2, 3);
const b = new Complex(1, 1);
const sum = a.add(b);
console.log(sum.toString()); // '3 + 4i'

Trigonometric Functions

This feature provides trigonometric functions like sine, cosine, and tangent for complex numbers.

const Complex = require('complex.js');
const a = new Complex(1, 1);
const sinA = a.sin();
console.log(sinA.toString()); // '1.2984575814159773 + 0.6349639147847361i'

Exponential and Logarithmic Functions

This feature allows you to compute the exponential and logarithmic functions of complex numbers.

const Complex = require('complex.js');
const a = new Complex(1, 1);
const expA = a.exp();
console.log(expA.toString()); // '1.4686939399158851 + 2.2873552871788423i'

Polar Coordinates

This feature allows you to convert complex numbers to and from polar coordinates.

const Complex = require('complex.js');
const a = new Complex(1, 1);
const polar = a.toPolar();
console.log(polar); // { r: 1.4142135623730951, phi: 0.7853981633974483 }

Other packages similar to complex.js

Keywords

FAQs

Package last updated on 05 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc