<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 This example is kindly contributed by FreddyBaudine for reproducing pygae/galgebra#26 and pygae/galgebra#30 with modifications by utensil.
Please note before Python code, there's an invisible markdown cell with the following code to enable color and define some colors from http
Step1:  Base manifold (three dimensional)
Metric tensor (cartesian coordinates - norm = False)
Step2:  Two dimensioanal submanifold - Unit sphere
Basis not normalised
Step3:  Christoffel symbols of the first kind
Step4:  One dimensioanal submanifold
Basis not normalised
<ASSISTANT_TASK:>
Python Code:
from __future__ import print_function
import sys
from galgebra.printer import  Format, xpdf
Format()
from sympy import symbols, sin, pi, latex, Array, permutedims
from galgebra.ga import Ga
from IPython.display import Math
Explanation: This example is kindly contributed by FreddyBaudine for reproducing pygae/galgebra#26 and pygae/galgebra#30 with modifications by utensil.
Please note before Python code, there's an invisible markdown cell with the following code to enable color and define some colors from http://latexcolor.com/:
markdown
$$
\require{color}
\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}
\definecolor{applegreen}{rgb}{0.55, 0.71, 0.0}
\definecolor{atomictangerine}{rgb}{1.0, 0.6, 0.4}
$$
$$
\require{color}
\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}
\definecolor{applegreen}{rgb}{0.55, 0.71, 0.0}
\definecolor{atomictangerine}{rgb}{1.0, 0.6, 0.4}
$$
End of explanation
from sympy import cos, sin, symbols
g3coords = (x,y,z) = symbols('x y z')
g3 = Ga('ex ey ez', g = [1,1,1], coords = g3coords,norm=False) # Create g3
(e_x,e_y,e_z) = g3.mv()
Math(r'g =%s' % latex(g3.g))
Explanation: Base manifold (three dimensional)
Metric tensor (cartesian coordinates - norm = False)
End of explanation
sp2coords = (theta, phi) = symbols(r'{\color{airforceblue}\theta} {\color{applegreen}\phi}', real = True)
sp2param = [sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta)]
sp2 = g3.sm(sp2param, sp2coords, norm = False) # submanifold
(etheta, ephi) = sp2.mv() # sp2 basis vectors
(rtheta, rphi) = sp2.mvr() # sp2 reciprocal basis vectors
sp2grad = sp2.grad
sph_map = [1, theta, phi]  # Coordinate map for sphere of r = 1
Math(r'(\theta,\phi)\rightarrow (r,\theta,\phi) = %s' % latex(sph_map))
Math(r'e_\theta \cdot e_\theta = %s' % (etheta|etheta))
Math(r'e_\phi \cdot e_\phi = %s' % (ephi|ephi))
Math('g = %s' % latex(sp2.g))
Math(r'g^{-1} = %s' % latex(sp2.g_inv))
Explanation: Two dimensioanal submanifold - Unit sphere
Basis not normalised
End of explanation
Cf1 = sp2.Christoffel_symbols(mode=1)
Cf1 = permutedims(Array(Cf1), (2, 0, 1))
Math(r'\Gamma_{1, \alpha, \beta} = %s \quad \Gamma_{2, \alpha, \beta} = %s ' % (latex(Cf1[0, :, :]), latex(Cf1[1, :, :])))
Cf2 = sp2.Christoffel_symbols(mode=2)
Cf2 = permutedims(Array(Cf2), (2, 0, 1))
Math(r'\Gamma^{1}_{\phantom{1,}\alpha, \beta} = %s \quad \Gamma^{2}_{\phantom{2,}\alpha, \beta} = %s ' % (latex(Cf2[0, :, :]), latex(Cf2[1, :, :])))
F = sp2.mv('F','vector',f=True) #scalar function
f = sp2.mv('f','scalar',f=True) #vector function
Math(r'\nabla = %s' % sp2grad)
Math(r'\nabla f = %s' % (sp2.grad * f))
Math(r'F = %s' % F)
Math(r'\nabla F = %s' % (sp2.grad * F))
Explanation: Christoffel symbols of the first kind:
End of explanation
cir_th = phi = symbols(r'{\color{atomictangerine}\phi}',real = True)
cir_map = [pi/8, phi]
Math(r'(\phi)\rightarrow (\theta,\phi) = %s' % latex(cir_map))
cir1d = sp2.sm( cir_map , (cir_th,), norm = False) # submanifold
cir1dgrad = cir1d.grad
(ephi) = cir1d.mv()
Math(r'e_\phi \cdot e_\phi = %s' % latex(ephi[0] | ephi[0]))
Math('g = %s' % latex(cir1d.g))
h = cir1d.mv('h','scalar',f= True)
H = cir1d.mv('H','vector',f= True)
Math(r'\nabla = %s' % cir1dgrad)
Math(r'\nabla h = %s' %(cir1d.grad * h).simplify())
Math('H = %s' % H)
Math(r'\nabla H = %s' % (cir1d.grad * H).simplify())
Explanation: One dimensioanal submanifold
Basis not normalised
End of explanation
<END_TASK>