Ask Your Question
3

Functions returning unexpected results for symbolic expressions

asked 2016-04-29 22:53:33 +0200

The functions min and max are evaluated using Python builtin functions, and need to be replaced by min_symbolic and max_symbolic to handle symbolic expressions. Sage overrides other Python functions, for example ceil and floor, and presumably all Sage defined functions behave as expected with symbolic expressions as arguments. abs in particular is an explicit alias of abs_symbolic.

What other commonly used functions fall back on Python builtin functions and produce unexpected results when handling symbolic expressions?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-05-21 23:35:34 +0200

I've found two common functions that do not handle symbolic expressions: int and round.

For example, one can produce valid output with either plot(ceil(x)) or plot(floor(x)), but not with plot(int(x)) or plot(round(x)).

If anyone else knows of other functions that create similar issues, please post additional answers.

edit flag offensive delete link more

Comments

Regarding int, it is not really a function, it just converts the input to the Python built-in type int (Python integers). It is therefore likely that long, float, complex, will behave the same. See https://docs.python.org/2.4/lib/typesnumeric.html

slelievre gravatar imageslelievre ( 2016-05-23 03:20:55 +0200 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-04-29 22:53:33 +0200

Seen: 307 times

Last updated: May 21 '16