<!DOCTYPE HTML>
<html>
<head>
<script src="math.min.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
console.log(math.sqrt(-4).toString()) // 2i
// functions and constants
console.log(math.round(math.e, 3)); // 2.718
console.log(math.atan2(3, -3) / math.pi); // 0.75
console.log(math.log(10000, 10)); // 4
console.log(math.sqrt(-4)); // 2i
console.log(math.pow([[-1, 2], [3, 1]], 2)); // [[7, 0], [0, 7]]
// expressions
console.log(math.evaluate('12 / (2.3 + 0.7)')); // 4
console.log(math.evaluate('12.7 cm to inch')); // 5 inch
console.log(math.evaluate('sin(45 deg) ^ 2')); // 0.5
console.log(math.evaluate('9 / 3 + 2i')); // 3 + 2i
console.log(math.evaluate('det([-1, 2; 3, 1])')); // -7
// chained operations
console.log(math.chain(3)
.add(4)
.multiply(2)
.done()); // 14
var result = math.round(math.subtract(100, 95.39), 2);
console.log(result); //4.61
</script>
</body>
</html>
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由半码博客整理,本文链接:https://www.bmabk.com/index.php/post/17291.html