- Math.js的使用
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>072</title>
</head>
<body>
<script type="text/javascript" src="math.js"></script>
</body>
<script type="text/javascript">
var exp = "4 + 3 * 10 / 8";
console.log(math.eval(exp));
var m = math.matrix([[4,3,2],[6,6,8],[7,4,6]]);
console.log(m.valueOf());
var z = math.zeros(2,2);
console.log(z.valueOf());
var b = math.complex('4-2i');
b.re = 5;
console.log(b.valueOf());
</script>
</html>