A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
24
Task/Element-wise-operations/J/element-wise-operations.j
Normal file
24
Task/Element-wise-operations/J/element-wise-operations.j
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
scalar =: 10
|
||||
vector =: 2 3 5
|
||||
matrix =: 3 3 $ 7 11 13 17 19 23 29 31 37
|
||||
|
||||
scalar * scalar
|
||||
100
|
||||
scalar * vector
|
||||
20 30 50
|
||||
scalar * matrix
|
||||
70 110 130
|
||||
170 190 230
|
||||
290 310 370
|
||||
|
||||
vector * vector
|
||||
4 9 25
|
||||
vector * matrix
|
||||
14 22 26
|
||||
51 57 69
|
||||
145 155 185
|
||||
|
||||
matrix * matrix
|
||||
49 121 169
|
||||
289 361 529
|
||||
841 961 1369
|
||||
24
Task/Element-wise-operations/K/element-wise-operations.k
Normal file
24
Task/Element-wise-operations/K/element-wise-operations.k
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
scalar: 10
|
||||
vector: 2 3 5
|
||||
matrix: 3 3 # 7 11 13 17 19 23 29 31 37
|
||||
|
||||
scalar * scalar
|
||||
100
|
||||
scalar * vector
|
||||
20 30 50
|
||||
scalar * matrix
|
||||
(70 110 130
|
||||
170 190 230
|
||||
290 310 370)
|
||||
|
||||
vector * vector
|
||||
4 9 25
|
||||
vector * matrix
|
||||
(14 22 26
|
||||
51 57 69
|
||||
145 155 185)
|
||||
|
||||
matrix * matrix
|
||||
(49 121 169
|
||||
289 361 529
|
||||
841 961 1369)
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
S = 10 ; M = {{7, 11, 13}, {17 , 19, 23} , {29, 31, 37}};
|
||||
M + S
|
||||
M - S
|
||||
M * S
|
||||
M / S
|
||||
M ^ S
|
||||
|
||||
M + M
|
||||
M - M
|
||||
M * M
|
||||
M / M
|
||||
M ^ M
|
||||
|
||||
Gives:
|
||||
|
||||
->{{17, 21, 23}, {27, 29, 33}, {39, 41, 47}}
|
||||
->{{-3, 1, 3}, {7, 9, 13}, {19, 21, 27}}
|
||||
->{{70, 110, 130}, {170, 190, 230}, {290, 310, 370}}
|
||||
->{{7/10, 11/10, 13/10}, {17/10, 19/10, 23/10}, {29/10, 31/10, 37/10}}
|
||||
->{{282475249, 25937424601, 137858491849}, {2015993900449,
|
||||
6131066257801, 41426511213649}, {420707233300201, 819628286980801,
|
||||
4808584372417849}}
|
||||
|
||||
->{{14, 22, 26}, {34, 38, 46}, {58, 62, 74}}
|
||||
->{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}
|
||||
->{{49, 121, 169}, {289, 361, 529}, {841, 961, 1369}}
|
||||
->{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}
|
||||
->{{823543, 285311670611, 302875106592253}, {827240261886336764177,
|
||||
1978419655660313589123979,
|
||||
20880467999847912034355032910567}, {2567686153161211134561828214731016126483469,
|
||||
17069174130723235958610643029059314756044734431,
|
||||
10555134955777783414078330085995832946127396083370199442517}}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
a: matrix([1, 2], [3, 4]);
|
||||
b: matrix([2, 4], [3, 1]);
|
||||
|
||||
a * b;
|
||||
a / b;
|
||||
a + b;
|
||||
a - b;
|
||||
a^3;
|
||||
a^b; /* won't work */
|
||||
fullmapl("^", a, b);
|
||||
sin(a);
|
||||
Loading…
Add table
Add a link
Reference in a new issue