Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello, @Nasser! Yes, indeed, it seems that the function you get with expr.operator() and gamma are different. I really don't know why. This is the first time I notice this. Actually, if you type:

type(expr.operator())
type(gamma)
type(gamma(t).operator())

you get three different results! In this case,

<class 'sage.functions.gamma.Function_gamma_inc'>
<class 'function'>
<class 'sage.functions.gamma.Function_gamma'>

So, my guess is they are the same function, but with different implementations and, consequently, different data types. This doesn't seem to be a bug, but an unfortunate consequence of the implementation itself. Maybe you should ask about these differences in a separate question in order to get an answer from somebody more experienced and Sage-savvy than me.

If it's all the same to you, you could solve this situation by using strings:

expr = gamma(-1, t)
str(expr.operator()) in ['erf', 'gamma']

That should return True.

Hello, @Nasser! Yes, indeed, it seems that the function you get with expr.operator() and gamma are different. I really don't know why. This is the first time I notice this. Actually, if you type:

type(expr.operator())
type(gamma)
type(gamma(t).operator())

you get three different results! In this case,

<class 'sage.functions.gamma.Function_gamma_inc'>
<class 'function'>
<class 'sage.functions.gamma.Function_gamma'>

So, my guess is they are the same function, but with different implementations and, consequently, different data types. This doesn't seem to be a bug, but an unfortunate consequence of the implementation itself. Maybe you should ask about these differences in a separate question in order to get an answer from somebody more experienced and Sage-savvy than me.

If it's all the same to you, you could solve this situation by using strings:

expr = gamma(-1, t)
str(expr.operator()) in ['erf', 'gamma']

That should return True.

Another, more elegant approach, is to use the name() function, but that also reduces to using strings:

expr = gamma(-1, t)
expr.operator().name() in ['erf', 'gamma']