sage: t, n = var('t n')
sage: expr = binomial((t+1)*(n+1), n+1)/binomial((t+1)*n, n)
sage: expr.simplify()
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (927, 0))
[traceback snipped]
/opt/sage-4.0.2-x86_64-Linux/local/lib/python2.5/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.operator (sage/symbolic/expression.cpp:15127)()
RuntimeError: cannot find SFunction in table
I get the same error with 4.1.rc1. This seems similar to #6421, but
perhaps the bigger issue is that it blows up at all. I'm not sure what
the exact issue is here.
Dan
--
--- Dan Drake <dr...@kaist.edu>
----- KAIST Department of Mathematical Sciences
------- http://mathsci.kaist.ac.kr/~drake
Some comments:
(1) in the new pynac based symbolics, everything is always
"automatically simplified" as much as it's going to be simplified by
pynac.
(2) The simplify command converts your expression to maxima and back.
Here's the source code:
return self._parent(self._maxima_())
In the long run this is a crazy thing to do, since more and more of
the symbolic expression Sage/pynac can represent will not have an
analogue in maxima.
(3) The command should probably be called "simplify_maxima()". And it
should probably have a try/except -- if things blow up it just returns
the original expression with no further simplification.
For the record, Maxima would not have done anything to simplify your
expression further.
sage: maxima(str(expr))
binomial((n+1)*(t+1),n+1)/binomial(n*(t+1),n)
Anyway, this is *definitely* a bug, and I hope the above 3 points will
start a little discussion, so we can decide what to do. My instinct
is to eliminate the simplify command completely, since I think it's
very misleading. Short of that, have it do nothing for now, but add a
new command "simplify_maxima()" that uses Maxima to try to simplify an
expression. Alternatively, have simplify(algorithm="maxima"), which
would do the same thing. We could also have
simplify(algorithm="sympy"), and even someday
simplify(algorithm="mathematica").
William
> Short of that, have it do nothing for now, but add a
> new command "simplify_maxima()" that uses Maxima to try to simplify an
> expression. Alternatively, have simplify(algorithm="maxima"), which
> would do the same thing. We could also have
> simplify(algorithm="sympy"), and even someday
> simplify(algorithm="mathematica").
I like the idea of identifying the algorithm. It fits with the approach
for integration.
---
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://www.linkedin.com/in/timlahey