Instantly share code, notes, and snippets.

Created March 31, 2018 00:37
Show Gist options
• Save kumadasu/a8df123dd1f7c3b64f206670157f963e to your computer and use it in GitHub Desktop.

``````a = red(e1)
b = green(e2)
c = blue(e3)
``````

6.1 Grassman algebra

``````e1^e1	# >> 0
e2^e1	# >> -e1^e2
``````

6.2 Clifford algebra

``````e1 e1	# >> 1
e2 e1	# >> -e1^e2

grade(3 e1 e2)	# >> 2
grade(3 e1 e2 e3)	# >> 3
``````

6.3 odd/even multivector

``````A1 = 3 e1 + 4 e2 + 5 e3 + 6 e1 e2 e3
A2 = 4 e1 + 5 e2 + 6 e3 + 7 e1 e2 e3
A1 A2	# odd odd = even

B1 = 2 + 3 e1^e2 + 4 e2^e3 + 5 e3^e1
B2 = 3 + 4 e1^e2 + 5 e2^e3 + 6 e3^e1
B1 B2	# even even = even

A1 B1	# odd even = odd
B2 A2	# even odd = odd

(A1+B1) (A2+B2)
(A1 A2 + B1 B2) + (A1 B2 + B1 A2)	# This is equal to above one.
``````

6.4 Clifford algebra includes Grassman algebra

``````clf()

a = red(e1)
b = green(2 e2)
c = blue(3 e3)

a^b
1/2 (a b - b a)	# antisymmetrization

a^b^c
1/6 (a b c + b c a + c a b - c b a - b a c - a c b)
``````

6.5 Characteristics of geometric product

6.5.1 representation by contraction and outer product

``````a = red(e1 + e2)
b = green(2 e2 + e3)
c = blue(3 e3 + e1)
1/2 (a b + b a)	# symmetrization
a.b		# inner product

a b
a.b + a^b
lcont(a, b) + a^b

a(b^c)
lcont(a,b^c)+a^b^c

``````

6.5.2 inverse

``````inverse(a)
a/norm_2(a)
a inverse(a)
inverse(a) a

inverse(a b)
inverse(b) inverse(a)
inverse(a b c)
inverse(c) inverse(b) inverse(a)
``````

6.6 projection, rejection, line reflection, surface reflection

for line

``````(c.a) inverse(a)	# projection
project(c, a)

(c^a) inverse(a)	# rejection
reject(c, a)

(c.a) inverse(a) + (c^a) inverse(a)	# equal to c
(c.a) inverse(a) - (c^a) inverse(a)	# line reflection
a c inverse(a)		# line reflection
``````

for surface

``````(c^a) inverse(a)	# projection
(c.a) inverse(a)	# rejection
-a c inverse(a)		# surface reflection
``````

6.7 rotation

6.7.1 by surface reflection

``````R = b a
R c inverse(R)
versor_product(R, x)	# versor product
vp(R, x)		# synonym of versor product
``````

6.7.2 by surface element

``````clf()
a = red(normalize(e1 + e2))
b = green(normalize(2 e2 + e3))
x = blue(3 e3 + e1)

c = (a+b) / sqrt(2 (1+ a.b))

(1+(b a)) / sqrt(2 (1+ a.b))
c a

theta = atan2(norm(reject(b, a)), norm(project(b, a)))
I = (a^b) / (norm(a) norm(b) sin(theta))

b a
cos(theta) - I sin(theta)

inverse(b a)
cos(theta) + I sin(theta)
``````

6.7.3 exponential form

``````I I	# >> -1

b a
exp(-theta I)	# exponential form
``````

6.8 Versor

``````clf()
a = red(e1 + e2)
b = green(2 e2 + e3)
c = blue(3 e3 + e1)

d = yellow(e1+e2+e3)
e = cyan(e1+2 e2-0.5 e3)

R = e d
a^b
vp(R, a^b)

remove(R)
a^b
vp(d, a^b)

a^b^c
vp(e, a^b^c)
``````

疑問

normalize関数の中で使われているnorm_rって何者？

GAViewer Documentation Version 0.84 p.33

``````normalize(a) = a / abs(norm_r(a))
norm_r(a) = the grade 1 part of aã
``````

3重ベクトルにベクトル作用子で変換をしても変化しない？

ノルムが変わることがないから、変化することがない？