Pascal matrix generation: Difference between revisions

Content added Content deleted
imported>Maxima enthusiast
No edit summary
mNo edit summary
Line 1: Line 1:
{{task}}
{{task|Matrices}}


A pascal matrix is a two-dimensional square matrix holding numbers from &nbsp; [[Pascal's triangle]], &nbsp; also known as &nbsp; [[Evaluate binomial coefficients|binomial coefficients]] &nbsp; and which can be shown as &nbsp; <big><sup>n</sup>C<sub>r</sub>.</big>
A pascal matrix is a two-dimensional square matrix holding numbers from &nbsp; [[Pascal's triangle]], &nbsp; also known as &nbsp; [[Evaluate binomial coefficients|binomial coefficients]] &nbsp; and which can be shown as &nbsp; <big><sup>n</sup>C<sub>r</sub>.</big>
Line 44: Line 44:
The &nbsp; [[Cholesky decomposition]] &nbsp; of a Pascal symmetric matrix is the Pascal lower-triangle matrix of the same size.
The &nbsp; [[Cholesky decomposition]] &nbsp; of a Pascal symmetric matrix is the Pascal lower-triangle matrix of the same size.
<br><br>
<br><br>



=={{header|11l}}==
=={{header|11l}}==
{{trans|Python}}
{{trans|Python}}

<syntaxhighlight lang="11l">F pascal_upp(n)
<syntaxhighlight lang="11l">F pascal_upp(n)
V s = [[0] * n] * n
V s = [[0] * n] * n
Line 1,261: Line 1,261:


=={{header|BQN}}==
=={{header|BQN}}==

<code>C</code> is the combinations function, taken from BQNcrate. The rest of the problem is simple with table (<code>⌜</code>).
<code>C</code> is the combinations function, taken from BQNcrate. The rest of the problem is simple with table (<code>⌜</code>).
<syntaxhighlight lang="bqn">C←(-÷○(×´)1⊸+)⟜↕
<syntaxhighlight lang="bqn">C←(-÷○(×´)1⊸+)⟜↕
Line 1,821: Line 1,820:
=={{header|Delphi}}==
=={{header|Delphi}}==
See [https://rosettacode.org/wiki/Pascal_matrix_generation Pascal].
See [https://rosettacode.org/wiki/Pascal_matrix_generation Pascal].

=={{header|Elixir}}==
=={{header|Elixir}}==
<syntaxhighlight lang="elixir">defmodule Pascal do
<syntaxhighlight lang="elixir">defmodule Pascal do
Line 2,722: Line 2,722:


=={{header|J}}==
=={{header|J}}==

<syntaxhighlight lang="j"> !/~ i. 5
<syntaxhighlight lang="j"> !/~ i. 5
1 1 1 1 1
1 1 1 1 1
Line 4,616: Line 4,615:


=={{header|Racket}}==
=={{header|Racket}}==

<syntaxhighlight lang="racket">#lang racket
<syntaxhighlight lang="racket">#lang racket
(require math/number-theory)
(require math/number-theory)
Line 5,244: Line 5,242:


=={{header|Stata}}==
=={{header|Stata}}==

Here are variants for the lower matrix.
Here are variants for the lower matrix.