First time here? Check out the FAQ!

Ask Your Question
3

Functions returning unexpected results for symbolic expressions

asked 8 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 8 years ago

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.

Preview: (hide)
link

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 ( 8 years ago )

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: 8 years ago

Seen: 395 times

Last updated: May 21 '16