1 | # algebra
|
2 |
|
3 | > Vectors, Matrices, Tensors for Node.js
|
4 |
|
5 | [![NPM version](https://badge.fury.io/js/algebra.png)](http://badge.fury.io/js/algebra) [![Build Status](https://travis-ci.org/fibo/algebra.png?branch=master)](https://travis-ci.org/fibo/algebra?branch=master) [![Dependency Status](https://gemnasium.com/fibo/algebra.png)](https://gemnasium.com/fibo/algebra)
|
6 |
|
7 | For more information point your browser to [algebra Homepage](//g14n.info/algebra).
|
8 |
|
9 | ## Status
|
10 |
|
11 | *algebra* is under development. Api can change until version **1.0** but not without a good reason.
|
12 |
|
13 | ## Synopsis
|
14 |
|
15 | ```
|
16 | var algebra = require('algebra');
|
17 |
|
18 | var R = algebra.Real;
|
19 |
|
20 | // Static addition operator
|
21 | console.log(R.add(1, 2, 3)); // 1 + 2 + 3 = 6
|
22 |
|
23 | // Create two real numbers: x = 2, y = -1
|
24 | var x = new R(2),
|
25 | y = new R(-1);
|
26 |
|
27 | // Operators on objects are mutators. Here x value is modified, multipling it by y value.
|
28 | x.mul(y);
|
29 | console.log(x.data); // 2 * (-1) = -2
|
30 |
|
31 | // Number coercion and chained operators.
|
32 | // Resulting x value will be 0.25: x -> x + 5 -> x * 2 -> x ^-1
|
33 | x.add(5).mul(2).inv();
|
34 | console.log(x.data); // ((-3 + 5) * 2)^(-1) = 0.25
|
35 |
|
36 | // Vectors, Matrices, Tensors
|
37 | var R2 = algebra.VectorSpace(R)(2);
|
38 |
|
39 | var v1 = new R2([0, 1]);
|
40 | var v2 = new R2([1, -4]);
|
41 | ```
|
42 |
|
43 | ##See also
|
44 |
|
45 | * [algebra quick start](//g14n.info/algebra/examples/quick-start)
|
46 | : A 60 seconds tutorial to get your hands dirty with algebra.
|
47 |
|
48 | ## Installation
|
49 |
|
50 | With [npm](https://npmjs.org/) do
|
51 |
|
52 | ```bash
|
53 | $ npm install algebra
|
54 | ```
|
55 |
|
56 | ## License
|
57 |
|
58 | [MIT](//g14n.info/mit-licence)
|
59 |
|