```python
from __future__ import print_function
from sympy import Symbol, symbols, sin, cos, Rational, expand, simplify, collect, S
from galgebra.printer import Eprint, Get_Program, Print_Function, Format
from galgebra.ga import Ga, one, zero
from galgebra.mv import Nga
Format()
```


```python
X = (x, y, z) = symbols('x y z')
o3d = Ga('e_x e_y e_z', g=[1, 1, 1], coords=X)
(ex, ey, ez) = o3d.mv()
grad = o3d.grad
```


```python
c = o3d.mv('c', 'scalar')
```


```python
a = o3d.mv('a', 'vector')
b = o3d.mv('b', 'vector')
```


```python
A = o3d.mv('A','mv')
B = o3d.mv('B','mv')
```

The inner product of blades in GAlgebra is zero if either operand is a scalar:

$$\begin{split}\begin{aligned}
      {\boldsymbol{A}}_{r}{\wedge}{\boldsymbol{B}}_{s} &\equiv {\left <{{\boldsymbol{A}}_{r}{\boldsymbol{B}}_{s}} \right >_{r+s}} \\
      {\boldsymbol{A}}_{r}\cdot{\boldsymbol{B}}_{s} &\equiv {\left \{ { \begin{array}{cc}
      r\mbox{ and }s \ne 0: & {\left <{{\boldsymbol{A}}_{r}{\boldsymbol{B}}_{s}} \right >_{{\left |{r-s}\right |}}}  \\
      r\mbox{ or }s = 0: & 0 \end{array}} \right \}}
   \end{aligned}\end{split}$$
   
This definition comes from _David Hestenes and Garret Sobczyk, “Clifford Algebra to Geometric Calculus,” Kluwer Academic Publishers, 1984_.

