```python
# A geometric algebra for the unit sphere in R^3 
# as a submanifold of R^3 with spherical coordintes.

# 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
# A geometric algebra for the unit sphere in R^3 
# as a submanifold of R^3 with spherical coordintes.

# sp3: Base manifold
sp3coords = (r, phi, theta) = symbols('r phi theta', real=True) 
sp3 = Ga('e', g=None, coords=sp3coords, \
    X=[r*sin(phi)*cos(theta), r*sin(phi)*sin(theta), r*cos(phi)], norm=True)
(er, ephi, etheta) = sp3.mv()

# sp2: Submanifold
sp2coords = (p,t) = symbols('phi theta', real=True) # they output as Greek phi and theta
  # Parameterize the unit sphere using the spherical coordinates of sp3:
sp2param = [1, p, t] 
  # Map the sp3 coordinates of the sphere to its sp2 coordinates:
sp2 = sp3.sm(sp2param, sp2coords, norm=True)

(ep, et) = sp2.mv()
(rp, rt) = sp2.mvr()

# Derivatives
grad  = sp2.grad
from galgebra.dop import *
pdph = Pdop(p)
pdth = Pdop(t)
```


```python
gprint(grad) 
```


```python

```

27280692b3525be9efce2283b5f909382be79565
ipynb
Jupyter Notebook
python/GeometryAG/gaprimer/sp2sp3.ipynb
karng87/nasm_game
a97fdb09459efffc561d2122058c348c93f1dc87
MIT
python/GeometryAG/gaprimer/sp2sp3.ipynb
karng87/nasm_game
a97fdb09459efffc561d2122058c348c93f1dc87
MIT
python/GeometryAG/gaprimer/sp2sp3.ipynb
karng87/nasm_game
a97fdb09459efffc561d2122058c348c93f1dc87
MIT
Qwen/Qwen-72B
1. YES
2. YES