```python
# Unit sphere R^3 as a submanifold of g3 in cartesian coordinates

# Make SymPy available to this program:
import sympy 
from sympy import *

# Make GAlgebra available to this program:
from galgebra.ga import *  
from galgebra.mv import *
from galgebra.printer import Fmt, GaPrinter, Format
    # Fmt:       sets the way that a multivector's basis expansion is output.
    # GaPrinter: makes GA output a little more readable.
    # Format:    turns on latex printer.
from galgebra.gprinter import gFormat, gprint
gFormat()
```


```python
# Unit sphere R^3 as a submanifold of g3 in cartesian coordinates

# g3: Base manifold.
g3coords = (x,y,z) = symbols('x y z', real=True) 
g3 = Ga('\mathbf{e}', g=[1,1,1], coords=g3coords)
(ex, ey, ez) = g3.mv()

# sp2: Submanifold
sp2coords = (phi,th) = symbols('phi theta', real=True)
  # Parameterize unit sphere using the coordinates of g3:
sp2param = [sin(phi)*cos(th), sin(phi)*sin(th), cos(phi)] 
  # Map the g3 coordinates of the sphere to its sp2 coordinates:
sp2 = g3.sm(sp2param, sp2coords, norm=True)  # "sm" is submanifold

(ephi, eth) = sp2.mv()
(rphi, rth) = sp2.mvr()

# Derivatives
grad  = sp2.grad
from galgebra.dop import *
pdphi = Pdop(phi)
pdth  = Pdop(th)
```


```python
grad = sp2.grad
grad
```


```python

```

18ba5f8eece13a71e7a62516441cce41fcb0b457
ipynb
Jupyter Notebook
python/GeometryAG/gaprimer/sp2g3.ipynb
karng87/nasm_game
a97fdb09459efffc561d2122058c348c93f1dc87
MIT
python/GeometryAG/gaprimer/sp2g3.ipynb
karng87/nasm_game
a97fdb09459efffc561d2122058c348c93f1dc87
MIT
python/GeometryAG/gaprimer/sp2g3.ipynb
karng87/nasm_game
a97fdb09459efffc561d2122058c348c93f1dc87
MIT
Qwen/Qwen-72B
1. YES
2. YES