Skip to content

Commit

Permalink
bug: fix n_positive_roots over number fields
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma committed May 28, 2024
1 parent 79412c8 commit b3c2264
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Misc/Poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ function _n_positive_roots_sqf(f::PolyRingElem{AbsSimpleNumFieldElem}, P::NumFie
end
g = Cx(coeffs)
try
rts = roots(g, initial_prec = prec)
rts = roots(g, initial_prec = div(prec, 2))
catch e
e isa ErrorException && startswith(e.msg, "unable to isolate all roots") || rethrow()
prec *= 2
Expand All @@ -537,7 +537,6 @@ function _n_positive_roots_sqf(f::PolyRingElem{AbsSimpleNumFieldElem}, P::NumFie
end
end


################################################################################
#
# Squarefree factorization for QQPolyRingElem
Expand Down
9 changes: 9 additions & 0 deletions test/AlgAss/Ramification.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,13 @@
A = StructureConstantAlgebra(K, K.(m))
@test is_split(A, real_places(K)[1])
@test is_split(A)

# another bug in positive root calculation
let
K, = rationals_as_number_field()
Ky, y = K["y"]
f = y^36 - 6144*y^35 - 41943040*y^34 + 331786223616*y^33 + 447501232504832*y^32 - 6843782583742889984*y^31 + 3157275540365850443776*y^30 + 68762083209159724603801600*y^29 - 97559633622127041169877630976*y^28 - 361970882121956800274885400068096*y^27 + 802780148957408543309960012219023360*y^26 + 977059812317683872145272580438950412288*y^25 - 3409117522231051343013324572504138912366592*y^24 - 900638526471366017613972779255698906278789120*y^23 + 8534080184547490570450694866685297882736304848896*y^22 - 2070188970340273835050361230537591360407130911801344*y^21 - 13175274896840567577610149576325406847631516973672693760*y^20 + 7761412759855105814997742215630143245049982509946673037312*y^19 + 12544181524621926439246237141237904991509788192096159086411776*y^18 - 11510050506966931427495529309581497732543225385436898025432678400*y^17 - 6889545043385424653826243622611199685423334812911473873716990967808*y^16 + 9859663121554864996620009426414028733184181500916257055984614767591424*y^15 + 1496188261764983914895632992432252168212416686885579109800462984677425152*y^14 - 5252212740019725417552692821649733983497628398260721799054047309937894227968*y^13 + 575336918926574382480431079259650304471405851900069812529642712221683437010944*y^12 + 1739436793076026240631276963304353127593557629734079955813277531545449707115380736*y^11 - 531718315906559105230796775298759951053386449014483460834265580882593162524752871424*y^10 - 333282254698712661046141586661468326428614701913953424890384635081001368453923007889408*y^9 + 174775242309231818566942702106607290184375760036011750997421259399050741056432215676682240*y^8 + 26792294715104435772836907854413679118731874211905513581670115827165181582556210540092325888*y^7 - 29786049304956939174938779967344029815434833719281736340864304685572101960464450151990182281216*y^6 + 1818926460276399992039510671660009222591365569819337124408027619161108985235076718378928652156928*y^5 + 2480948942222137060701817711715934781111041302717252192293488827485508211494213998851670463976833024*y^4 - 511816669599224790303165521145523399492641646829011710123630321899929001812653966034302083423394594816*y^3 - 58233363296622909474493499294779551231162782928100887907399716625058588650684184579902814825061785010176*y^2 + 27521983391880858139329850743625043289558779870019373484851066072643074513061817696840222637321508238655488*y - 2348542582773833227889480596789337027375682548908319870707290971532209025114608443463698998384768703031934976
P = real_embeddings(K)[1]
@test Hecke.n_positive_roots(f, P) == 21
end
end

0 comments on commit b3c2264

Please sign in to comment.