Data update

This commit is contained in:
Ingy döt Net 2024-03-06 22:25:12 -08:00
parent ed705008a8
commit 0df55f9f24
2196 changed files with 32999 additions and 3075 deletions

View file

@ -0,0 +1,43 @@
clear all;close all;clc;
size = 5; % size of Pascal matrix
% Generate the symmetric Pascal matrix
symPascalMatrix = symPascal(size);
% Generate the upper triangular Pascal matrix
upperPascalMatrix = upperPascal(size);
% Generate the lower triangular Pascal matrix
lowerPascalMatrix = lowerPascal(size);
% Display the matrices
disp('Upper Pascal Matrix:');
disp(upperPascalMatrix);
disp('Lower Pascal Matrix:');
disp(lowerPascalMatrix);
disp('Symmetric Pascal Matrix:');
disp(symPascalMatrix);
function symPascal = symPascal(size)
% Generates a symmetric Pascal matrix of given size
row = ones(1, size);
symPascal = row;
for k = 2:size
row = cumsum(row);
symPascal = [symPascal; row];
end
end
function upperPascal = upperPascal(size)
% Generates an upper triangular Pascal matrix using Cholesky decomposition
upperPascal = chol(symPascal(size));
end
function lowerPascal = lowerPascal(size)
% Generates a lower triangular Pascal matrix using Cholesky decomposition
lowerPascal = chol(symPascal(size))';
end