#3354: Bug in power series sqrt
------------------------------------+--------------------------
Reporter: robertwb | Owner: somebody
Type: defect | Status: needs_info
Priority: major | Milestone: sage-7.0
Component: basic arithmetic | Resolution:
Keywords: power series | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
------------------------------------+--------------------------
Changes (by rws):
* milestone: sage-duplicate/invalid/wontfix => sage-7.0
Comment:
In the meantime the error changed to:
{{{
/home/ralf/sage/src/sage/rings/power_series_ring_element.pyx in
sage.rings.power_series_ring_element.PowerSeries.sqrt
(build/cythonized/sage/rings/power_series_ring_element.c:13321)()
1295 return a
1296 elif formal_sqrt:
-> 1297 raise ValueError, "unable to take the square root
of %s"%u[0]
1298 else:
1299 raise ValueError, "power series does not have a
square root since it has odd valuation."
ValueError: unable to take the square root of 3
}}}
There are also these keywords to consider. However `extend=True` returns
not a square root of the series but the square root of the extension ring,
and I am not sure what use it is, I think it's simply a bug:
{{{
- ``extend`` - bool (default: False); if True, return a square
root in an extension ring, if necessary. Otherwise, raise
a ValueError if the square root is not in the base power
series
ring. For example, if ``extend`` is True the square root of a
power series with odd degree leading coefficient is
defined as an element of a formal extension ring.
- ``name`` - string; if ``extend`` is True, you must also
specify the print
name of the formal square root.
sage: K.<t> = PowerSeriesRing(QQ, 5)
sage: f = 2 + t
sage: s = f.sqrt(extend=True, name='sqrt2'); s
sqrt2
sage: two = K(2)
sage: s = f.sqrt(extend=True, name='sqrt2'); s
sqrt2
sage: (s^2+t).sqrt(extend=True, name='sqrt2')
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call
last)
<ipython-input-12-648012550e8f> in <module>()
----> 1 (s**Integer(2)+t).sqrt(extend=True, name='sqrt2')
/home/ralf/sage/src/sage/structure/element.pyx in
sage.structure.element.CommutativeRingElement.sqrt
(build/cythonized/sage/structure/element.c:19922)()
2424 from sage.rings.integral_domain import is_IntegralDomain
2425 P=self._parent
-> 2426 is_sqr, sq_rt = self.is_square( root = True )
2427 if is_sqr:
2428 if all:
/home/ralf/sage/src/sage/structure/element.pyx in
sage.structure.element.CommutativeRingElement.is_square
(build/cythonized/sage/structure/element.c:19744)()
2328 framework.
2329 """
-> 2330 raise NotImplementedError("is_square() not implemented for
elements of %s" % self.parent())
2331
2332 def sqrt(self, extend=True, all=False, name=None):
NotImplementedError: is_square() not implemented for elements of
Univariate Quotient Polynomial Ring in sqrt2 over Power Series Ring in t
over Rational Field with modulus x^2 - 2
}}}
So effectively the original issue (giving a correct result for
`(2+t).sqrt()` regardless of whether automagically or by giving the
`extend` keyword) is not fixed.
--
Ticket URL: <http://trac.sagemath.org/ticket/3354#comment:10>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.