Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
function table = timesTable(N)
|
||||
table = [(0:N); (1:N)' triu( kron((1:N),(1:N)') )];
|
||||
end
|
||||
17
Task/Multiplication-tables/MATLAB/multiplication-tables-2.m
Normal file
17
Task/Multiplication-tables/MATLAB/multiplication-tables-2.m
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
function table = timesTable(N)
|
||||
|
||||
%Generates a column vector with integers from 1 to N
|
||||
rowLabels = (1:N)';
|
||||
|
||||
%Generate a row vector with integers from 0 to N
|
||||
columnLabels = (0:N);
|
||||
|
||||
%Generate the multiplication table using the kronecker tensor product
|
||||
%of two vectors one a column vector and the other a row vector
|
||||
table = kron((1:N),(1:N)');
|
||||
|
||||
%Make it upper triangular and concatenate the rowLabels and
|
||||
%columnLabels to the table
|
||||
table = [columnLabels; rowLabels triu(table)];
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue