# The CoffeeShop

Free ganja.js samples!

× Close

### Roll your own ganja :

###

- Browse the samples below.
- Edit them, save and share.
- Or hit the new button.

### Links :

Ganja.js on github. Ganja.js on npm. ObservableHQ cheat-sheets.

### Ganja.js is for:

- Learning and discovering Geometric Algebra
- Testing GA Algorithms
- Visualizing GA in any Algebra
- Realtime GA in your own projects

### The CoffeeShop

+ New
★ Save
▸ Run
free samples
my stash
inspect stash
?

Stash Info

Image Options

Stash URL click to copy

My stash

Complex \(\mathbb R_{0,1} \cong \mathbb C\)
Dual \(\mathbb R_{0,0,1} \cong \mathbb D\)
Quaternion\(\mathbb R_{0,2} \cong \mathbb H\)
Timespace \(\mathbb R_{1,3} \cong \mathbb M\)
3D GA\(\mathbb R_{3}\)
2D PGA \(\mathbb R_{2,0,1}\)
3D PGA \(\mathbb R_{3,0,1}\)
2D CGA \(\mathbb R_{3,1}\)
3D CGA \(\mathbb R_{4,1}\)
3D Mother Algebra\(\mathbb R_{4,4}\)
2D CSGA \(\mathbb R_{5,3}\)
3D CCGA \(\mathbb R_{6,3}\)
3D QCGA \(\mathbb R_{9,6}\)
Cubic 2D GA\(\mathbb R_{9,7}\)
Game

# | Grade | Name | Value
--- | --- | --- | ---

Basis and Metric

Ganja.js supports operator overloading and algebraic literals.

Operator | Javascript | Name
--- | --- | ---
\(a*b\) | a*b | Geometric Product
\(a\wedge b\) | a^b | Outer Product
\(a\vee b\) | a&b | Regressive Product
\(a\cdot b\) | a<<b | Left Contraction
\(a*b*\tilde a\) | a>>>b | Sandwich Product
\(\tilde a\) | ~a | Conjugate
\(\bar a\) | !a | Dual
\(\bar{\bar a}\) | a.Reverse | Reverse
\(a^{-1}\) | a**-1 | Inverse
\(e^a\) | Math.E**a | Exponentiation
\(a_{\langle b \rangle}\) | a.Grade(b) | Grade Extraction
\(a+b\) or \(a-b\) | a+b or a-b | Multivector Addition/Subtraction
\(4.2e_{12}\) | 4.2e12 | Blade Literals

Ganja.js supports vectors and matrices with multivector elements.

Operator | Javascript | Name
--- | --- | ---
\(\bold v = \begin{bmatrix} e_1 & 0 \end{bmatrix} \) | v = [1e1,0]; | Vector
\(\bold A = \begin{bmatrix} 1 & 0 \\ 0 & e_{12} \end{bmatrix} \) | A = [[1,0],[0,1e12]]; | Matrix
\(\bold v \cdot \bold w\) | v*w | Vector-Vector dot product.
\(A \bold v\) | A*v | Matrix-Vector product.
\(AB\) | A*B | Matrix-Matrix product.
\(A^{HT}\) | ~A | Conjugate-Transpose Matrix

Ganja.js can graph 2D and 3D PGA and CGA elements.

Element | Description
--- | ---
multivector | point, pair, line, circle, sphere, plane
number | Sets color. (e.g. #80FF0000 - transparent red)
string | Label for the last drawn item
[point,point] | Line segment between two points
[point,point,...,point] | (convex) polygon