login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for PascalTriangleNopile revision 1 of 1

1
Editor: test1
Time: 2014/02/19 18:44:42 GMT+0
Note:

changed:
-
\begin{spad}
)nopile
)abbrev package PASCALN PascalNopile
PascalNopile : with {
    make_pascal : Integer -> Matrix(Integer)
} == add {
make_pascal(N : Integer) : Matrix(Integer) == {
    nn := N::NonNegativeInteger;
    tab := zero(nn, nn)$Matrix(Integer);
    n : Integer;
    tab(1, 1) := 1;
    for n in 2..nn repeat {
        -- Fill row numer n
        k : Integer;
        tab(n, 1) := 1;
        tab(n, n) := 1;
        for k in 2..(n - 1) repeat {
            tab(n, k) := tab(n-1, k) + tab(n-1, k-1)
        }
    };
    tab
}
}
\end{spad}

Try it:
\begin{axiom}
make_pascal(5)
\end{axiom}

fricas
(1) -> <spad>
fricas
)nopile
fricas
)abbrev package PASCALN PascalNopile
PascalNopile : with {
    make_pascal : Integer -> Matrix(Integer)
} == add {
make_pascal(N : Integer) : Matrix(Integer) == {
    nn := N::NonNegativeInteger;
    tab := zero(nn, nn)$Matrix(Integer);
    n : Integer;
    tab(1, 1) := 1;
    for n in 2..nn repeat {
        -- Fill row numer n
        k : Integer;
        tab(n, 1) := 1;
        tab(n, n) := 1;
        for k in 2..(n - 1) repeat {
            tab(n, k) := tab(n-1, k) + tab(n-1, k-1)
        }
    };
    tab
}
}</spad>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3692351107100135223-25px001.spad
      using old system compiler.
   PASCALN abbreviates package PascalNopile 
------------------------------------------------------------------------
   initializing NRLIB PASCALN for PascalNopile 
   compiling into NRLIB PASCALN 
   compiling exported make_pascal : Integer -> Matrix Integer
Time: 0.07 SEC.
(time taken in buildFunctor: 0)
;;; *** |PascalNopile| REDEFINED
;;; *** |PascalNopile| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor PascalNopile Time: 0.07 seconds
finalizing NRLIB PASCALN Processing PascalNopile for Browser database: --->-->PascalNopile(constructor): Not documented!!!! --->-->PascalNopile((make_pascal ((Matrix (Integer)) (Integer)))): Not documented!!!! --->-->PascalNopile(): Missing Description ; compiling file "/var/aw/var/LatexWiki/PASCALN.NRLIB/PASCALN.lsp" (written 21 FEB 2023 12:45:48 PM):
; /var/aw/var/LatexWiki/PASCALN.NRLIB/PASCALN.fasl written ; compilation finished in 0:00:00.029 ------------------------------------------------------------------------ PascalNopile is now explicitly exposed in frame initial PascalNopile will be automatically loaded when needed from /var/aw/var/LatexWiki/PASCALN.NRLIB/PASCALN

Try it:

fricas
make_pascal(5)

\label{eq1}\left[ 
\begin{array}{ccccc}
1 & 0 & 0 & 0 & 0 
\
1 & 1 & 0 & 0 & 0 
\
1 & 2 & 1 & 0 & 0 
\
1 & 3 & 3 & 1 & 0 
\
1 & 4 & 6 & 4 & 1 
(1)
Type: Matrix(Integer)