Working on mathjs

This commit is contained in:
Ilya Shestakov
2015-11-11 00:51:39 +03:00
committed by Ilya Shestakov
parent 8c4ec896ab
commit 567e5da215
2 changed files with 549 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
/// <reference path="mathjs.d.ts" />
// functions and constants
math.round(math.e, 3); // 2.718
math.atan2(3, -3) / math.pi; // 0.75
math.log(10000, 10); // 4
math.sqrt(-4); // 2i
math.pow([[-1, 2], [3, 1]], 2);
// [[7, 0], [0, 7]]
// expressions
math.eval('1.2 * (2 + 4.5)'); // 7.8
math.eval('5.08 cm to inch'); // 2 inch
math.eval('sin(45 deg) ^ 2'); // 0.5
math.eval('9 / 3 + 2i'); // 3 + 2i
math.eval('det([-1, 2; 3, 1])'); // -7
// chaining
math.chain(3)
.add(4)
.multiply(2)
.done(); // 14