diff --git a/documentation.html b/documentation.html index 9767498..80ac39a 100644 --- a/documentation.html +++ b/documentation.html @@ -638,6 +638,10 @@

Complex linear algebra

OUT> {x:0.5588,y:-0.2353} IN> z.sub(w) OUT> {x:1, y:-4} +IN> z.reciprocal() +OUT> {x: 0.12, y: -0.16} +IN> numeric.t(2, 0).reciprocal() +OUT> {x: 0.5, y: 0} Complex vectors and matrices can also be handled: diff --git a/src/documentation.html b/src/documentation.html index 9767498..80ac39a 100644 --- a/src/documentation.html +++ b/src/documentation.html @@ -638,6 +638,10 @@

Complex linear algebra

OUT> {x:0.5588,y:-0.2353} IN> z.sub(w) OUT> {x:1, y:-4} +IN> z.reciprocal() +OUT> {x: 0.12, y: -0.16} +IN> numeric.t(2, 0).reciprocal() +OUT> {x: 0.5, y: 0} Complex vectors and matrices can also be handled: diff --git a/src/numeric.js b/src/numeric.js index 537b68f..336f081 100644 --- a/src/numeric.js +++ b/src/numeric.js @@ -1071,7 +1071,7 @@ numeric.T.prototype.reciprocal = function reciprocal() { var d = numeric.add(mul(this.x,this.x),mul(this.y,this.y)); return new numeric.T(div(this.x,d),div(numeric.neg(this.y),d)); } - return new T(div(1,this.x)); + return new numeric.T(div(1,this.x), 0); } numeric.T.prototype.div = function div(y) { if(!(y instanceof numeric.T)) y = new numeric.T(y);