Skip to content

Commit

Permalink
Quick fix for case when polynomial is only the leading term
Browse files Browse the repository at this point in the history
Did not account for the fact that max({})=-infinity, which would occur when f=leadTerm(f), causing the bisection step to fail. When this happens, the root(s) of f would be 0, so M is set to 1.
  • Loading branch information
cel34-bath committed Feb 16, 2024
1 parent 15d28bb commit f834323
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion M2/Macaulay2/packages/RealRoots.m2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
newPackage(
"RealRoots",
Version=>"0.1",
--updates/corrections to realRootIsolation by Corin Lee ([email protected]) 16/02/2024
Date=>"Oct 9, 2020",
Authors=>{
{Name=>"Jordy Lopez Garcia",
Expand Down Expand Up @@ -398,7 +399,7 @@ realRootIsolation (RingElement,A) := List => (f,r)->(

--bound for real roots
C := (listForm ((f-leadTerm(f))/leadCoefficient(f)))/last; --make the polynomial monic, and obtain list of coefficients of non-lead monomials.
M := min(1+max(apply(C,abs)),max(1,sum(C,abs))); --obtains Cauchy or Lagrange bound.
M := min(1+max(0,max(apply(C,abs))),max(1,sum(C,abs))); --obtains Cauchy or Lagrange bound (setting M = 1 if the polynomial is only a single term)

L := {{-M,M}};
midp := 0;
Expand Down

0 comments on commit f834323

Please sign in to comment.