Skip to content

Commit

Permalink
Fix the maps returned by compositums
Browse files Browse the repository at this point in the history
Since `numberField` renames elements,
the maps that `compositums` returns were sending
variables to zero when they shouldn't have been.
Fixed by composing with the Psi maps which are
stored in the cache.
  • Loading branch information
jjgarzella committed Aug 16, 2024
1 parent 306ecd2 commit efe85ed
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions NumberFields/NumberFields.m2
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,18 @@ asExtensionOfBase(NumberFieldExtension) := opts -> iota -> (

--loadPackage ("NumberFields", Reload=>true)

-- takes a number field and a map to the original ring used to create
-- the number field, and returns the map composed with the isomorphism
composedMap = method(Options => {})
composedMap(NumberField,Ring) := opts -> (nf,S) -> (

Psi := nf#cache#remakeField#0;
R := source(Psi);
G := map(R,S);
return Psi*G;

)

-- note: add basic case when degrees are relatively prime
compositums = method(Options => {})
compositums(NumberField,NumberField) := opts -> (K1,K2) -> (
Expand All @@ -1143,8 +1155,8 @@ compositums(NumberField,NumberField) := opts -> (K1,K2) -> (
-- sort by degree
sorted := sort(NFs, degree);
-- get maps from K1 & K2
K1maps := apply(sorted, nf -> map(nf,K1));
K2maps := apply(sorted, nf -> map(nf,K2));
K1maps := apply(sorted, nf -> composedMap(nf,K1));
K2maps := apply(sorted, nf -> composedMap(nf,K2));

degs := apply(sorted, degree);
-- a slight hack to package the data
Expand Down

0 comments on commit efe85ed

Please sign in to comment.