Nicer display from binomials:
fricas
(1) -> --)set output tex off
--)set output algebra on
binomial(n,m)
Type: Expression(Integer)
fricas
opbinom := operator(operator 'binomial)$CombinatorialFunction(INT,EXPR INT)
fricas
setProperty(opbinom, '%specialDisp::Symbol,
((l:List EXPR INT):OutputForm +-> paren vconcat(first(l)::OutputForm,second(l)::OutputForm)) pretend None)
fricas
binomial(n,m)
Type: Expression(Integer)
http://www.dsi.unifi.it/~resp/GouldBK.pdf
fricas
binomial(5,2)-binomial(5,5-2)
Type: NonNegativeInteger
?
fricas
binomial(a,b)-binomial(a,a-b)
Type: Expression(Integer)
Ah well no joy in Mudville I guess I need a special function of some sort,
any comments?
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)
Type: RewriteRule
?(Integer,
Integer,
Expression(Integer))
then we have
fricas
Is(binomial(3,3-x),lhs BS)
Type: List(Equation(Expression(Integer)))
fricas
BS( binomial(3,x)-binomial(3,3-x) )
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)
Type: Ruleset(Integer,Integer,Expression(Integer))
fricas
binomial(-n+1,2)
Type: Expression(Integer)
fricas
binomial(-n+2,3)
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)
Type: Ruleset(Integer,Integer,Expression(Integer))
fricas
ex1 := binomial(x+y,y)*binomial(y,y-z)
Type: Expression(Integer)
fricas
ex2 := BX ex1
Type: Expression(Integer)
fricas
eval(ex1-ex2,[x=3,y=5,z=7])
Type: Expression(Integer)