Ask Your Question
1

test value of symbolic expression's operator

asked 2018-10-05 19:24:25 +0100

Wolan gravatar image

updated 2018-10-05 19:49:32 +0100

tmonteil gravatar image

I need to define a boolean function is_pow that takes for argument a symbolic expression expr an that return True if and only if expr.operator is the builtin function pow. But I don'n know which the syntax to use:

Of course

def is_pow(expr):
 return expr.operator() ==  <built-in function pow>

doesn't work. Has someone the answer ? Thanks a lot.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-10-05 19:51:38 +0100

tmonteil gravatar image

updated 2018-10-05 20:11:28 +0100

You can compare wth operator.pow:

sage: expr.operator() == operator.pow
True

Or even:

sage: expr.operator() is operator.pow
True
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2018-10-05 19:24:25 +0100

Seen: 256 times

Last updated: Oct 05 '18