```
from sympy import *
from ga import Ga
from printer import Format, Fmt
Format()
```


```
xyz_coords = (x, y, z) = symbols('x y z', real=True)
(o3d, ex, ey, ez) = Ga.build('e', g=[1, 1, 1], coords=xyz_coords, norm=True)
```


```
f = o3d.mv('f', 'scalar', f=True)
F = o3d.mv('F', 'vector', f=True)
lap = o3d.grad*o3d.grad
```


```
lap.Fmt(1,r'\nabla^{2}')
```




\begin{equation*} \nabla^{2} = \frac{\partial^{2}}{\partial x^{2}} + \frac{\partial^{2}}{\partial y^{2}} + \frac{\partial^{2}}{\partial z^{2}} \end{equation*}




```
(lap*f).Fmt(1,r'\nabla^{2}f')
```




\begin{equation*} \nabla^{2}f = \partial^{2}_{x} f  + \partial^{2}_{y} f  + \partial^{2}_{z} f  \end{equation*}




```
o3d.grad | (o3d.grad * f)
```




\begin{equation*} \partial^{2}_{x} f  + \partial^{2}_{y} f  + \partial^{2}_{z} f  \end{equation*}




```
o3d.grad|F
```




\begin{equation*} \partial_{x} F^{x}  + \partial_{y} F^{y}  + \partial_{z} F^{z}  \end{equation*}




```
o3d.grad * F
```




\begin{equation*} \left ( \partial_{x} F^{x}  + \partial_{y} F^{y}  + \partial_{z} F^{z} \right )  + \left ( - \partial_{y} F^{x}  + \partial_{x} F^{y} \right ) e_{x}\wedge e_{y} + \left ( - \partial_{z} F^{x}  + \partial_{x} F^{z} \right ) e_{x}\wedge e_{z} + \left ( - \partial_{z} F^{y}  + \partial_{y} F^{z} \right ) e_{y}\wedge e_{z} \end{equation*}




```
sph_coords = (r, th, phi) = symbols('r theta phi', real=True)
(sp3d, er, eth, ephi) = Ga.build('e', g=[1, r**2, r**2 * sin(th)**2], coords=sph_coords, norm=True)
```


```
f = sp3d.mv('f', 'scalar', f=True)
F = sp3d.mv('F', 'vector', f=True)
B = sp3d.mv('B', 'bivector', f=True)
lap = sp3d.grad*sp3d.grad
lap.Fmt(1,r'\nabla^{2}')
```




\begin{equation*} \nabla^{2} = \frac{2}{r} \frac{\partial}{\partial r} + \frac{\cos{\left (\theta  \right )}}{r^{2} \sin{\left (\theta  \right )}} \frac{\partial}{\partial \theta } + \frac{\partial^{2}}{\partial r^{2}} + r^{-2} \frac{\partial^{2}}{\partial \theta ^{2}} + \frac{1}{r^{2} \sin^{2}{\left (\theta  \right )}} \frac{\partial^{2}}{\partial \phi ^{2}} \end{equation*}




```
lap*f
```




\begin{equation*} \frac{1}{r^{2}} \left(r^{2} \partial^{2}_{r} f  + 2 r \partial_{r} f  + \partial^{2}_{\theta } f  + \frac{\partial_{\theta } f }{\tan{\left (\theta  \right )}} + \frac{\partial^{2}_{\phi } f }{\sin^{2}{\left (\theta  \right )}}\right) \end{equation*}




```
sp3d.grad | (sp3d.grad * f)
```




\begin{equation*} \frac{1}{r^{2}} \left(r^{2} \partial^{2}_{r} f  + 2 r \partial_{r} f  + \partial^{2}_{\theta } f  + \frac{\partial_{\theta } f }{\tan{\left (\theta  \right )}} + \frac{\partial^{2}_{\phi } f }{\sin^{2}{\left (\theta  \right )}}\right) \end{equation*}




