#7191: Make Dirichlet characters work when base ring is CC
---------------------------------+--------------------------
Reporter: bober | Owner: bober
Type: defect | Status: needs_work
Priority: major | Milestone: sage-5.13
Component: number theory | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------------+--------------------------
Old description:
> 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:
> }}}
New description:
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:
}}}
Apply: [attachment:trac_7191_v2.patch]
--
Comment (by chapoton):
Here is a new version with minor changes.
apply trac_7191_v2.patch
--
Ticket URL: <http://trac.sagemath.org/ticket/7191#comment:11>
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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.