There are different ways to go about doing this. I'll set UpValues on e for the multiplication of the basis vectors as you've defined them, and I'll use replacement Rules for the simplification of products of vectors expanded in the basis.
First of all
Unprotect[e]
ClearAll@e
e /: NonCommutativeMultiply[e[i_], e[j_]] /; i < j := -NonCommutativeMultiply[e[j], e[i]]
e /: NonCommutativeMultiply[e[i_], e[i_]] := 1
Protect[e]
This sets up a "normal order" for the products of basis vectors. It might not be what you want, but it aids in simplifying compound expressions. Once you've run the lines above, then (non-commutative) products of the es are automatically sorted according to descending order left to right:
e[3] ** e[3]
(* 1 *)
and
e[1] ** e[2]
(* -e[2] ** e[1] *)
and
e[2] ** e[1]
(* e[2] ** e[1] *)
To extend this basis to a linear space, we form all formal linear combinations of these basis elements. Particular examples are
ClearAll[a,b]
vec1 = Sum[e[j] a[j], {j, 1, 3}]
vec2 = Sum[e[j] b[j], {j, 1, 3}]
(* a[1] e[1] + a[2] e[2] + a[3] e[3] *)
(* b[1] e[1] + b[2] e[2] + b[3] e[3] *)
Then, we can implement some linearity rules and scalar rules
ncmRules = {
a___ ** (-b_) ** c___ :> -a ** b ** c,
a_Plus ** b_ :> (# ** b & /@ a),
a_ ** b_Plus :> (a ** # & /@ b),
x___ ** a_ ** y_ /; FreeQ[a, e] :> a x ** y,
x_ ** a_ ** y___ /; FreeQ[a, e] :> a x ** y,
x___ ** (a_ y_) ** z_ /; FreeQ[a, e] :> a x ** y ** z,
(x_) ** (a_ y_) ** z___ /; FreeQ[a, e] :> a x ** y ** z,
NonCommutativeMultiply[a_] :> a
};
and define a function that applies these rules:
ncmSimplify[expr_] := expr //. ncmRules
For instance,
Collect[vec1 ** vec2 // ncmSimplify, _e ** _e]
(* a[1] b[1] + a[2] b[2] + a[3] b[3]
+ (a[2] b[1] - a[1] b[2]) e[2] ** e[1]
+ (a[3] b[1] - a[1] b[3]) e[3] ** e[1]
+ (a[3] b[2] - a[2] b[3]) e[3] ** e[2] *)
and
e[1] ** e[2] ** e[1] ** e[2] // ncmSimplify
(* -1 *)
NonCommutativeMultiply(infix notation:**)), and define replacement rules or destructuring functions to simplify them. How much functionality do you need? What kind of algebra are thee's a basis of? – march Nov 02 '16 at 20:21e's are the basis vectors of 'Geometric Algebra' which is essentially a generalization of regular vector algebra and complex numbers. Essentially, if you have two vectors that are elements of the Geometric Algebra, $u$ and $v$, $uv=u \cdot v +u \wedge v$ where the dot product and wedge products there are the operations we're familiar with from regular vector algebra and exterior algebra. – Mason Nov 02 '16 at 20:24es? Then, you allow multiplication of the linear combinations by linearly extending multiplication of the basis vectors? – march Nov 02 '16 at 20:26