# js-math-complex

0.3.0 • Public • Published

# math-complex.js

Complex Number for JavaScript

## DESCRIPTION

This module implements complex number arithmetics. Basic arithmetics + All arithmetic functions in `Math` are supported.

### Constructors

#### Math.Complex( re[, im] )

Constructor. im === 0 if omitted.

#### Math.Complex.polar( abs, arg )

Constructor in polar form.

### Methods

In the followin example z is a complex number object. Unless otherwise stated, all methods below return complex number objects.

#### z.eq( z1 )

returns `true` if z equals z1, `false` otherwise.

#### z.ne( z1 )

The opposite of z.eq( *z1 *)

#### z.abs()

returns the absolute value in `Number`.

#### z.arg()

returns the argument in `Number`.

returns - z

#### z.con()

returns the conjugate.

#### z.norm()

returns the norm in `Number`.

z + z1. z1 can be either complex number or real number If z1 is a real number (`Number` object, that is), it is automatically converted to complex number before the calculation. This applies to all binary methods.

z - z1

z * z1

z / z1

#### z.exp()

Copmplex version of Math.exp( z ) .

#### z.log()

Copmplex version of Math.log( z ) .

#### z.pow( z1 )

Copmplex version of Math.exp( z, z1 ) .

#### z.sin()

Copmplex version of Math.sin( z ) .

#### z.cos()

Copmplex version of Math.cos( z ) .

#### z.tan()

Copmplex version of Math.tan( z ) .

#### z.asin()

Copmplex version of Math.asin( z ) .

#### z.acos()

Copmplex version of Math.acos( z ) .

#### z.atan()

Copmplex version of Math.atan( z ) .

#### z.approx(z1)

z is approximately equal to z1.

`````` delta                abs(z - z1)
------- < EPSILON <=> ----------- < 2*EPSILON
average               abs(z + z1)
``````

### Functional Form

All methods above can also be accessed in functional form which is handy with `with`.

## Package Sidebar

### Install

`npm i js-math-complex`

### Repository

github.com/dankogai/js-math-complex

0

0.3.0