Skip to content

Commit 4487362

Browse files
Andrew LuoAndrew Luo
authored andcommitted
Fix issue with non-smooth case
1 parent 4bceb9c commit 4487362

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

sage_acsv/asymptotics.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -796,8 +796,9 @@ def compute_asymptotic_contribution(
796796

797797
valid_set = Restriction(Rf)
798798
valid_set.setminus(
799-
[all_factors[j] for j in range(len(all_factors)) if j not in combo]
799+
[all_factors[j].subs(subs_dict) for j in range(len(all_factors)) if j not in combo]
800800
)
801+
print(valid_set)
801802

802803
# Determine whether it's possible for the critical point vanish in this
803804
# combination of factors
@@ -819,7 +820,10 @@ def compute_asymptotic_contribution(
819820
except:
820821
valid_set = None
821822

822-
# Step 2: Find the locally parametrizing coordinates of the point pt
823+
# Check conditions needed for point to be contributing
824+
# Might just need for point to be non-critical in upper dimensional component?
825+
826+
# Find the locally parametrizing coordinates of the point pt
823827
# Since we have d variables and s factors, there should be d-s of these
824828
# parametrizing coordinates
825829
# We will try to parametrize with the first d-s coordinates, shuffling
@@ -834,10 +838,7 @@ def compute_asymptotic_contribution(
834838
if Jac.determinant() != 0:
835839
break
836840

837-
try:
838-
valid_set = valid_set.setminus([Jac.determinant()])
839-
except:
840-
valid_set = None
841+
valid_set = valid_set.setminus([Jac.determinant()])
841842

842843
acsv_logger.info("Variables do not parametrize, shuffling")
843844
vs_r_cp = list(zip(vs, r, cp))
@@ -846,6 +847,9 @@ def compute_asymptotic_contribution(
846847
else:
847848
raise ACSVException("Cannot find parametrizing set.")
848849

850+
if valid_set.is_empty():
851+
continue
852+
849853
expansion, constant_squared, base, exponent, s = _compute_asm_quantity(
850854
G, H, vs, cp, r, subs_dict, unit,factors, multiplicities, 1
851855
)

sage_acsv/helpers.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def get_expansion_terms(
572572

573573
class Restriction():
574574
def __init__(self, base_ring):
575-
if len(base_ring.gens()) == 0:
575+
if base_ring == SR or len(base_ring.gens()) == 0:
576576
self.base_ring = SR
577577
self.base_field = SR
578578
self.inclusion = []
@@ -592,6 +592,7 @@ def intersection(self, eqns):
592592
Id = compute_radical(Ideal([self.base_ring.zero()] + [self.base_ring(f * prod(denoms)) for f in eqns]))
593593
self.inclusion += Id
594594
except:
595+
print(1)
595596
self.inclusion = eqns + [SR(f) for f in self.inclusion.gens()]
596597
self.exclusion = [SR(f) for f in self.exclusion.gens()]
597598
self.base_ring = SR
@@ -602,13 +603,16 @@ def intersection(self, eqns):
602603
return self
603604

604605
def setminus(self, eqns):
606+
if not eqns:
607+
return
605608
if self.base_ring != SR:
606609
try:
607610
eqns = [self.base_field(f) for f in eqns]
608611
denoms = [f.denominator() for f in eqns]
609-
Id = compute_radical(Ideal([self.base_ring.zero()] + [self.base_ring(f * prod(denoms)) for f in eqns]))
612+
Id = compute_radical(Ideal([self.base_ring(f * prod(denoms)) for f in eqns]))
610613
self.exclusion = self.exclusion.intersection(Id)
611614
except:
615+
print(2)
612616
self.inclusion = [SR(f) for f in self.inclusion.gens()]
613617
self.exclusion = eqns + [SR(f) for f in self.exclusion.gens()]
614618
self.base_ring = SR
@@ -643,7 +647,24 @@ def contains(self, other : Restriction):
643647
return True
644648

645649
def is_empty(self):
646-
return self.contains(Restriction(self.base_ring).intersection([1]))
650+
self.simplify()
651+
inclusion_gens = self.inclusion if self.base_field == SR else self.inclusion.gens()
652+
exclusion_gens = self.exclusion if self.base_field == SR else self.exclusion.gens()
653+
for val in inclusion_gens:
654+
try:
655+
val = QQbar(val)
656+
if val != 0:
657+
return True
658+
except:
659+
pass
660+
for val in exclusion_gens:
661+
try:
662+
val = QQbar(val)
663+
if val == 0:
664+
return True
665+
except:
666+
pass
667+
return False
647668

648669
def __str__(self):
649670
return f"Quasi-Affine variety defined by X - Y where X is \n {self.inclusion} and Y is \n {self.exclusion}"

0 commit comments

Comments
 (0)