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

Nicer display from binomials:

fricas
--)set output tex off
--)set output algebra on
binomial(n,m) (1)
Type: Expression(Integer)
fricas
opbinom := operator(operator 'binomial)\$CombinatorialFunction(INT,EXPR INT) (2)
Type: BasicOperator?
fricas
setProperty(opbinom, '%specialDisp::Symbol,
((l:List EXPR INT):OutputForm +-> paren vconcat(first(l)::OutputForm,second(l)::OutputForm)) pretend None) (3)
Type: BasicOperator?
fricas
binomial(n,m) (4)
Type: Expression(Integer)

Tests from GouldBk?.pdf --rrogers, Fri, 07 Apr 2017 16:22:25 +0000 reply
http://www.dsi.unifi.it/~resp/GouldBK.pdf

fricas
binomial(5,2)-binomial(5,5-2) (5)
Type: NonNegativeInteger?
fricas
binomial(a,b)-binomial(a,a-b) (6)
Type: Expression(Integer)

Ah well no joy in Mudville I guess I need a special function of some sort, any comments?

simplification of binomials --Bill Page, Fri, 07 Apr 2017 21:38:48 +0000 reply
The simplifications provided by Combfunc apply only to specific integer values of the 2nd argument of a single kernel. What you want to do usually involves combinations of more than one kernel. For this you might expect something like simplify or expand to work but these commands are not aware of binomial. The next best thing might be to use some custom rules. E.g.
fricas
BS := rule
binomial(a,a-b) == binomial(a,b) (7)
Type: RewriteRule?(Integer,Integer,Expression(Integer))

then we have

fricas
Is(binomial(3,3-x),lhs BS) (8)
Type: List(Equation(Expression(Integer)))
fricas
BS( binomial(3,x)-binomial(3,3-x) ) (9)
Type: Expression(Integer)

This rule is already built-in

fricas
BN := rule
binomial(-n+k-1,k | even? k) == binomial(n,k)
binomial(-n+k-1,k | odd? k) == -binomial(n,k) (10)
Type: Ruleset(Integer,Integer,Expression(Integer))
fricas
binomial(-n+1,2) (11)
Type: Expression(Integer)
fricas
binomial(-n+2,3) (12)
Type: Expression(Integer)

Cross product. Note that because pattern matching is syntactic we need to take care about the lexical ordering of the variables.

fricas
BX := rule
binomial(k,n)*binomial(n,j) == binomial(k,j)*binomial(k-j,n-j)
binomial(k,j)*binomial(n,k) == binomial(n,j)*binomial(n-j,k-j) (13)
Type: Ruleset(Integer,Integer,Expression(Integer))

fricas
ex1 := binomial(x+y,y)*binomial(y,y-z) (14)
Type: Expression(Integer)
fricas
ex2 := BX ex1 (15)
Type: Expression(Integer)
fricas
eval(ex1-ex2,[x=3,y=5,z=7]) (16)
Type: Expression(Integer)

 Subject: (replying)   Be Bold !! ( 15 subscribers )