New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

complex-number

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

complex-number - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

6

index.js

@@ -45,2 +45,6 @@ function multiplyImaginaryParts(x,y){

getConjugate(){
return new ComplexNumber(this.realPart, this.imaginaryPart*-1);
}
getAdditiveInverse(){

@@ -69,3 +73,3 @@ let realSquared = this.realPart * -1;

toString(){
return `${this.realPart} +${this.imaginaryPart}i`;
return `${this.realPart} + ${this.imaginaryPart}i`;
}

@@ -72,0 +76,0 @@

2

package.json
{
"name": "complex-number",
"version": "1.0.0",
"version": "1.0.1",
"description": "A simple complex number package that can add, multiply, get the additive and mulitplicative inverses and compare Complex Numbers.",

@@ -5,0 +5,0 @@ "main": "index.js",

# complex-number
A simple complex number package that can add, multiply, get the additive and mulitplicative inverses and compare Complex Numbers.
ComplexNumber has realPart and imaginaryPart.
A complex number package that can add, multiply, get the additive and mulitplicative inverses, get the conjugate, and compare Complex Numbers.
ComplexNumber has an add, multiply, and equals functions which take another complex number implementation.
## Getting Started
ComplexNumber has getAdditiveInverse and getMultiplicativeInverse which return Complex Numbers.
There is an NPM package: complex-number.
```
npm i complex-number
```
### Example
```
const ComplexNumber = require ('complex-number')
let x = new ComplexNumber(1,2);
let conjugate = x.getConjugate();
let additiveInverse = x.getAdditiveInverse();
let multiplicativeInverse = x.getMultiplicativeInverse();
// prints out false
console.log(x.equals(conjugate).toString());
// prints out 0 + 0i
console.log(x.add(additiveInverse).toString());
// prints out 1 + 0i
console.log(x.multiply(multiplicativeInverse).toString());
```
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