#7191: is_primitive() for a Dirichlet character doesn't work when base ring is
CC
-----------------------------+----------------------------------------------
Reporter: bober | Owner: was
Type: defect | Status: new
Priority: major | Milestone: sage-4.1.3
Component: number theory | Keywords:
Work_issues: | Author:
Reviewer: | Merged:
-----------------------------+----------------------------------------------
See the following example:
{{{
sage: G = DirichletGroup(500, base_ring=CC)
sage: G[0].is_primitive()
False
sage: G[1].is_primitive()
---------------------------------------------------------------------------
KeyError Traceback (most recent call
last)
/home/bober/.sage/temp/bober/24617/_home_bober__sage_init_sage_0.py in
<module>()
/home/bober/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc
in __call__(self, *args, **kwds)
240 return cache[key]
241 else:
--> 242 cache[key] = self.f(self._instance, *args, **kwds)
243 return cache[key]
244
/home/bober/sage/local/lib/python2.6/site-
packages/sage/modular/dirichlet.pyc in is_primitive(self)
1161 True
1162 """
-> 1163 return (self.conductor() == self.modulus())
1164
1165 @cached_method
/home/bober/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc
in __call__(self, *args, **kwds)
240 return cache[key]
241 else:
--> 242 cache[key] = self.f(self._instance, *args, **kwds)
243 return cache[key]
244
/home/bober/sage/local/lib/python2.6/site-
packages/sage/modular/dirichlet.pyc in conductor(self)
624 F = arith.factor(self.modulus())
625 if len(F) > 1:
--> 626 return misc.mul([d.conductor() for d in
self.decomposition()])
627 p = F[0][0]
628 # When p is odd, and x =/= 1, the conductor is the
smallest p**r such that
/home/bober/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc
in __call__(self, *args, **kwds)
240 return cache[key]
241 else:
--> 242 cache[key] = self.f(self._instance, *args, **kwds)
243 return cache[key]
244
/home/bober/sage/local/lib/python2.6/site-
packages/sage/modular/dirichlet.pyc in conductor(self)
620 20
621 """
--> 622 if self.modulus() == 1 or self.is_trivial():
623 return 1
624 F = arith.factor(self.modulus())
/home/bober/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc
in __call__(self, *args, **kwds)
240 return cache[key]
241 else:
--> 242 cache[key] = self.f(self._instance, *args, **kwds)
243 return cache[key]
244
/home/bober/sage/local/lib/python2.6/site-
packages/sage/modular/dirichlet.pyc in is_trivial(self)
1177 True
1178 """
-> 1179 return (self.element() == 0)
1180
1181 def kernel(self):
/home/bober/sage/local/lib/python2.6/site-
packages/sage/modular/dirichlet.pyc in element(self)
1531 M = P._module
1532 dlog = P._zeta_dlog
-> 1533 v = M([dlog[x] for x in self.values_on_gens()])
1534 self.__element = v
1535 return v
KeyError: -1.00000000000000 - 2.63677968348475e-16*I
sage: G[3].is_primitive()
---------------------------------------------------------------------------
KeyError Traceback (most recent call
last)
/home/bober/.sage/temp/bober/24617/_home_bober__sage_init_sage_0.py in
<module>()
/home/bober/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc
in __call__(self, *args, **kwds)
240 return cache[key]
241 else:
--> 242 cache[key] = self.f(self._instance, *args, **kwds)
243 return cache[key]
244
/home/bober/sage/local/lib/python2.6/site-
packages/sage/modular/dirichlet.pyc in is_primitive(self)
1161 True
1162 """
-> 1163 return (self.conductor() == self.modulus())
1164
1165 @cached_method
/home/bober/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc
in __call__(self, *args, **kwds)
240 return cache[key]
241 else:
--> 242 cache[key] = self.f(self._instance, *args, **kwds)
243 return cache[key]
244
/home/bober/sage/local/lib/python2.6/site-
packages/sage/modular/dirichlet.pyc in conductor(self)
624 F = arith.factor(self.modulus())
625 if len(F) > 1:
--> 626 return misc.mul([d.conductor() for d in
self.decomposition()])
627 p = F[0][0]
628 # When p is odd, and x =/= 1, the conductor is the
smallest p**r such that
/home/bober/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc
in __call__(self, *args, **kwds)
240 return cache[key]
241 else:
--> 242 cache[key] = self.f(self._instance, *args, **kwds)
243 return cache[key]
244
/home/bober/sage/local/lib/python2.6/site-
packages/sage/modular/dirichlet.pyc in conductor(self)
620 20
621 """
--> 622 if self.modulus() == 1 or self.is_trivial():
623 return 1
624 F = arith.factor(self.modulus())
/home/bober/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.pyc
in __call__(self, *args, **kwds)
240 return cache[key]
241 else:
--> 242 cache[key] = self.f(self._instance, *args, **kwds)
243 return cache[key]
244
/home/bober/sage/local/lib/python2.6/site-
packages/sage/modular/dirichlet.pyc in is_trivial(self)
1177 True
1178 """
-> 1179 return (self.element() == 0)
1180
1181 def kernel(self):
/home/bober/sage/local/lib/python2.6/site-
packages/sage/modular/dirichlet.pyc in element(self)
1531 M = P._module
1532 dlog = P._zeta_dlog
-> 1533 v = M([dlog[x] for x in self.values_on_gens()])
1534 self.__element = v
1535 return v
KeyError: -1.00000000000000 - 2.63677968348475e-16*I
sage:
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7191>
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
-~----------~----~----~----~------~----~------~--~---