mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
reduced the examples of comparision operations
This commit is contained in:
parent
275b09dce8
commit
4e324ee502
@ -44,36 +44,11 @@ print(c); // 1 + i
|
||||
var d = math.complex(3, 4);
|
||||
console.log(d.abs(), d.arg()); // radius = 5, phi = 0.9272952180016122
|
||||
|
||||
// comparisions between two complex numbers (only considers real components)
|
||||
console.log('\ncomparisions between two complex numbers (only considers real components)');
|
||||
var e = math.complex(3, 4);
|
||||
var f = math.complex(5, 6);
|
||||
console.log('compare - ', math.compare(e, f));
|
||||
console.log('larger - ', math.larger(e, f));
|
||||
console.log('largerEq - ', math.largerEq(e, f));
|
||||
console.log('smaller - ', math.smaller(e, f));
|
||||
console.log('smallerEq - ', math.smallerEq(e, f));
|
||||
|
||||
// comparisions between a complex number and a number
|
||||
console.log('\ncomparisions between a complex number and a number');
|
||||
var g = math.complex(6, 2);
|
||||
var h = 5;
|
||||
console.log('compare - ', math.compare(g, h));
|
||||
console.log('larger - ', math.larger(g, h));
|
||||
console.log('largerEq - ', math.largerEq(g, h));
|
||||
console.log('smaller - ', math.smaller(g, h));
|
||||
console.log('smallerEq - ', math.smallerEq(g, h));
|
||||
|
||||
// comparisions between a complex number and a number
|
||||
console.log('\ncomparisions between a complex number and a bignumber');
|
||||
var i = math.complex(6, 2);
|
||||
var j = math.bignumber(6);
|
||||
console.log('compare - ', math.compare(i, j));
|
||||
console.log('larger - ', math.larger(g, h));
|
||||
console.log('largerEq - ', math.largerEq(g, h));
|
||||
console.log('smaller - ', math.smaller(g, h));
|
||||
console.log('smallerEq - ', math.smallerEq(g, h));
|
||||
|
||||
// comparision operations
|
||||
// the values are evaluated using the 'real' parts of the complex numbers
|
||||
console.log('\ncomparision operations');
|
||||
console.log('compare - ', math.compare(a, b)); // returns 1 as 5 > 3
|
||||
console.log('larger - ', math.larger(a, b)); // returns true as 5 > 3
|
||||
|
||||
/**
|
||||
* Helper function to output a value in the console. Value will be formatted.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user