In some other literature, the inner product is defined without the exceptional case for scalar part and the definition above is known as "the modified Hestenes inner product" (this name comes from the source code of [GAViewer](http://www.geometricalgebra.net/gaviewer_download.html)).


```python
c|a
```




\begin{equation*}  0  \end{equation*}




```python
a|c
```




\begin{equation*}  0  \end{equation*}




```python
c|A
```




\begin{equation*}  0  \end{equation*}




```python
A|c
```




\begin{equation*}  0  \end{equation*}



$ab=a \wedge b + a \cdot b$ holds for vectors:


```python
a*b
```




\begin{equation*} \left ( a^{x} b^{x} + a^{y} b^{y} + a^{z} b^{z}\right )  + \left ( a^{x} b^{y} - a^{y} b^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + \left ( a^{x} b^{z} - a^{z} b^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + \left ( a^{y} b^{z} - a^{z} b^{y}\right ) \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{equation*}




```python
a^b
```




\begin{equation*} \left ( a^{x} b^{y} - a^{y} b^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + \left ( a^{x} b^{z} - a^{z} b^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + \left ( a^{y} b^{z} - a^{z} b^{y}\right ) \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{equation*}




```python
a|b
```




\begin{equation*} a^{x} b^{x} + a^{y} b^{y} + a^{z} b^{z} \end{equation*}




```python
(a*b)-(a^b)-(a|b)
```




\begin{equation*}  0  \end{equation*}



$aA=a \wedge A + a \cdot A$ holds for the products between vectors and multivectors:


```python
a*A
```




\begin{equation*} \left ( A^{x} a^{x} + A^{y} a^{y} + A^{z} a^{z}\right )  + \left ( A a^{x} - A^{xy} a^{y} - A^{xz} a^{z}\right ) \boldsymbol{e}_{x} + \left ( A a^{y} + A^{xy} a^{x} - A^{yz} a^{z}\right ) \boldsymbol{e}_{y} + \left ( A a^{z} + A^{xz} a^{x} + A^{yz} a^{y}\right ) \boldsymbol{e}_{z} + \left ( A^{xyz} a^{z} - A^{x} a^{y} + A^{y} a^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + \left ( - A^{xyz} a^{y} - A^{x} a^{z} + A^{z} a^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + \left ( A^{xyz} a^{x} - A^{y} a^{z} + A^{z} a^{y}\right ) \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} + \left ( A^{xy} a^{z} - A^{xz} a^{y} + A^{yz} a^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{equation*}




```python
a^A
```




\begin{equation*} A a^{x} \boldsymbol{e}_{x} + A a^{y} \boldsymbol{e}_{y} + A a^{z} \boldsymbol{e}_{z} + \left ( - A^{x} a^{y} + A^{y} a^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + \left ( - A^{x} a^{z} + A^{z} a^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + \left ( - A^{y} a^{z} + A^{z} a^{y}\right ) \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} + \left ( A^{xy} a^{z} - A^{xz} a^{y} + A^{yz} a^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{equation*}




```python
a|A
```




\begin{equation*} \left ( A^{x} a^{x} + A^{y} a^{y} + A^{z} a^{z}\right )  + \left ( - A^{xy} a^{y} - A^{xz} a^{z}\right ) \boldsymbol{e}_{x} + \left ( A^{xy} a^{x} - A^{yz} a^{z}\right ) \boldsymbol{e}_{y} + \left ( A^{xz} a^{x} + A^{yz} a^{y}\right ) \boldsymbol{e}_{z} + A^{xyz} a^{z} \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} - A^{xyz} a^{y} \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + A^{xyz} a^{x} \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{equation*}




```python
(a*A)-(a^A)-(a|A)
```




\begin{equation*}  0  \end{equation*}



$AB=A \wedge B + A \cdot B$ does NOT hold for the products between multivectors and multivectors:


```python
A*B
```




\begin{equation*} \left ( A B - A^{xyz} B^{xyz} - A^{xy} B^{xy} - A^{xz} B^{xz} + A^{x} B^{x} - A^{yz} B^{yz} + A^{y} B^{y} + A^{z} B^{z}\right )  + \left ( A B^{x} - A^{xyz} B^{yz} + A^{xy} B^{y} + A^{xz} B^{z} + A^{x} B - A^{yz} B^{xyz} - A^{y} B^{xy} - A^{z} B^{xz}\right ) \boldsymbol{e}_{x} + \left ( A B^{y} + A^{xyz} B^{xz} - A^{xy} B^{x} + A^{xz} B^{xyz} + A^{x} B^{xy} + A^{yz} B^{z} + A^{y} B - A^{z} B^{yz}\right ) \boldsymbol{e}_{y} + \left ( A B^{z} - A^{xyz} B^{xy} - A^{xy} B^{xyz} - A^{xz} B^{x} + A^{x} B^{xz} - A^{yz} B^{y} + A^{y} B^{yz} + A^{z} B\right ) \boldsymbol{e}_{z} + \left ( A B^{xy} + A^{xyz} B^{z} + A^{xy} B - A^{xz} B^{yz} + A^{x} B^{y} + A^{yz} B^{xz} - A^{y} B^{x} + A^{z} B^{xyz}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + \left ( A B^{xz} - A^{xyz} B^{y} + A^{xy} B^{yz} + A^{xz} B + A^{x} B^{z} - A^{yz} B^{xy} - A^{y} B^{xyz} - A^{z} B^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + \left ( A B^{yz} + A^{xyz} B^{x} - A^{xy} B^{xz} + A^{xz} B^{xy} + A^{x} B^{xyz} + A^{yz} B + A^{y} B^{z} - A^{z} B^{y}\right ) \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} + \left ( A B^{xyz} + A^{xyz} B + A^{xy} B^{z} - A^{xz} B^{y} + A^{x} B^{yz} + A^{yz} B^{x} - A^{y} B^{xz} + A^{z} B^{xy}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{equation*}




```python
A|B
```




\begin{equation*} \left ( - A^{xyz} B^{xyz} - A^{xy} B^{xy} - A^{xz} B^{xz} + A^{x} B^{x} - A^{yz} B^{yz} + A^{y} B^{y} + A^{z} B^{z}\right )  + \left ( - A^{xyz} B^{yz} + A^{xy} B^{y} + A^{xz} B^{z} - A^{yz} B^{xyz} - A^{y} B^{xy} - A^{z} B^{xz}\right ) \boldsymbol{e}_{x} + \left ( A^{xyz} B^{xz} - A^{xy} B^{x} + A^{xz} B^{xyz} + A^{x} B^{xy} + A^{yz} B^{z} - A^{z} B^{yz}\right ) \boldsymbol{e}_{y} + \left ( - A^{xyz} B^{xy} - A^{xy} B^{xyz} - A^{xz} B^{x} + A^{x} B^{xz} - A^{yz} B^{y} + A^{y} B^{yz}\right ) \boldsymbol{e}_{z} + \left ( A^{xyz} B^{z} + A^{z} B^{xyz}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + \left ( - A^{xyz} B^{y} - A^{y} B^{xyz}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + \left ( A^{xyz} B^{x} + A^{x} B^{xyz}\right ) \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{equation*}




```python
(A*B)-(A^B)-(A|B)
```




\begin{equation*} \left ( - A^{xz} B^{yz} + A^{yz} B^{xz}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + \left ( A^{xy} B^{yz} - A^{yz} B^{xy}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + \left ( - A^{xy} B^{xz} + A^{xz} B^{xy}\right ) \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{equation*}




```python
(A<B)+(A|B)+(A>B)-A*B
```




\begin{equation*} \left ( A B - 2 A^{xyz} B^{xyz} - 2 A^{xy} B^{xy} - 2 A^{xz} B^{xz} + 2 A^{x} B^{x} - 2 A^{yz} B^{yz} + 2 A^{y} B^{y} + 2 A^{z} B^{z}\right )  + \left ( - A^{xyz} B^{yz} + A^{xy} B^{y} + A^{xz} B^{z} - A^{yz} B^{xyz} - A^{y} B^{xy} - A^{z} B^{xz}\right ) \boldsymbol{e}_{x} + \left ( A^{xyz} B^{xz} - A^{xy} B^{x} + A^{xz} B^{xyz} + A^{x} B^{xy} + A^{yz} B^{z} - A^{z} B^{yz}\right ) \boldsymbol{e}_{y} + \left ( - A^{xyz} B^{xy} - A^{xy} B^{xyz} - A^{xz} B^{x} + A^{x} B^{xz} - A^{yz} B^{y} + A^{y} B^{yz}\right ) \boldsymbol{e}_{z} + \left ( A^{xyz} B^{z} + A^{xz} B^{yz} - A^{x} B^{y} - A^{yz} B^{xz} + A^{y} B^{x} + A^{z} B^{xyz}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y} + \left ( - A^{xyz} B^{y} - A^{xy} B^{yz} - A^{x} B^{z} + A^{yz} B^{xy} - A^{y} B^{xyz} + A^{z} B^{x}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{z} + \left ( A^{xyz} B^{x} + A^{xy} B^{xz} - A^{xz} B^{xy} + A^{x} B^{xyz} - A^{y} B^{z} + A^{z} B^{y}\right ) \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} + \left ( - A^{xy} B^{z} + A^{xz} B^{y} - A^{x} B^{yz} - A^{yz} B^{x} + A^{y} B^{xz} - A^{z} B^{xy}\right ) \boldsymbol{e}_{x}\wedge \boldsymbol{e}_{y}\wedge \boldsymbol{e}_{z} \end{equation*}




```python

```

774bf436724a7999d13d2e0285da22c05988c6f2
ipynb
Jupyter Notebook
examples/ipython/inner_product.ipynb
EAR-Development/galgebra
f30de3069a28d99c759d15a6574919855921931d
BSD-3-Clause
examples/ipython/inner_product.ipynb
EAR-Development/galgebra
f30de3069a28d99c759d15a6574919855921931d
BSD-3-Clause
examples/ipython/inner_product.ipynb
EAR-Development/galgebra
f30de3069a28d99c759d15a6574919855921931d
BSD-3-Clause
Qwen/Qwen-72B
1. YES
2. YES