On Feb 8, 9:27 pm, John Cremona <[email protected]> wrote:
> In 3.4.2 I get this:
>
> sage: x = polygen(QQbar)
> sage: f = 3*x^4 - 4*x^3 - 1046148*x^2 - 335575956*x - 30288853512
> sage: rts = f.roots(multiplicities=False)
> sage: [r.sqrt() for r in rts]
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call last)
>
> /home/jec/sage-4.3.2/devel/sage-tests/<ipython console> in <module>()
>
> /home/jec/sage-current/local/lib/python2.6/site-packages/sage/rings/qqbar.p yc
> in sqrt(self)
>    2449             0.7071067811865475? + 0.7071067811865475?*I
>    2450         """
> -> 2451         return self.__pow__(~ZZ(2))
>    2452
>    2453     def nth_root(self, n):
>
> /home/jec/sage-current/local/lib/python2.6/site-packages/sage/rings/qqbar.p yc
> in __pow__(self, e)
>    2953                 isgn = self.imag().sign()
>    2954                 val = self._value
> -> 2955                 argument = val.argument()
>    2956                 if isgn == 0:
>    2957                     argument = argument.parent().pi()
>
> /home/jec/sage-current/local/lib/python2.6/site-packages/sage/structure/ele 
> ment.so
> in sage.structure.element.Element.__getattr__
> (sage/structure/element.c:2725)()
>
> /home/jec/sage-current/local/lib/python2.6/site-packages/sage/structure/par 
> ent.so
> in sage.structure.parent.getattr_from_other_class
> (sage/structure/parent.c:2832)()
>
> /home/jec/sage-current/local/lib/python2.6/site-packages/sage/structure/par 
> ent.so
> in sage.structure.parent.raise_attribute_error
> (sage/structure/parent.c:2599)()
>
> AttributeError: 'sage.rings.real_mpfi.RealIntervalFieldElement' object
> has no attribute 'argument'
> sage: [r.sqrt() for r in rts]
> [26.89930078070870?, 15.64182427553343?*I, 0.10896562034989? -
> 15.45309240093827?*I, 0.10896562034989? + 15.45309240093827?*I]
>
> So the first time I evaluate the line [r.sqrt() for r in rts] I get an
> error but the second time it works.  Any ideas?

you are using interval arithmetic, so output is noisy,
and while your equation has root
-734/3, first time Sage fails to get it right, and gives you
-244.6666666666667? + 0.?e-39*I
instead.
It can do sqrt(-734/3), but fails on
sqrt(-244.6666666666667? + 0.?e-39*I)
for some reason.

Dmitrii


>
> John

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to