Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Quaternion-type/J/quaternion-type-1.j
Normal file
11
Task/Quaternion-type/J/quaternion-type-1.j
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
NB. utilities
|
||||
ip=: +/ .* NB. inner product
|
||||
T=. (_1^#:0 10 9 12)*0 7 16 23 A.=i.4
|
||||
toQ=: 4&{."1 :[: NB. real scalars -> quaternion
|
||||
|
||||
NB. task
|
||||
norm=: %:@ip~@toQ NB. | y
|
||||
neg=: -&toQ NB. - y and x - y
|
||||
conj=: 1 _1 _1 _1 * toQ NB. + y
|
||||
add=: +&toQ NB. x + y
|
||||
mul=: (ip T ip ])&toQ NB. x * y
|
||||
20
Task/Quaternion-type/J/quaternion-type-2.j
Normal file
20
Task/Quaternion-type/J/quaternion-type-2.j
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
T
|
||||
1 0 0 0
|
||||
0 1 0 0
|
||||
0 0 1 0
|
||||
0 0 0 1
|
||||
|
||||
0 _1 0 0
|
||||
1 0 0 0
|
||||
0 0 0 _1
|
||||
0 0 1 0
|
||||
|
||||
0 0 _1 0
|
||||
0 0 0 1
|
||||
1 0 0 0
|
||||
0 _1 0 0
|
||||
|
||||
0 0 0 _1
|
||||
0 0 _1 0
|
||||
0 1 0 0
|
||||
1 0 0 0
|
||||
21
Task/Quaternion-type/J/quaternion-type-3.j
Normal file
21
Task/Quaternion-type/J/quaternion-type-3.j
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
q=: 1 2 3 4
|
||||
q1=: 2 3 4 5
|
||||
q2=: 3 4 5 6
|
||||
r=: 7
|
||||
|
||||
norm q
|
||||
5.47723
|
||||
neg q
|
||||
_1 _2 _3 _4
|
||||
conj q
|
||||
1 _2 _3 _4
|
||||
r add q
|
||||
8 2 3 4
|
||||
q1 add q2
|
||||
5 7 9 11
|
||||
r mul q
|
||||
7 14 21 28
|
||||
q1 mul q2
|
||||
_56 16 24 26
|
||||
q2 mul q1
|
||||
_56 18 20 28
|
||||
Loading…
Add table
Add a link
Reference in a new issue