Create a vector space over Real numbers with dimension 2.


var algebra = require('algebra'),
    should  = require('should')

var V = algebra.VectorSpace,
    R = algebra.Real

var R2 = V(R)(2)
var vector1 = new R2([1, 2])

Create few vectors


var vector1 = new R2.Vector([1, 2])
var vector2 = new R2.Vector([-1, 1])
var vector3 = new R2.Vector([0, 1])
var vector4 = new R2.Vector([2, 0])

Add vector1 to itself.


vector1.addition(vector1)
console.log(vector1.data) // [2, 4]

Add vector2 to vector1.


vector1.addition(vector2)
console.log(vector1.data) // [1, 5]

Addition accepts raw data.


vector1.addition([1, 1])
console.log(vector1.data) // [2, 6]

Addition is chainable.


vector1.addition(vector2).addition(vector3)
console.log(vector1.data) // [1, 8]

Addition accepts more than one argument.


vector1.addition(vector2, vector3, vector4)
console.log(vector1.data) // [2, 10]