Beispiel #1
0
sp3d = Ga('e_r,e_th,e_ph', g=[1, r**2, r**2*sin(th)**2], coords=coords)
(er, eth, ephi) = sp3d.mv()

#Define coordinates for 2-d (u,v) and 1-d (s) manifolds

u,v,s,alpha = symbols('u v s alpha',real=True)

sub_coords = (u,v)

smap = [1, u, v]  # Coordinate map for sphere of r = 1 in 3-d

print r'(u,v)\rightarrow (r,\theta,\phi) = ',smap

#Define unit sphere manifold

sph2d = sp3d.sm(smap,sub_coords)

print '#Unit Sphere Manifold:'

print 'g =',sph2d.g

(eu,ev) = sph2d.mv()

#Define vector and vector field on unit sphere tangent space

a = sph2d.mv('a','vector')
b = sph2d.mv('b','vector')
c = sph2d.mv('c','vector')
f = sph2d.mv('f','vector',f=True)

print 'a =', a
Beispiel #2
0
from sympy import symbols, sin, pi, latex
from ga import Ga
from printer import Format, xpdf

Format()
coords = (r, th, phi) = symbols('r,theta,phi', real=True)
sp3d = Ga('e_r e_th e_ph', g=[1, r**2, r**2*sin(th)**2],\
          coords=coords, norm=True)

sph_uv = (u, v) = symbols('u,v', real=True)
sph_map = [1, u, v]  # Coordinate map for sphere of r = 1
sph2d = sp3d.sm(sph_map, sph_uv)

print(r'(u,v)\rightarrow (r,\theta,\phi) = ', latex(sph_map))
print('g =', latex(sph2d.g))
F = sph2d.mv('F', 'vector', f=True)  #scalar function
f = sph2d.mv('f', 'scalar', f=True)  #vector function
print(r'\nabla f =', sph2d.grad * f)
print('F =', F)
print(r'\nabla F = ', sph2d.grad * F)

cir_s = s = symbols('s', real=True)
cir_map = [pi / 8, s]
cir1d = sph2d.sm(cir_map, (cir_s, ))

print('g =', latex(cir1d.g))
h = cir1d.mv('h', 'scalar', f=True)
H = cir1d.mv('H', 'vector', f=True)
print(r'(s)\rightarrow (u,v) = ', latex(cir_map))
print('H =', H)
print(latex(H))
Beispiel #3
0
sp3d = Ga('e_r,e_th,e_ph', g=[1, r**2, r**2 * sin(th)**2], coords=coords)
(er, eth, ephi) = sp3d.mv()

#Define coordinates for 2-d (u,v) and 1-d (s) manifolds

u, v, s, alpha = symbols('u v s alpha', real=True)

sub_coords = (u, v)

smap = [1, u, v]  # Coordinate map for sphere of r = 1 in 3-d

print r'(u,v)\rightarrow (r,\theta,\phi) = ', smap

#Define unit sphere manifold

sph2d = sp3d.sm(smap, sub_coords)

print '#Unit Sphere Manifold:'

print 'g =', sph2d.g

(eu, ev) = sph2d.mv()

#Define vector and vector field on unit sphere tangent space

a = sph2d.mv('a', 'vector')
b = sph2d.mv('b', 'vector')
c = sph2d.mv('c', 'vector')
f = sph2d.mv('f', 'vector', f=True)

print 'a =', a
Beispiel #4
0
from sympy import symbols, sin, pi, latex
from ga import Ga
from printer import Format, xpdf

Format()
coords = (r, th, phi) = symbols('r,theta,phi', real=True)
sp3d = Ga('e_r e_th e_ph', g=[1, r**2, r**2*sin(th)**2], coords=coords, norm=True)

sph_uv = (u, v) = symbols('u,v', real=True)
sph_map = [1, u, v]  # Coordinate map for sphere of r = 1
sph2d = sp3d.sm(sph_map,sph_uv)

print r'(u,v)\rightarrow (r,\theta,\phi) = ',latex(sph_map)
print 'g =',latex(sph2d.g)
F = sph2d.mv('F','vector',f=True) #scalar function
f = sph2d.mv('f','scalar',f=True) #vector function
print r'\nabla f =',sph2d.grad * f
print 'F =',F
print r'\nabla F = ',sph2d.grad * F

cir_s = s = symbols('s',real=True)
cir_map = [pi/8,s]
cir1d = sph2d.sm(cir_map,(cir_s,))

print 'g =',latex(cir1d.g)
h = cir1d.mv('h','scalar',f=True)
H = cir1d.mv('H','vector',f=True)
print r'(s)\rightarrow (u,v) = ',latex(cir_map)
print 'H =', H
print latex(H)
print r'\nabla h =', cir1d.grad * h