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

Edit detail for SandBoxChoose revision 4 of 6

1 2 3 4 5 6
Editor: Bill page
Time: 2014/09/25 16:23:47 GMT+0
Note:

changed:
-\begin{axiom}
-choose(S,k) ==
-  j:=[i for i in 1..k]
-  R:=[[S(j(i)) for i in 1..k]]
-  n:=k
-  while n>0 and j(n)+k-n<#S repeat
-    j(n):=j(n)+1
-    for i in n..k-1 repeat j(i+1):=j(i)+1
-    R:=concat(R,[S(j(i)) for i in 1..k])
-    n:=k; while j(n)+k-n>=#S and n>1 repeat n:=n-1
-  if binomial(#S,k)~=#R then error "error in choose"
-  return R
-\end{axiom}
\begin{spad}
)abbrev package CHOO Choose
Choose(X:SetCategory): with
    choose:(List X,NonNegativeInteger) -> List List X
  == add
    choose(S,k) ==
      j:List NonNegativeInteger := [i for i in 1..k]
      R:List List X := [[S(j(i)) for i in 1..k]]
      n:Integer := k
      while n>0 and j(n)+k-n<#S repeat
        j(n):=j(n)+1
        for i in n..k-1 repeat j(i+1):=j(i)+1
        R:=concat(R,[S(j(i)) for i in 1..k])
        n:=k; while j(n)+k-n>=#S and n>1 repeat n:=n-1
      if binomial(#S,k)~=#R then error "error in choose"
      return R
\end{spad}


\label{eq1}
\left( {\begin{array}{<em>{20}c} 
S \ 
k \ 
\end{array}} \right) 
(1)

spad
)abbrev package CHOO Choose
Choose(X:SetCategory): with
    choose:(List X,NonNegativeInteger) -> List List X
  == add
    choose(S,k) ==
      j:List NonNegativeInteger := [i for i in 1..k]
      R:List List X := [[S(j(i)) for i in 1..k]]
      n:Integer := k
      while n>0 and j(n)+k-n<#S repeat
        j(n):=j(n)+1
        for i in n..k-1 repeat j(i+1):=j(i)+1
        R:=concat(R,[S(j(i)) for i in 1..k])
        n:=k; while j(n)+k-n>=#S and n>1 repeat n:=n-1
      if binomial(#S,k)~=#R then error "error in choose"
      return R
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/5705694974207640903-25px001.spad
      using old system compiler.
   CHOO abbreviates package Choose 
------------------------------------------------------------------------
   initializing NRLIB CHOO for Choose 
   compiling into NRLIB CHOO 
   compiling exported choose : (List X,NonNegativeInteger) -> List List X
Time: 0.05 SEC.
(time taken in buildFunctor: 0)
;;; *** |Choose| REDEFINED
;;; *** |Choose| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor Choose Time: 0.05 seconds
finalizing NRLIB CHOO Processing Choose for Browser database: --->-->Choose(constructor): Not documented!!!! --->-->Choose((choose ((List (List X)) (List X) (NonNegativeInteger)))): Not documented!!!! --->-->Choose(): Missing Description ; compiling file "/var/aw/var/LatexWiki/CHOO.NRLIB/CHOO.lsp" (written 25 SEP 2014 04:23:40 PM):
; /var/aw/var/LatexWiki/CHOO.NRLIB/CHOO.fasl written ; compilation finished in 0:00:00.030 ------------------------------------------------------------------------ Choose is now explicitly exposed in frame initial Choose will be automatically loaded when needed from /var/aw/var/LatexWiki/CHOO.NRLIB/CHOO


\label{eq2}
\left( {\begin{array}{<em>{20}c} 
\{r_1,r_2,r_4 \} \ 
2 \ 
\end{array}} \right) = \{ \{r_1,r_2 \} \{r_1,r_4 \} \{r_2,r_4 \} \}
(2)

fricas
choose([r[q] for q in 1..4|q~=3],2)

\label{eq3}\left[{\left[{r_{1}}, \:{r_{2}}\right]}, \:{\left[{r_{1}}, \:{r_{4}}\right]}, \:{\left[{r_{2}}, \:{r_{4}}\right]}\right](3)
Type: List(List(Symbol))


\label{eq4}
\left( {\begin{array}{<em>{20}c} 
\{r_1,r_2,r_4 \} \ 
2 \ 
\end{array}} \right)_2 = \{r_1,r_4 \}
(4)

fricas
choose([r[q] for q in 1..4|q~=3],2).2

\label{eq5}\left[{r_{1}}, \:{r_{4}}\right](5)
Type: List(Symbol)

fricas
choose([1],1)

\label{eq6}\left[{\left[ 1 \right]}\right](6)
Type: List(List(PositiveInteger?))
fricas
choose([1,2],1)

\label{eq7}\left[{\left[ 1 \right]}, \:{\left[ 2 \right]}\right](7)
Type: List(List(PositiveInteger?))
fricas
choose([1,2],2)

\label{eq8}\left[{\left[ 1, \: 2 \right]}\right](8)
Type: List(List(PositiveInteger?))
fricas
choose([1,2,3],1)

\label{eq9}\left[{\left[ 1 \right]}, \:{\left[ 2 \right]}, \:{\left[ 3 \right]}\right](9)
Type: List(List(PositiveInteger?))
fricas
choose([1,2,3],2)

\label{eq10}\left[{\left[ 1, \: 2 \right]}, \:{\left[ 1, \: 3 \right]}, \:{\left[ 2, \: 3 \right]}\right](10)
Type: List(List(PositiveInteger?))
fricas
choose([1,2,3],3)

\label{eq11}\left[{\left[ 1, \: 2, \: 3 \right]}\right](11)
Type: List(List(PositiveInteger?))
fricas
choose([x,y,z,w],1)

\label{eq12}\left[{\left[ x \right]}, \:{\left[ y \right]}, \:{\left[ z \right]}, \:{\left[ w \right]}\right](12)
Type: List(List(OrderedVariableList?([x,y,z,w])))
fricas
choose([x,y,z,w],2)

\label{eq13}\left[{\left[ x , \: y \right]}, \:{\left[ x , \: z \right]}, \:{\left[ x , \: w \right]}, \:{\left[ y , \: z \right]}, \:{\left[ y , \: w \right]}, \:{\left[ z , \: w \right]}\right](13)
Type: List(List(OrderedVariableList?([x,y,z,w])))
fricas
choose([x,y,z,w],3)

\label{eq14}\left[{\left[ x , \: y , \: z \right]}, \:{\left[ x , \: y , \: w \right]}, \:{\left[ x , \: z , \: w \right]}, \:{\left[ y , \: z , \: w \right]}\right](14)
Type: List(List(OrderedVariableList?([x,y,z,w])))
fricas
choose([x,y,z,w],4)

\label{eq15}\left[{\left[ x , \: y , \: z , \: w \right]}\right](15)
Type: List(List(OrderedVariableList?([x,y,z,w])))