josdejong/mathjs — pull request #155 by finnp (2014-04-05 00:27:19+00:00)
Title: Add support for polar coordinates in complex numbers

Okay I now implemented the most basic stuff discussed in #76.

Here are the API parts I used:
```javascript
Complex.fromPolar(r, phi) // returns Complex
Complex.fromPolar({phi: [Number | Unit/Angle], r: Number}) // returns Complex
(new Complex()).toPolar() // returns {phi: Number, r: Number}

math.complex(({phi: [Number | Unit/Angle], r: Number}) // returns Complex
math.complex({re: Number | im: Number}) // return Complex

// Similar to math.complex also the constructor can be used
new Complex(({phi: [Number | Unit/Angle], r: Number})
new Complex({re: Number | im: Number})
```
I didn't implement `math.polar`, because I thought it might be confusing since polar coordinates don't have to be complex numbers.

What's missing is that there is no string parser yet. Otherwise I think this fixes #76 and basically also #22.