Updates:
Status: Accepted
Cc: smichr
Labels: -NeedsReview
Comment #15 on issue 1263 by asmeurer: Invalid movement of roots across
fractions
http://code.google.com/p/sympy/issues/detail?id=1263
I bisected, and this is the bad commit (between 0.6.5 and 0.6.6):
3a1aa58edf443c2a0b9c401eadaa194e1eb87f94 is the first bad commit
commit 3a1aa58edf443c2a0b9c401eadaa194e1eb87f94
Author: Chris Smith <smi...@gmail.com>
Date: Fri Oct 16 05:17:37 2009 +0545
1584: as_numer_denom() changes esp for roots
1560 related minor changes, too.
== sympy\core\basic.py
A note about future possiblility for as_numer_denom was written.
== sympy\core\power.py
as_numer_denom()
This was totally re-written. If nothing is known about the
exponent's sign then we don't know which part will be the
numerator or denominator. If the exponent is an integer then
normal power rules apply. But if the exponent is a rational
then we have to watch out for the negative denominator. This
is
handled by moving the negative to the numerator and negating
the negative denominator (making it positive).
When given something like (n/d)**-e this is always 1/(n/d)**e
and whether this becomes d**e/n**e or not depends on d. Do
not
rearrange this as (d/n)**e and then make the decision based
on n.
== sympy\core\tests\test_basic.py
test as_numer_denom with oo and zoo
== sympy\core\tests\test_eval_power.py
as_numer_denom() for powers tested
One of the previous tests was incorrect:
sqrt(1/neg) =
sqrt(-1/-neg) =
sqrt(-1)/sqrt(-neg) =
I/sqrt(-neg) != 1/sqrt(neg) = -I/sqrt(-neg)
A series of new tests is added.
N.B. It is important on tests to make sure that you are
testing
what you think you are testing: there are two tests in the
suite where a power like expression is assembled as
(n/d)**pow
but because of standard rearrangement of (n/d)**pow e.g. for
sqrt((-1/(1+sqrt(3)))) which becomes I/(1 + 3**(1/2))**(1/2)
you end up with a Mul instead of a Pow.
== sympy\core\numbers.py
minor changes to _eval_power() to better use already computed
temp
variable and to eliminate a piece of dead code refering to a case
of "e < 0" which has already been handled in the code that
precedes
it.
Also, it looks like the problem is in cancel:
In [26]: z = Symbol('z', real=True, negative=True)
In [27]: print simplify(sqrt(1/z))
z**(-1/2)
In [28]: print cancel(sqrt(1/z))
z**(-1/2)
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.