```
sp3d.grad | F
```




\begin{equation*} \frac{1}{r} \left(r \partial_{r} F^{r}  + 2 F^{r}  + \frac{F^{\theta } }{\tan{\left (\theta  \right )}} + \partial_{\theta } F^{\theta }  + \frac{\partial_{\phi } F^{\phi } }{\sin{\left (\theta  \right )}}\right) \end{equation*}




```
sp3d.grad ^ F
```




\begin{equation*} \frac{1}{r} \left(r \partial_{r} F^{\theta }  + F^{\theta }  - \partial_{\theta } F^{r} \right) e_{r}\wedge e_{\theta } + \frac{1}{r} \left(r \partial_{r} F^{\phi }  + F^{\phi }  - \frac{\partial_{\phi } F^{r} }{\sin{\left (\theta  \right )}}\right) e_{r}\wedge e_{\phi } + \frac{1}{r} \left(\frac{F^{\phi } }{\tan{\left (\theta  \right )}} + \partial_{\theta } F^{\phi }  - \frac{\partial_{\phi } F^{\theta } }{\sin{\left (\theta  \right )}}\right) e_{\theta }\wedge e_{\phi } \end{equation*}




```
(sp3d.grad | B).Fmt(3)
```




 \begin{align*}  & - \frac{1}{r} \left(\frac{B^{r\theta } }{\tan{\left (\theta  \right )}} + \partial_{\theta } B^{r\theta }  + \frac{\partial_{\phi } B^{r\phi } }{\sin{\left (\theta  \right )}}\right) e_{r} \\  &  + \frac{1}{r} \left(r \partial_{r} B^{r\theta }  + B^{r\theta }  - \frac{\partial_{\phi } B^{\phi \phi } }{\sin{\left (\theta  \right )}}\right) e_{\theta } \\  &  + \frac{1}{r} \left(r \partial_{r} B^{r\phi }  + B^{r\phi }  + \partial_{\theta } B^{\phi \phi } \right) e_{\phi }  \end{align*} 





```
Fmt([o3d.grad,o3d.grad],1)
```




\begin{equation*}  \left [ \begin{array}{cc} e_{x} \frac{\partial}{\partial x} + e_{y} \frac{\partial}{\partial y} + e_{z} \frac{\partial}{\partial z}, & e_{x} \frac{\partial}{\partial x} + e_{y} \frac{\partial}{\partial y} + e_{z} \frac{\partial}{\partial z}\\ \end{array} \right ] 
\end{equation*}




```
F.Fmt(1)
```




\begin{equation*} F = F^{r}  e_{r} + F^{\theta }  e_{\theta } + F^{\phi }  e_{\phi } \end{equation*}




```
Fmt((F,F))
```




\begin{equation*} \begin{array}{c} \left ( F^{r}  e_{r} + F^{\theta }  e_{\theta } + F^{\phi }  e_{\phi }, \right. \\  \left. F^{r}  e_{r} + F^{\theta }  e_{\theta } + F^{\phi }  e_{\phi }\right ) \\ \end{array}\end{equation*}




```

```

fab731e58e557fc7f87f54d3d2fc968aef5f7e12
ipynb
Jupyter Notebook
examples/ipython/dop.ipynb
moble/galgebra
f77305eae1366eb2bb6e5e5c47b9788e22bd46e8
BSD-3-Clause
2018-03-06T15:00:36.000Z
2018-03-06T15:00:36.000Z
examples/ipython/dop.ipynb
rschwiebert/galgebra
852f6d2574780718ef327f172cd1b8fa7d0a9879
BSD-3-Clause
examples/ipython/dop.ipynb
rschwiebert/galgebra
852f6d2574780718ef327f172cd1b8fa7d0a9879
BSD-3-Clause
2018-12-04T02:06:14.000Z
2018-12-04T02:06:14.000Z
Qwen/Qwen-72B
1. YES
2. YES