up previous next

BinExp, EvalBinExp

Syntax

BinExp(N:INT,K:INT):TAGGED("$cocoa/binrepr.BinExp")
BinExp(N:INT,K:INT,Up:INT,Down:INT):INT
EvalBinExp(B:TAGGED("$cocoa/binrepr.BinExp"),Up:INT,Down:INT):INT

where N and K are positive integers, and Up and Down are integers.
    

Summary

binomial expansion

Description

The first function computes the K-binomial expansion of N, i.e., the unique expression
  N = Bin(N(K),K) + Bin(N(K-1),K-1) + ... + Bin(N(I),I)
where N(K) > ... > N(I) >= 1, for some I. The value returned is tagged for pretty printing.

The second function computes the sum of the binomial coefficients appearing in the K-binomial expansion of N after replacing each summand Bin(N(J),J) by Bin(N(J)+Up,J+Down). It is useful in generalizations of Macaulay's theorem characterizing Hilbert functions.

The third function computes the same integer as the second except it accepts BinExp(N,K) as an argument rather than N and K.

example

    
BE := BinExp(13,4);
BE;
Bin(5,4) + Bin(4,3) + Bin(3,2) + Bin(1,1)
-------------------------------
EvalBinExp(BE,1,1);
16
-------------------------------
BinExp(13,4,1,1);
16
-------------------------------
EvalBinExp(BE,0,0);  -- the integer value of BE
13
-------------------------------
        
    

See Also