Hi Francois,

On Thu, 07 Oct 2010 22:39:38 +0200
Francois Maltey <fmal...@nerim.fr> wrote:

> Now I want to test an expression with the binomial function call.
> 
> y = binomial (3*x, x)    # is fine
> op = y.operator()          # is also fine
> op                                  # I get binomial
> op == binomial             # remains False

The top level binomial() function is the one defined in
sage.rings.arith. The symbolic binomial function is defined in
sage.functions.other:

sage: SR(2).binomial(x)
binomial(2, x)
sage: SR(2).binomial(x).operator().__module__
'sage.functions.other'
sage: binomial.__module__
'sage.rings.arith'


It looks like the top level binomial() function is a mess already.

 - binomial does not accept variable when only in the lower argument
        http://trac.sagemath.org/sage_trac/ticket/9634

 - binomial does not accept float
        http://trac.sagemath.org/sage_trac/ticket/9633

Looking at the code in sage/rings/arith.py, I see that the if statement
starting at line 2999 is a duplicate of that in at line 2961.

Replacing the top level binomial function with the symbolic one defined
in sage.functions.other should provide an easy fix for all these
problems. I wonder if it effects the speed too much.

> How can I do this test for binomial ?

As a workaround you can test if the operator is the function defined in
sage.functions.other.

sage: y = binomial(3*x, x)
sage: y.operator()
binomial
sage: y.operator() is sage.functions.other.binomial
True


Cheers,
Burcin

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to