Math.js库的使用
来源:互联网 发布:北京网络职业学院搬迁 编辑:程序博客网 时间:2024/05/21 10:35
Math.js库的使用
可以使用npm或Bower来安装Math.js,直接从Web网站下载,或者通过内容发布网络(CDN)来方法。它可以用于浏览器中,或者用于Node应用程序中。它提供了一组函数来执行操作,例如 add()和multiply()等,支持链化使用。
特征:
- Supports numbers, big numbers, complex numbers, fractions, units, strings, arrays, and matrices.
- Is compatible with JavaScript’s built-in Math library.
- Contains a flexible expression parser.
- Does symbolic computation.
- Comes with a large set of built-in functions and constants.
- Has no dependencies. Runs on any JavaScript engine.
- Can be used as a command line application as well.
- Is easily extensible.
- Open source.
<!DOCTYPE html><html><head> <meta name="description" content="math.js | basic usage"> <title>math.js | basic usage</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/3.14.2/math.min.js"></script></head><body> <script> // functions and constants print(math.round(math.e, 3)); // 2.718 print(math.atan2(3, -3) / math.pi); // 0.75 print(math.log(10000, 10)); // 4 print(math.sqrt(-4)); // 2i print(math.pow([[-1, 2], [3, 1]], 2)); // [[7, 0], [0, 7]] print(math.derivative('x^2 + x', 'x')); // 2 * x + 1 // expressions print(math.eval('12 / (2.3 + 0.7)')); // 4 print(math.eval('12.7 cm to inch')); // 5 inch print(math.eval('9 / 3 + 2i')); // 3 + 2i print(math.eval('det([-1, 2; 3, 1])')); // -7 // chaining var a = math.chain(3) .add(4) .multiply(2) .done(); print(a); // 14 // helper function to output formatted results. function print(value) { var precision = 14; document.write(math.format(value, precision) + '<br>'); } </script></body></html>
下载网站
+ website: http://mathjs.org
+ docs: http://mathjs.org/docs
+ examples: http://mathjs.org/examples
阅读全文
0 0
- Math.js库的使用
- js Math的使用
- JS的Math方法使用
- JS中Math.ceil()和Math.floor(x)的使用
- cocos2d-js使用Math.sin(),Math.cos()
- js的Math函数
- JS的Math对象
- js的Math对象
- js使用Number和Math
- js Math.abs,ceil,floor,round,toFixed函数的使用
- js的随机数生成器,不再使用Math.random
- js中的Math.ceil() 、Math.floor() 、Math.round() 的意思
- 使用math库遇到的错误
- linux中math.h库的使用
- Math类的使用
- Math类的使用
- Math的使用
- math类的使用
- 浏览器缓存
- UVA
- 求1+2+3+...+n(剑指Offer)
- Telnet4种操作方式
- Primer (十一)
- Math.js库的使用
- Windows合并音频
- 从源码理解Spring原理,并用代码实现简易Spring框架
- 2017年——年总结
- 第一个C程序
- [Noip2010普及组]数字统计
- matlab_syms+eval
- 常用控件
- 8.20 北校 复习