{"_id":"Complex","_rev":"11-5766255e5c81ef5c44da290f21021cec","name":"Complex","description":"Do calculations with Complex numbers","dist-tags":{"latest":"3.0.0"},"versions":{"2.0.0":{"name":"Complex","homepage":"http://github.com/arian/Complex","version":"2.0.0","description":"Do calculations with Complex numbers","keywords":["Complex Numbers","Numbers","Math","Calculus"],"author":{"name":"Arian Stolwijk"},"maintainers":[{"name":"arian","email":"stolwijk.arian@gmail.com"}],"bugs":{"name":"https://github.com/arian/Complex/issues"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/mit-license.php"}],"repositories":[{"type":"git","url":"git://github.com/mootools/Base.git"}],"implements":["CommonJS/Packages/1.0","CommonJS/Modules/AsynchronousDefinition"],"directories":{"lib":"Source"},"main":"Source/Complex","icon":"https://github.com/arian/Complex/raw/master/wiki-complex.png","dependencies":{},"devDependencies":{},"_id":"Complex@2.0.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"a2746e93b5806719bd37fa55806e30c22ee77e69","tarball":"https://registry.npmjs.org/Complex/-/Complex-2.0.0.tgz","integrity":"sha512-4Tlnvw/492zYw5m41COl0p336gpi0vRn4XAtoNlHpXdnGyD7l0yv0ZEKUTm68AM9Xwuz4Ov3JNhvV3s/E71iXw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCUOaMqBfHU/zp6fTD8UoTHzKTRN+Ihcy6LGhg54ap0GwIhAMwzX/9ExnuG0RhMZnzxXOa5zLHKjGhcfby559LY/Un/"}]},"scripts":{}},"2.0.1":{"name":"Complex","homepage":"http://github.com/arian/Complex","version":"2.0.1","description":"Do calculations with Complex numbers","keywords":["Complex Numbers","Numbers","Math","Calculus"],"author":{"name":"Arian Stolwijk"},"maintainers":[{"name":"arian","email":"stolwijk.arian@gmail.com"}],"bugs":{"name":"https://github.com/arian/Complex/issues"},"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/mit-license.php"}],"repository":{"type":"git","url":"git://github.com/arian/Complex.git"},"implements":["CommonJS/Packages/1.0","CommonJS/Modules/AsynchronousDefinition"],"directories":{"lib":"Source"},"main":"Source/Complex","icon":"https://github.com/arian/Complex/raw/master/wiki-complex.png","dependencies":{"amd-loader":">=0.0.3"},"_npmUser":{"name":"arian","email":"stolwijk.arian@gmail.com"},"_id":"Complex@2.0.1","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.9","_defaultsLoaded":true,"dist":{"shasum":"496dbf9ca47a4156f034d8e098493e1b6aa1593c","tarball":"https://registry.npmjs.org/Complex/-/Complex-2.0.1.tgz","integrity":"sha512-9R9ZNH66bZQjrGfC6/KuMNUyhTyFl/EicmJq2Djomvv3WBkEfU4fh6xDGZtabaNKDqaa+L2lXd0rm+ul6R4T3g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD1eqhBH4piWjmnKGw5vCNeLRpr4HdSMDEdZNP34yFFYAIhAP+CG+fOciX1UePAuYjELvvWI7yzr3ALAw3pbiQnNHFs"}]}},"3.0.0":{"name":"Complex","homepage":"http://github.com/arian/Complex","version":"3.0.0","description":"Do calculations with Complex numbers","keywords":["Complex Numbers","Numbers","Math","Calculus"],"author":{"name":"Arian Stolwijk"},"maintainers":[{"name":"arian","email":"stolwijk.arian@gmail.com"}],"bugs":"https://github.com/arian/Complex/issues","licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/mit-license.php"}],"repository":{"type":"git","url":"http://github.com/arian/Complex"},"main":"lib/Complex","icon":"https://github.com/arian/Complex/raw/master/wiki-complex.png","devDependencies":{"mocha":"1.3","expect.js":"0.1","express":"3","wrapup":"0.9"},"readme":"Complex\n=======\n\nComplex is a additional Type to deal with Complex Numbers in JavaScript. It\nprovides several methods to add, multiply numbers as well as calculate the\nmagnitude and angle in the complex plane.\n\n![Screenshot](https://github.com/arian/Complex/raw/master/wiki-complex.png)\n\nNode\n----\n\nYou can get this package with NPM:\n\n    npm install Complex\n\n```js\nvar Complex = require('Complex');\nconsole.log(new Complex(3, 4).abs()); // 5\n```\n\nBrowser\n-------\n\nComplex can be built for the browser with [wrapup](https://github.com/kamicane/wrapup)\nor other tools that can generate browser JS from Node packages.\n\nTesting\n-------\n\nTesting is done with Mocha and Expect.js:\n\n\t# install dependencies\n\tnpm install\n\t# run the tests in node\n\t./node_modules/.bin/mocha test/Complex.js\n\nor testing in the browser:\n\n\t# install dependencies\n\tnpm install\n\t# run a small node server\n\tnode ./test/server.js\n\t# run tests\n\tgoogle-chrome http://localhost:3000\n\nAPI Documentation\n-----------------\n\n### Complex constructor:\n\n```js\nvar z = new Complex(real im);\n```\n\n#### Arguments:\n\n1. real (number) the real part of the number\n2. im (number) the imaginary part of the number\n\n\n### Function: Complex.from\n\nA in line function like Number.from.\n\n```js\nvar z = Complex.from(real[, im]);\n```\n\n#### Arguments:\n\n1. real (number) the real part of the number\n2. im (number, *optional*) the imaginary part of the number\n\nOr\n\n1. real (string) a string representation of the number, for example `1+4i`\n\n#### Examples:\n\n```js\nvar z = Complex.from(2, 4);\nvar z = Complex.from(5);\nvar z = Complex.from('2+5i');\n```\n\n\n### Function: Complex.fromPolar\n\nCreates a complex instance from a polar representation: `r*e^(phi*i) = r (cos(phi) + i sin(phi))`\n\n```js\nvar z = Complex.fromPolar(r, phi);\n```\n\n#### Arguments:\n\n1. r (number) the radius/magnitude of the number\n2. phi (number) the angle/phase of the number\n\n\n### Constant: Complex.i\n\nA instance of the imaginary unit `i`\n\n```js\nvar i = Complex.i;\n```\n\n\n### Constant: Complex.one\n\nA instance for the real number `1`\n\n```js\nvar one = Complex.one;\n```\n\n\n### Method: fromRect\n\nSets the real and imaginary properties a and b from `a + bi`\n\n```js\nmyComplex.fromRect(real, im);\n```\n\n#### Arguments:\n\n1. real (number) the real part of the number\n2. im (number) the imaginary part of the number\n\n\n### Method: fromPolar\n\nSets the a and b in `a + bi` from a polar representation.\n\n```js\nmyComplex.fromPolar(r, phi);\n```\n\n#### Arguments:\n\n1. r (number) the radius/magnitude of the number\n2. phi (number) the angle/phase of the number\n\n\n### Method: toPrecision\n\nSets the precision of the numbers. Similar to Number.prototype.toPrecision. Useful befor printing the number with the toString method.\n\n```js\nmyComplex.toPrecision(k);\n```\n\n#### Arguments:\n\n1. k (number) An integer specifying the number of significant digits\n\n\n### Method: toFixed\n\nFormats a number using fixed-point notation. Similar to Number.prototype.toFixed. Useful before printing the number with the toString method.\n\n```js\nmyComplex.toFixed(k);\n```\n\n#### Arguments:\n\n1. k (number) The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally support a larger range of values. If this argument is omitted, it is treated as 0\n\n\n### Method: finalize\n\nFinalizes the instance. The number will not change and any other method call will return a new instance.\nVery useful when a complex instance should stay constant. For example the Complex.i variable is a finalized instance.\n\n```js\nmyComplex.finalize();\n```\n\n\n### Method: magnitude\n\nCalculates the magnitude of the complex number\n\n```js\nmyComplex.magnitude();\n```\n\n#### Alias:\n\n- abs\n\n\n### Method: angle\n\nCalculates the angle with respect to the real axis, in radians.\n\n```js\nmyComplex.angle();\n```\n\n#### Aliases\n\n- arg\n- phase\n\n\n### Method: conjugate\n\nCalculates the conjugate of the complex number (multiplies the imaginary part with -1)\n\n```js\nmyComplex.conjugate();\n```\n\n\n### Method: negate\n\nNegates the number (multiplies both the real and imaginary part with -1)\n\n```js\nmyComplex.negate();\n```\n\n\n### Method: multiply\n\nMultiplies the number with a real or complex number\n\n```js\nmyComplex.multiply(z);\n```\n\n#### Arguments:\n\n1. z (number, complex) the number to multiply with\n\n#### Alias:\n\n- mult\n\n\n### Method: divide\n\nDivides the number by a real or complex number\n\n```js\nmyComplex.divide(z);\n```\n\n#### Arguments:\n\n1. z (number, complex) the number to divide by\n\n#### Alias:\n\n- div\n\n\n### Method: add\n\nAdds a real or complex number\n\n```js\nmyComplex.add(z);\n```\n\n#### Arguments:\n\n1. z (number, complex) the number to add\n\n\n### Method: subtract\n\nSubtracts a real or complex number\n\n```js\nmyComplex.subtract(z);\n```\n\n#### Arguments:\n\n1. z (number, complex) the number to subtract\n\n#### Alias:\n\n- sub\n\n\n### Method: pow\n\nReturns the base to the exponent\n\n```js\nmyComplex.pow(z);\n```\n\n#### Arguments:\n\n1. z (number, complex) the exponent\n\n\n### Method: sqrt\n\nReturns the square root\n\n```js\nmyComplex.sqrt();\n```\n\n\n### Method: log\n\nReturns the natural logarithm (base `E`)\n\n```js\nmyComplex.log([k]);\n```\n\n#### Arguments:\n\n1. k (number) the actual answer has a multiplicity (`ln(z) = ln|z| + arg(z)`) where arg(z) can return the same for different angles (every 2*pi), with this argument you can define which answer is required\n\n\n### Method: exp\n\nCalculates the `e^z` where the base is `E` and the exponential the complex number.\n\n```js\nmyComplex.exp();\n```\n\n\n### Method: sin\n\nCalculates the sine of the complex number\n\n```js\nmyComplex.sin();\n```\n\n\n### Method: cos\n\nCalculates the cosine of the complex number\n\n```js\nmyComplex.cos();\n```\n\n\n### Method: tan\n\nCalculates the tangent of the complex number\n\n```js\nmyComplex.tan();\n```\n\n\n### Method: sinh\n\nCalculates the hyperbolic sine of the complex number\n\n```js\nmyComplex.sinh();\n```\n\n\n### Method: cosh\n\nCalculates the hyperbolic cosine of the complex number\n\n```js\nmyComplex.cosh();\n```\n\n\n### Method: tanh\n\nCalculates the hyperbolic tangent of the complex number\n\n```js\nmyComplex.tanh();\n```\n\n\n### Method: clone\n\nReturns a new Complex instance with the same real and imaginary properties\n\n```js\nmyComplex.clone();\n```\n\n\n### Method: toString\n\nReturns a string representation of the complex number\n\n```js\nmyComplex.toString();\n```\n\n\n#### Examples:\n\n```js\nnew Complex(1, 2).toString(); // 1+2i\nnew Complex(0, 1).toString(); // i\nnew Complex(4, 0).toString(); // 4\nnew Complex(1, 1).toString(); // 1+i\n'my Complex Number is: ' + (new Complex(3, 5)); // 'my Complex Number is: 3+5i\n```\n\n\n### Method: Equals\n\nChecks if the real and imaginary components are equal to the passed in compelex components.\n\n```js\nmyComplex.equals(z);\n```\n\n### Arguments:\n\n1. z (number, complex) the complex number to compare with\n\n### Examples:\n\n```js\nnew Complex(1, 4).equals(new Complex(1, 4)); // true\nnew Complex(1, 3).equals(new Complex(1, 3)); // false\n```\n","_id":"Complex@3.0.0","dist":{"shasum":"f06a402d59baa3e68c7b3513840e1a70a3f8eabf","tarball":"https://registry.npmjs.org/Complex/-/Complex-3.0.0.tgz","integrity":"sha512-Hp5N3sSfAc7jjkIdW82Jy7adWSdQvp/lo1oX2oOPSxMz6aWb9tZ7/hmzmQdtMg926nArGKx/rrK0X4YQQgXpLA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKO4b8uLu/ByyVR55eVtSBQjXn4pQ99/M5x5Fk49lQuQIgV3fDUWIrYE+5ccpaa+aVfc5we8sv6c22E3V+qivvtE0="}]}}},"maintainers":[{"name":"arian","email":"stolwijk.arian@gmail.com"}],"time":{"modified":"2022-06-13T02:13:28.954Z","created":"2011-09-27T21:02:54.212Z","2.0.0":"2011-09-27T21:02:55.038Z","2.0.1":"2012-02-01T01:20:30.086Z","3.0.0":"2012-08-13T11:40:39.778Z"},"author":{"name":"Arian Stolwijk"},"repository":{"type":"git","url":"http://github.com/arian/Complex"}}