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

@ -1,2 +1,3 @@
---
from: http://rosettacode.org/wiki/Pascal_matrix_generation
note: Matrices

View file

@ -42,3 +42,4 @@ The output should distinguish between different matrices and the rows of each ma
The   [[Cholesky decomposition]]   of a Pascal symmetric matrix is the Pascal lower-triangle matrix of the same size.
<br><br>

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

View file

@ -1,6 +1,6 @@
import "/fmt" for Fmt
import "/math" for Int
import "/matrix" for Matrix
import "./fmt" for Fmt
import "./math" for Int
import "./matrix" for Matrix
var binomial = Fn.new { |n, k|
if (n == k) return 1