-
-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing behaviour with Dirichlet characters #6018
Comments
comment:1
David, I like your analysis of the situation a lot. I'm going to do what you suggest first. Regarding performance issues, I think if the user really is worried about that in some case, they can be explicit about the relevant spaces and zeta's. |
Attachment: trac_6018.patch.gz |
comment:3
This looks like a nice clean fix -- my only worry would be that a few subtle choices cause mayhem with some random modular symbols code. William, did you run doctests on the Also, one potentially silly comment: your fix assumes that the constructor for |
comment:4
I am running sage -testall on this patch at the moment. The key question, I think, is what we want to happen in the following situation:
This worked under the old approach, because the parent of the base-extended thing was the Dirichlet group of modulus 17 and I suggest a further modification which makes the constructor raise a more intelligent error message if the root of unity isn't specified and the base ring is one where we can't do factorisation. If the tests pass I will write such a patch, and give William's patch a positive review conditional on that. |
Attachment: trac_6018-2.patch.gz apply over previous patch |
comment:5
As promised, here is a second patch. This takes a compromise approach where base_extend tries to calculate a maximal order root of unity in the new base ring if it's an integral domain, but otherwise uses the base-extension. I've added a couple of doctests, including one to illustrate the perils of the If someone else can approve the new patch I think we're sorted. |
comment:6
This looks good -- I just have two questions:
|
comment:7
The docs state several times that you don't actually need to supply zeta_order, so nobody's going to use the option in the first place unless they've got a pretty good reason to do so. I'd rather not make the code still more complicated! (Would it actually cause that much harm to get rid of the zeta_order argument entirely?) If base_ring(zeta) raises an exception, the error message will say something like "Unable to coerce foo into bar", and it should be reasonably clear what the problem is. With these patches, the constructor will almost always be getting called without specifying zeta and zeta_order anyway. David |
comment:8
I'm a big fan of just removing the |
Attachment: trac_6018-3.patch.gz |
comment:9
Here's a third patch that kills zeta_order. All doctests in modular/ pass, I'm running a full test cycle now. |
comment:10
Two thumbs up! Apply all three. |
apply only this patch |
comment:11
Attachment: trac_6018_folded.patch.gz Hey, why, wait, what happens if you create a zeta such that zeta.multiplicative_order() doesn't work?!
Please revert getting rid of zeta_order and make that part of another ticket, keeping in mind that you can't exactly do that, since it is important. The above doctest should be put in that ticket since this problem wouldn't have happened if I had included the above test. |
comment:12
OK, so would you be happy with applying just the first two patches? David |
comment:13
On reflection, the issue is surprisingly subtle. Consider taking a Dirichlet group with values in the integers of a cyclotomic field K, and base_extending to: (1) the complex double field; (2) the residue field of a prime of K. In case (1), your example shows that we can't expect the constructor of the new group to calculate the order of a given zeta. But case (2) shows that the order of the base-extended zeta might not be the same as the order of the original zeta, and one can easily get nonsense if one assumes this. Case (1) is actually OK if we don't pass zeta as an argument at all, because we can factor polynomials in CDF. This is more or less what applying Craig's patch and mine will give: zeta_order is still available as an argument, but it's not used by the base extension code, which relies on the base ring supporting either polynomial factoring or |
comment:23
This is just a detail, but instead of
I would prefer
|
comment:24
Replying to @pjbruin:
I assume that this is the main motivation for making It is true that |
comment:25
Replying to @jdemeyer:
This is not really true; it also makes more sense conceptually if one does not have to make a choice of root of unity. I think the problems related to base extension do deserve to be solved and are at least as important as the speed-up.
It would be great if it could, but when making a speed improvement to |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:27
Replying to @jdemeyer:
I took the opportunity to make a more general improvement to the wording; the format is now
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Reviewer: Aly Deines |
comment:32
Looks good to me. |
Changed keywords from Dirichlet characters to Dirichlet characters, days71 |
comment:33
Doctests fail |
comment:35
Replying to @vbraun: From the failing doctest in |
Changed branch from u/pbruin/6018-DirichletGroup_zeta to |
Funny things happen if you have two Dirichlet groups with the same modulus and the same base ring, but different roots of unity. This can happen if you use base_extend:
Now G and H look pretty similar:
But they don't compare as equal and the generators of H don't live in G:
Here G only actually contains those characters which factor through its original base ring, namely QQ. This is probably going to be a bit mystifying for the end-user.
Similar phenomena can make it next to impossible to do arithmetic with characters obtained by base extension, which somehow are second-class citizens:
This is a particularly mystifying error for the uninitiated, since it's asserting that it can't find a common parent, but the string representations of the parents it already has are identical.
There are a couple of solutions:
Change base_extend for Dirichlet groups to pick a maximal order root of unity in the new base ring, rather than just base-extending the root of unity it already has. This is nice and transparent, but it could be slow in some cases, and it prevents us constructing Dirichlet characters with values in rings where the unit group isn't cyclic or we can't compute a generator (e.g. we'd lose the ability to base extend elements of
DirichletGroup(N, ZZ)
toDirichletGroup(N, Integers(15))
).Change the
_repr_
method for Dirichlet groups so it explicitly prints the root of unity involved. I don't like this idea much.Some combination of the above two, with a special class for Dirichlet groups over domains where a unique root of unity of maximal order dividing
euler_phi(N)
doesn't exist or can't be calculated. This might be fiddly to write and maintain.Make
zeta
optional (implemented in the current branch); see comment:18 for detailsDepends on #18540
Component: modular forms
Keywords: Dirichlet characters, days71
Author: David Loeffler, Peter Bruin
Branch/Commit:
3b51d5d
Reviewer: Aly Deines
Issue created by migration from https://trac.sagemath.org/ticket/6018
The text was updated successfully, but these errors were encountered: