-
Notifications
You must be signed in to change notification settings - Fork 1
/
fluidDynamics.py
executable file
·70 lines (58 loc) · 1.85 KB
/
fluidDynamics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
from sympy import *
from sympy.galgebra.printing import xdvi
from sympy.galgebra.ga import *
Format()
X = (x0,x1,x2,x3) = symbols('0 1 2 3')
metric = '-1 0 0 0,'+ \
'0 1 0 0,'+ \
'0 0 1 0,'+ \
'0 0 0 1,'
(e_0,e_1,e_2,e_3,grad) = MV.setup('e_0 e_1 e_2 e_3',metric=metric,coords=X)
phi = MV('\phi','scalar',fct=True)
U = MV('U','vector',fct=True)
V = MV('V','vector',fct=True)
B = MV('B','bivector',fct=True)
T = MV(base='T,3',mvtype='grade',fct=True)
A = MV('A','mv')
print r'\text{Geometric Algebra on 3-dimensional Euclidean space}'
print r'\text{metric}'
print r'g_{ij} =',MV.metric
print r'\text{base}'
print r'\bm{e_0*e_1*e_2*e_3} =',e_0*e_1*e_2*e_3
print r'\star(\bm{e_0*e_1*e_2*e_3}) = (\bm{e_0*e_1*e_2*e_3})*(\bm{e_0*e_1*e_2*e_3}) =',e_0*e_1*e_2*e_3*e_0*e_1*e_2*e_3
print r'\text{Scalar(0-vector)}'
print r'\phi =',phi
print r'grad*\phi =',grad*phi
print r'grad|\phi =',grad|phi
print r'grad^\phi =',grad^phi
print r'\star \phi =',phi*e_0*e_1*e_2*e_3
print r'\text{Vector(1-vector)}'
print r'\bm{V} =',V
print r'grad*\bm{V} =',grad*V
print r'grad|\bm{V} =',grad|V
print r'grad^\bm{V} =',grad^V
print r'\star \bm{V} =',V*e_0*e_1*e_2*e_3
print r'\text{Bivector(2-vector)}'
print r'\bm{B} =',B
print r'grad*\bm{B} =',grad*B
print r'grad|\bm{B} =',grad|B
print r'grad^\bm{B} =',grad^B
print r'\star \bm{B} =',B*e_0*e_1*e_2*e_3
print r'\text{3-vector}'
print r'\bm{T} =',T
print r'grad*\bm{T} =',grad*T
print r'grad|\bm{T} =',grad|T
print r'grad^\bm{T} =',grad^T
print r'\star \bm{T} =',T*e_0*e_1*e_2*e_3
print r'\text{Multi Vector}'
print r'\bm{A} =',A
print r'grad*\bm{A} =',grad*A
print r'grad|\bm{A} =',grad|A
print r'grad^\bm{A} =',grad^A
print r'\star \bm{A} = \bm{A}*\bm{e_0*e_1*e_2*e_3} =',A*(e_0*e_1*e_2*e_3)
#print r'grad|\bm{A} =',grad|A
#print r'grad*\bm{A} =',grad*A
#A.Fmt(2,r'\bm{A}')
#A.Fmt(3,r'\bm{A}')
xdvi()