Reverted ordering of complex numbers in relational functions. Use natural sort in set functions (See #837)

This commit is contained in:
jos 2017-06-18 21:42:55 +02:00
parent 151bc655d6
commit d85f54cf77
30 changed files with 86 additions and 202 deletions

View File

@ -4,8 +4,7 @@
- Implemented set methods `setCartesian`, `setDifference`, `setDistinct`, `setIntersect`, `setIsSubset`, `setPowerset`, `setSize`. Thanks @Nekomajin42.
- Implemented method `toHTML` on nodes. Thanks @Nekomajin42.
- Implemented comparing complex numbers in functions `compare`,
`smaller`, `smallerEq`, `larger`, `largerEq`. Thanks @gulfaraz.
- Implemented `compareNatural` and `sort([...], 'natural')`.
- Upgraded dependencies to the latest versions:
- `complex.js@2.0.4`
- `decimal.js@7.2.1`

View File

@ -22,9 +22,6 @@ function factory (type, config, load, typed) {
*
* For matrices, the function is evaluated element wise.
*
* For Complex numbers, first the real parts are compared. If equal, the
* imaginary parts are compared.
*
* Syntax:
*
* math.compare(x, y)
@ -71,7 +68,9 @@ function factory (type, config, load, typed) {
return new type.Fraction(x.compare(y));
},
'Complex, Complex': type.Complex.compare,
'Complex, Complex': function () {
throw new TypeError('No ordering relation is defined for complex numbers');
},
'Unit, Unit': function (x, y) {
if (!x.equalBase(y)) {

View File

@ -63,8 +63,8 @@ function factory (type, config, load, typed) {
return x.compare(y) === 1;
},
'Complex, Complex': function (x, y) {
return type.Complex.compare(x, y) > 0;
'Complex, Complex': function () {
throw new TypeError('No ordering relation is defined for complex numbers');
},
'Unit, Unit': function (x, y) {

View File

@ -59,8 +59,8 @@ function factory (type, config, load, typed) {
return x.compare(y) !== -1;
},
'Complex, Complex': function (x, y) {
return type.Complex.compare(x, y) >= 0;
'Complex, Complex': function () {
throw new TypeError('No ordering relation is defined for complex numbers');
},
'Unit, Unit': function (x, y) {

View File

@ -64,7 +64,7 @@ function factory (type, config, load, typed) {
},
'Complex, Complex': function (x, y) {
return type.Complex.compare(x, y) < 0;
throw new TypeError('No ordering relation is defined for complex numbers');
},
'Unit, Unit': function (x, y) {

View File

@ -58,8 +58,8 @@ function factory (type, config, load, typed) {
return x.compare(y) !== 1;
},
'Complex, Complex': function (x, y) {
return type.Complex.compare(x, y) <= 0;
'Complex, Complex': function () {
throw new TypeError('No ordering relation is defined for complex numbers');
},
'Unit, Unit': function (x, y) {

View File

@ -35,8 +35,8 @@ function factory (type, config, load, typed) {
var result = [];
}
else {
var b1 = Array.isArray(a1) ? sort(flatten(a1)) : sort(flatten(a1.toArray()));
var b2 = Array.isArray(a2) ? sort(flatten(a2)) : sort(flatten(a2.toArray()));
var b1 = sort(flatten(Array.isArray(a1) ? a1 : a1.toArray()), 'natural');
var b2 = sort(flatten(Array.isArray(a2) ? a2 : a2.toArray()), 'natural');
var result = [];
for (var i=0; i<b1.length; i++) {
for (var j=0; j<b2.length; j++) {

View File

@ -42,8 +42,8 @@ function factory (type, config, load, typed) {
return flatten(a1.toArray());
}
else {
var b1 = Array.isArray(a1) ? identify(sort(flatten(a1))) : identify(sort(flatten(a1.toArray())));
var b2 = Array.isArray(a2) ? identify(sort(flatten(a2))) : identify(sort(flatten(a2.toArray())));
var b1 = identify(sort(flatten(Array.isArray(a1) ? a1: a1.toArray()), 'natural'));
var b2 = identify(sort(flatten(Array.isArray(a2) ? a2: a2.toArray()), 'natural'));
var result = [];
var inb2;
for (var i=0; i<b1.length; i++) {

View File

@ -35,7 +35,7 @@ function factory (type, config, load, typed) {
var result = [];
}
else {
var b = Array.isArray(a) ? sort(flatten(a)) : sort(flatten(a.toArray()));
var b = sort(flatten(Array.isArray(a) ? a : a.toArray()), 'natural');
var result = [];
result.push(b[0]);
for (var i=1; i<b.length; i++) {

View File

@ -39,8 +39,8 @@ function factory (type, config, load, typed) {
var result = [];
}
else {
var b1 = Array.isArray(a1) ? identify(sort(flatten(a1))) : identify(sort(flatten(a1.toArray())));
var b2 = Array.isArray(a2) ? identify(sort(flatten(a2))) : identify(sort(flatten(a2.toArray())));
var b1 = identify(sort(flatten(Array.isArray(a1) ? a1 : a1.toArray()), 'natural'));
var b2 = identify(sort(flatten(Array.isArray(a2) ? a2 : a2.toArray()), 'natural'));
var result = [];
for (var i=0; i<b1.length; i++) {
for (var j=0; j<b2.length; j++) {

View File

@ -39,8 +39,8 @@ function factory (type, config, load, typed) {
else if (subset(size(a2), new index(0)) === 0) { // anything is not a subset of empty
return false;
}
var b1 = Array.isArray(a1) ? identify(sort(flatten(a1))) : identify(sort(flatten(a1.toArray())));
var b2 = Array.isArray(a2) ? identify(sort(flatten(a2))) : identify(sort(flatten(a2.toArray())));
var b1 = identify(sort(flatten(Array.isArray(a1) ? a1 : a1.toArray()), 'natural'));
var b2 = identify(sort(flatten(Array.isArray(a2) ? a2 : a2.toArray()), 'natural'));
var inb2;
for (var i=0; i<b1.length; i++) {
inb2 = false;

View File

@ -34,7 +34,7 @@ function factory (type, config, load, typed) {
if (subset(size(a), new index(0)) === 0) { // if empty, return 0
return 0;
}
var b = Array.isArray(a) ? flatten(a) : flatten(a.toArray());
var b = flatten(Array.isArray(a) ? a : a.toArray());
var count = 0;
for (var i=0; i<b.length; i++) {
if (equal(b[i], e)) {

View File

@ -32,7 +32,7 @@ function factory (type, config, load, typed) {
if (subset(size(a), new index(0)) === 0) { // if empty, return empty
return [];
}
var b = Array.isArray(a) ? sort(flatten(a)) : sort(flatten(a.toArray()));
var b = sort(flatten(Array.isArray(a) ? a : a.toArray()), 'natural');
var result = [];
var number = 0;
while (number.toString(2).length <= b.length) {

View File

@ -35,7 +35,7 @@ function factory (type, config, load, typed) {
return Array.isArray(a) ? flatten(a).length : flatten(a.toArray()).length;
}
else {
var b = Array.isArray(a) ? sort(flatten(a)) : sort(flatten(a.toArray()));
var b = sort(flatten(Array.isArray(a) ? a : a.toArray()), 'natural');
var count = 1;
for (var i=1; i<b.length; i++) {
if (!equal(b[i], b[i-1])) {

View File

@ -195,31 +195,12 @@ describe('compare', function() {
assert.equal(mymath.compare(math.bignumber(1), math.bignumber(0.991)), 0);
});
describe('Complex Numbers', function () {
it('should compare complex numbers', function() {
assert.equal(compare(complex(1,1), complex(1,1)), 0);
assert.equal(compare(complex(2,1), complex(1,2)), 1);
assert.equal(compare(complex(0,1), complex(1,2)), -1);
});
it('should compare complex number and number', function() {
assert.equal(compare(complex(1,0), 1), 0);
assert.equal(compare(complex(2,1), 1), 1);
assert.equal(compare(complex(0,1), 1), -1);
assert.equal(compare(1, complex(1,0)), 0);
assert.equal(compare(1, complex(2,1)), -1);
assert.equal(compare(1, complex(0,1)), 1);
});
it('should compare complex number and bignumber', function() {
assert.equal(compare(complex(1,0), math.bignumber(1)), 0);
assert.equal(compare(complex(2,1), math.bignumber(1)), 1);
assert.equal(compare(complex(0,1), math.bignumber(1)), -1);
assert.equal(compare(math.bignumber(1), complex(1,0)), 0);
assert.equal(compare(math.bignumber(1), complex(2,1)), -1);
assert.equal(compare(math.bignumber(1), complex(0,1)), 1);
});
it('should throw an error when comparing complex numbers', function() {
assert.throws(function () {compare(complex(1,1), complex(1,2));}, TypeError);
assert.throws(function () {compare(complex(2,1), 3);}, TypeError);
assert.throws(function () {compare(3, complex(2,4));}, TypeError);
assert.throws(function () {compare(math.bignumber(3), complex(2,4));}, TypeError);
assert.throws(function () {compare(complex(2,4), math.bignumber(3));}, TypeError);
});
it('should throw an error if matrices are different sizes', function() {

View File

@ -123,6 +123,8 @@ describe('compareNatural', function() {
assert.equal(compareNatural('10', '2'), 1);
});
// TODO: test deterministic ordering of mixed types: number, bignumber, unit, complex, ...
// TODO: compareNatural for Array
describe.skip('Array', function () {

View File

@ -191,31 +191,12 @@ describe('larger', function() {
});
});
describe('Complex Numbers', function () {
it('should compare complex numbers', function() {
assert.equal(larger(complex(1,1), complex(1,1)), false);
assert.equal(larger(complex(2,1), complex(1,2)), true);
assert.equal(larger(complex(0,1), complex(1,2)), false);
});
it('should compare complex number and number', function() {
assert.equal(larger(complex(1,0), 1), false);
assert.equal(larger(complex(2,1), 1), true);
assert.equal(larger(complex(0,1), 1), false);
assert.equal(larger(1, complex(1,0)), false);
assert.equal(larger(1, complex(2,1)), false);
assert.equal(larger(1, complex(0,1)), true);
});
it('should compare complex number and bignumber', function() {
assert.equal(larger(complex(1,0), math.bignumber(1)), false);
assert.equal(larger(complex(2,1), math.bignumber(1)), true);
assert.equal(larger(complex(0,1), math.bignumber(1)), false);
assert.equal(larger(math.bignumber(1), complex(1,0)), false);
assert.equal(larger(math.bignumber(1), complex(2,1)), false);
assert.equal(larger(math.bignumber(1), complex(0,1)), true);
});
it('should throw an error when comparing complex numbers', function() {
assert.throws(function () {larger(complex(1,1), complex(1,2));}, TypeError);
assert.throws(function () {larger(complex(2,1), 3);}, TypeError);
assert.throws(function () {larger(3, complex(2,4));}, TypeError);
assert.throws(function () {larger(math.bignumber(3), complex(2,4));}, TypeError);
assert.throws(function () {larger(complex(2,4), math.bignumber(3));}, TypeError);
});
it('should throw an error if matrices are different sizes', function() {

View File

@ -192,31 +192,12 @@ describe('largerEq', function() {
});
});
describe('Complex Numbers', function () {
it('should compare complex numbers', function() {
assert.equal(largerEq(complex(1,1), complex(1,1)), true);
assert.equal(largerEq(complex(2,1), complex(1,2)), true);
assert.equal(largerEq(complex(0,1), complex(1,2)), false);
});
it('should compare complex number and number', function() {
assert.equal(largerEq(complex(1,0), 1), true);
assert.equal(largerEq(complex(2,1), 1), true);
assert.equal(largerEq(complex(0,1), 1), false);
assert.equal(largerEq(1, complex(1,0)), true);
assert.equal(largerEq(1, complex(2,1)), false);
assert.equal(largerEq(1, complex(0,1)), true);
});
it('should compare complex number and bignumber', function() {
assert.equal(largerEq(complex(1,0), math.bignumber(1)), true);
assert.equal(largerEq(complex(2,1), math.bignumber(1)), true);
assert.equal(largerEq(complex(0,1), math.bignumber(1)), false);
assert.equal(largerEq(math.bignumber(1), complex(1,0)), true);
assert.equal(largerEq(math.bignumber(1), complex(2,1)), false);
assert.equal(largerEq(math.bignumber(1), complex(0,1)), true);
});
it('should throw an error when comparing complex numbers', function() {
assert.throws(function () {largerEq(complex(1,1), complex(1,2));}, TypeError);
assert.throws(function () {largerEq(complex(2,1), 3);}, TypeError);
assert.throws(function () {largerEq(3, complex(2,4));}, TypeError);
assert.throws(function () {largerEq(math.bignumber(3), complex(2,4));}, TypeError);
assert.throws(function () {largerEq(complex(2,4), math.bignumber(3));}, TypeError);
});
it('should throw an error if comparing two matrices of different sizes', function() {

View File

@ -197,31 +197,12 @@ describe('smaller', function() {
});
});
describe('Complex Numbers', function () {
it('should compare complex numbers', function() {
assert.equal(smaller(complex(1,1), complex(1,1)), false);
assert.equal(smaller(complex(2,1), complex(1,2)), false);
assert.equal(smaller(complex(0,1), complex(1,2)), true);
});
it('should compare complex number and number', function() {
assert.equal(smaller(complex(1,0), 1), false);
assert.equal(smaller(complex(2,1), 1), false);
assert.equal(smaller(complex(0,1), 1), true);
assert.equal(smaller(1, complex(1,0)), false);
assert.equal(smaller(1, complex(2,1)), true);
assert.equal(smaller(1, complex(0,1)), false);
});
it('should compare complex number and bignumber', function() {
assert.equal(smaller(complex(1,0), math.bignumber(1)), false);
assert.equal(smaller(complex(2,1), math.bignumber(1)), false);
assert.equal(smaller(complex(0,1), math.bignumber(1)), true);
assert.equal(smaller(math.bignumber(1), complex(1,0)), false);
assert.equal(smaller(math.bignumber(1), complex(2,1)), true);
assert.equal(smaller(math.bignumber(1), complex(0,1)), false);
});
it('should throw an error when comparing complex numbers', function() {
assert.throws(function () {smaller(complex(1,1), complex(1,2));}, TypeError);
assert.throws(function () {smaller(complex(2,1), 3);}, TypeError);
assert.throws(function () {smaller(3, complex(2,4));}, TypeError);
assert.throws(function () {smaller(math.bignumber(3), complex(2,4));}, TypeError);
assert.throws(function () {smaller(complex(2,4), math.bignumber(3));}, TypeError);
});
it('should throw an error with two matrices of different sizes', function () {

View File

@ -197,31 +197,12 @@ describe('smallerEq', function() {
});
});
describe('Complex Numbers', function () {
it('should compare complex numbers', function() {
assert.equal(smallerEq(complex(1,1), complex(1,1)), true);
assert.equal(smallerEq(complex(2,1), complex(1,2)), false);
assert.equal(smallerEq(complex(0,1), complex(1,2)), true);
});
it('should compare complex number and number', function() {
assert.equal(smallerEq(complex(1,0), 1), true);
assert.equal(smallerEq(complex(2,1), 1), false);
assert.equal(smallerEq(complex(0,1), 1), true);
assert.equal(smallerEq(1, complex(1,0)), true);
assert.equal(smallerEq(1, complex(2,1)), true);
assert.equal(smallerEq(1, complex(0,1)), false);
});
it('should compare complex number and bignumber', function() {
assert.equal(smallerEq(complex(1,0), math.bignumber(1)), true);
assert.equal(smallerEq(complex(2,1), math.bignumber(1)), false);
assert.equal(smallerEq(complex(0,1), math.bignumber(1)), true);
assert.equal(smallerEq(math.bignumber(1), complex(1,0)), true);
assert.equal(smallerEq(math.bignumber(1), complex(2,1)), true);
assert.equal(smallerEq(math.bignumber(1), complex(0,1)), false);
});
it('should throw an error when comparing complex numbers', function() {
assert.throws(function () {smallerEq(complex(1,1), complex(1,2));}, TypeError);
assert.throws(function () {smallerEq(complex(2,1), 3);}, TypeError);
assert.throws(function () {smallerEq(3, complex(2,4));}, TypeError);
assert.throws(function () {smallerEq(math.bignumber(3), complex(2,4));}, TypeError);
assert.throws(function () {smallerEq(complex(2,4), math.bignumber(3));}, TypeError);
});
it('should throw an error with two matrices of different sizes', function () {

View File

@ -11,6 +11,10 @@ describe('setCartesian', function () {
assert.deepEqual(math.setCartesian([], []), []);
});
it('should return the cartesian product of two sets with mixed content', function () {
assert.deepEqual(math.setCartesian([1, math.complex(2, 3)], [3]), [[1, 3], [math.complex(2, 3), 3]]);
});
it('should return the cartesian product of two multisets', function () {
assert.deepEqual(math.setCartesian([1, 1], [3, 3]), [[1,3], [1, 3], [1, 3], [1, 3]]);
});

View File

@ -11,6 +11,10 @@ describe('setDifference', function () {
assert.deepEqual(math.setDifference([], []), []);
});
it('should return the difference of two sets with mixed content', function () {
assert.deepEqual(math.setDifference([math.complex(5,1), 4], [1, 2, math.complex(5,1)]), [4]);
});
it('should return the difference of two multisets', function () {
assert.deepEqual(math.setDifference([1, 1, 2, 3, 4, 4], [1, 2, 3, 4, 4, 4]), [1]);
assert.deepEqual(math.setDifference([1, 2, 1, 3, 4, 4], [1, 2, 4, 3, 4, 4]), [1]);

View File

@ -11,6 +11,7 @@ describe('setDistinct', function () {
it('should return the distinct elements of a multiset', function () {
assert.deepEqual(math.setDistinct([1, 1, 2, 2]), [1, 2]);
assert.deepEqual(math.setDistinct([1, 2, 1, 2]), [1, 2]);
assert.deepEqual(math.setDistinct([1, 2, math.complex(3,3), 2, math.complex(3,3)]), [1, 2, math.complex(3,3)]);
});
it('should return the same type of output as the inputs', function() {

View File

@ -7,6 +7,8 @@ describe('setIntersect', function () {
assert.deepEqual(math.setIntersect([1, 2, 3], [3, 4]), [3]);
assert.deepEqual(math.setIntersect([1, 2], [3, 4]), []);
assert.deepEqual(math.setIntersect(["a", "b", "c"], ["c", "d"]), ["c"]);
assert.deepEqual(math.setIntersect([1, math.complex(2,2), math.complex(3,3)],
[math.complex(3,3), 1]), [1, math.complex(3,3)]);
assert.deepEqual(math.setIntersect([], [3, 4]), []);
assert.deepEqual(math.setIntersect([], []), []);
});

View File

@ -8,6 +8,8 @@ describe('setIsSubset', function () {
assert.strictEqual(math.setIsSubset([1, 2, 3, 4], [1, 2]), false);
assert.strictEqual(math.setIsSubset([], [1, 2]), true);
assert.strictEqual(math.setIsSubset([], []), true);
assert.strictEqual(math.setIsSubset([1, math.complex(2,2)], [1, 3, 4, math.complex(2,2)]), true);
});
it('should return true or false', function () {

View File

@ -5,6 +5,8 @@ var math = require('../../../index');
describe('setPowerset', function () {
it('should return the powerset of a set', function () {
assert.deepEqual(math.setPowerset([1, 2]), [[], [1], [2], [1, 2]]);
assert.deepEqual(math.setPowerset([1, math.complex(2,2)]),
[[], [1], [math.complex(2,2)], [1, math.complex(2,2)]]);
assert.deepEqual(math.setPowerset([]), []);
});

View File

@ -7,6 +7,7 @@ describe('setSize', function () {
assert.strictEqual(math.setSize([]), 0);
assert.strictEqual(math.setSize([1]), 1);
assert.strictEqual(math.setSize([1, 2]), 2);
assert.strictEqual(math.setSize([1, math.complex(2,2)]), 2);
});
it('should return the number of elements of a multiset', function () {

View File

@ -68,31 +68,14 @@ describe('max', function() {
[[2, 4, 6], [7, 9, 11]]);
});
describe('Complex Numbers', function () {
it('should throw an error when called with complex numbers', function() {
assert.throws(function () {max(new Complex(2,3), new Complex(2,1))}, TypeError);
assert.throws(function () {max(new Complex(2,3), new Complex(2,5))}, TypeError);
it('should return the complex number with larger value', function() {
assert.deepEqual(max(new Complex(1,1), new Complex(1,1)), new Complex(1,1));
assert.deepEqual(max(new Complex(2,1), new Complex(1,2)), new Complex(2,1));
assert.deepEqual(max(new Complex(0,1), new Complex(1,2)), new Complex(1,2));
});
it('should return the larger between complex number and number', function() {
assert.deepEqual(max(new Complex(1,0), 1), new Complex(1,0));
assert.deepEqual(max(new Complex(2,1), 1), new Complex(2,1));
assert.equal(max(new Complex(0,1), 1), 1);
assert.equal(max(1, new Complex(1,0)), 1);
assert.deepEqual(max(1, new Complex(2,1)), new Complex(2,1));
assert.equal(max(1, new Complex(0,1)), 1);
});
it('should return the larger between complex number and bignumber', function() {
assert.deepEqual(max(new Complex(1,0), math.bignumber(1)), new Complex(1,0));
assert.deepEqual(max(new Complex(2,1), math.bignumber(1)), new Complex(2,1));
assert.equal(max(new Complex(0,1), math.bignumber(1)), 1);
assert.equal(max(math.bignumber(1), new Complex(1,0)), 1);
assert.deepEqual(max(math.bignumber(1), new Complex(2,1)), new Complex(2,1));
assert.equal(max(math.bignumber(1), new Complex(0,1)), 1);
});
assert.throws(function () {max(new Complex(3,4), 4)}, TypeError);
assert.throws(function () {max(new Complex(3,4), 5)}, TypeError);
assert.throws(function () {max(5, new Complex(3,4))}, TypeError);
assert.throws(function () {max(new Complex(3,4), 6)}, TypeError);
});
it('should throw an error when called multiple arrays or matrices', function() {

View File

@ -68,10 +68,6 @@ describe('median', function() {
])), 3.5);
});
it('should return the median for complex numbers', function() {
assert.deepEqual(median(new Complex(2, 3), new Complex(-1, 2)), new Complex(0.5, 2.5));
});
it('should throw an error if called with invalid number of arguments', function() {
assert.throws(function() {median()});
assert.throws(function() {median([], 2, 3)});
@ -88,6 +84,7 @@ describe('median', function() {
it('should throw an error if called with unsupported type of arguments', function() {
assert.throws(function () {median(new Date(), 2, 3)}, /TypeError: Unexpected type of argument/);
assert.throws(function () {median(new Complex(2,3), new Complex(-1,2))}, /TypeError: No ordering relation is defined for complex numbers/);
});
it('should throw an error if called with an empty array', function() {

View File

@ -77,31 +77,14 @@ describe('min', function() {
[[1, 2], [3,4], [5,6]]);
});
describe('Complex Numbers', function () {
it('should throw an error when called with complex numbers', function() {
assert.throws(function () {min(new Complex(2,3), new Complex(2,1))}, TypeError);
assert.throws(function () {min(new Complex(2,3), new Complex(2,5))}, TypeError);
it('should return the complex number with smaller value', function() {
assert.deepEqual(min(new Complex(1,1), new Complex(1,2)), new Complex(1,1));
assert.deepEqual(min(new Complex(2,1), new Complex(1,2)), new Complex(1,2));
assert.deepEqual(min(new Complex(0,1), new Complex(1,2)), new Complex(0,1));
});
it('should return the smaller between complex number and number', function() {
assert.deepEqual(min(new Complex(1,0), 1), new Complex(1,0));
assert.equal(min(new Complex(2,1), 1), 1);
assert.deepEqual(min(new Complex(0,1), 1), new Complex(0,1));
assert.equal(min(1, new Complex(1,0)), 1);
assert.equal(min(1, new Complex(2,1)), 1);
assert.deepEqual(min(1, new Complex(0,1)), new Complex(0,1));
});
it('should return the smaller between complex number and bignumber', function() {
assert.deepEqual(min(new Complex(1,0), math.bignumber(1)), new Complex(1,0));
assert.equal(min(new Complex(2,1), math.bignumber(1)), 1);
assert.deepEqual(min(new Complex(0,1), math.bignumber(1)), new Complex(0,1));
assert.equal(min(math.bignumber(1), new Complex(1,0)), 1);
assert.equal(min(math.bignumber(1), new Complex(2,1)), 1);
assert.deepEqual(min(math.bignumber(1), new Complex(0,1)), new Complex(0,1));
});
assert.throws(function () {min(new Complex(3,4), 4)}, TypeError);
assert.throws(function () {min(new Complex(3,4), 5)}, TypeError);
assert.throws(function () {min(5, new Complex(3,4))}, TypeError);
assert.throws(function () {min(new Complex(3,4), 6)}, TypeError);
});
it('should throw an error when called multiple arrays or matrices', function() {