#8659: another broken square root simplification
-----------------------------------+----------------------------------------
Reporter: burcin | Owner: burcin
Type: defect | Status: needs_review
Priority: critical | Milestone: sage-5.0
Component: symbolics | Keywords:
Work_issues: | Upstream: N/A
Reviewer: Karl-Dieter Crisman | Author: Burcin Erocal
Merged: | Dependencies: #12511
-----------------------------------+----------------------------------------
Changes (by kcrisman):
* reviewer: => Karl-Dieter Crisman
Comment:
Okay, I now get all the branches, and it makes sense. Thanks for hanging
in there with me! Also, good catch and test on the powers less than -1.
I'm not putting 'needs work' :) but also not yet positive review. In
comment:7, we see the equivalent of this inconsistency:
{{{
sage: a= matrix([[2,2,I],[2,2,-I],[I,-I,0]]).determinant();
sage: a; type(a)
8
<type 'sage.symbolic.expression.Expression'>
sage: b = SR(8)
sage: type(b)
<type 'sage.symbolic.expression.Expression'>
sage: a.operands(); a.operator()
[]
sage: b.operands(); b.operator()
[]
sage: b^(-1/2)
1/4*sqrt(2)
sage: a^(-1/2)
1/8*sqrt(8)
sage: a^(1/2)
sqrt(8)
sage: b^(1/2)
2*sqrt(2)
}}}
I thought that maybe this was because (for reasons unclear to me) we had
entered
{{{
if not PY_TYPE_CHECK(self, Rational):
}}}
but
{{{
sage: isinstance(b,Rational)
False
sage: isinstance(a,Rational)
False
}}}
so I must be missing something obvious. Anyway, I can't see why these
should return different things, and we still have the switch to rational
that should take care of this:
{{{
res = QQ(base)**exp
}}}
Also, the documentation in rational.pyx still says
{{{
def __pow__(self, n, dummy):
"""
Raise self to the integer power n.
}}}
though I think this code has been used for non-integer powers for quite a
while.
But perhaps another reviewer will see what is going on in these cases, my
apologies if I'm wasting time.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8659#comment:16>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.