working on propagate method and bug on sorted faces
This commit is contained in:
parent
f1707006b1
commit
13857b8aca
17
aplK.py
17
aplK.py
@ -782,7 +782,7 @@ class AlgebraAplK(UniqueRepresentation, Parent):
|
||||
apl.integrand(cochain[k])
|
||||
else:
|
||||
values[k] = apl(cochain[k])
|
||||
|
||||
|
||||
# second, we propagate the simplicial information
|
||||
simplicial_structure = {}
|
||||
for n in reversed(range(max_dim+1)):
|
||||
@ -792,9 +792,10 @@ class AlgebraAplK(UniqueRepresentation, Parent):
|
||||
simplicial_structure[k] = values[k] + \
|
||||
self._propagate(cochain, k)
|
||||
# print(simplicial_structure)
|
||||
|
||||
return AlgebraAplK.Element(self, simplicial_structure)
|
||||
|
||||
def _propagate(self, cochain, simplex):
|
||||
def _propagate(self, cochain, simplex):
|
||||
"""
|
||||
Returns the part of the polynomial assigned to 'simplex' related to the
|
||||
propagation of the simplicial information of its faces
|
||||
@ -807,11 +808,13 @@ class AlgebraAplK(UniqueRepresentation, Parent):
|
||||
apl = SimplicialAlgebraplN(n)
|
||||
# we propagate the polynomial (y_1...y_n)
|
||||
pol = apl(prod(apl.gens()[n+2:]))
|
||||
for f in faces:
|
||||
if f in cochain.keys():
|
||||
value = cochain[f]
|
||||
face_indexes = [simplex.index(i) for i in f]
|
||||
#print("dim: ",n," pol: ",pol," face_idx: ",face_indexes," dim: ", n)
|
||||
dict_set_keys = {c:set(c) for c in cochain.keys()}
|
||||
for f in faces: #CUIDADO AQUÍ CON CÓMO ESTÁN ORDENADOS LOS IDENTIFICADORES DE LOS SIMPLICES
|
||||
if set(f) in dict_set_keys.values():
|
||||
face = [k for k, v in dict_set_keys.items() if v == set(f)][0] # get_keys_from_value(dict, value)
|
||||
value = cochain[face]
|
||||
face_indexes = [simplex.index(i) for i in face]
|
||||
#print("dim: ",n," pol: ",pol," face_idx: ",face_indexes)
|
||||
propagation += value * \
|
||||
((-1) ** ((n * (n-1)) // 2)) * factorial(n) * \
|
||||
pol.propagate(face_indexes, dim)
|
||||
|
||||
80
test_aplK.py
80
test_aplK.py
@ -23,6 +23,8 @@ p012 = 2-t1+t2
|
||||
#values = {(0,): p0, (1,): p1, (2,): p2, (0,1): p01, (0,2): p02, (1,2): p12, (0,1,2): p012}
|
||||
e1 = A._element_constructor_(values)
|
||||
"""
|
||||
######################################################################
|
||||
"""
|
||||
S = SimplicialComplex([[0,1,2,3]],is_mutable=False)
|
||||
A = AlgebraAplK(S)
|
||||
s3 = SimplicialAlgebraplN(3)
|
||||
@ -55,7 +57,76 @@ values = {(0,): p0, (1,): p1, (2,): p2, (3,):p3,
|
||||
(0,1,2,3):p0123}
|
||||
e1 = A._element_constructor_(values)
|
||||
de1 = e1.differential()
|
||||
"""
|
||||
#####################################################################
|
||||
"""
|
||||
S = SimplicialComplex([[0,1,2],[0,2,3]],is_mutable=False)
|
||||
A = AlgebraAplK(S)
|
||||
s2 = SimplicialAlgebraplN(2)
|
||||
s2.inject_variables()
|
||||
p012 = t0*y2+t2*y0
|
||||
p023 = t0*y1+t1*y0
|
||||
s1 = SimplicialAlgebraplN(1)
|
||||
s1.inject_variables()
|
||||
p01 = p012.face(2)
|
||||
p02 = p012.face(1)
|
||||
p03 = p023.face(1)
|
||||
p12 = p012.face(0)
|
||||
p23 = p023.face(0)
|
||||
s0 = SimplicialAlgebraplN(0)
|
||||
s0.inject_variables()
|
||||
p0 = p01.face(1)
|
||||
p1 = p01.face(0)
|
||||
p2 = p12.face(0)
|
||||
p3 = p03.face(0)
|
||||
|
||||
values = {(0,): p0, (1,): p1, (2,): p2, (3,):p3,
|
||||
(0,1): p01, (0,2): p02, (0,3): p03, (1,2): p12, (2,3): p23,
|
||||
(0,1,2): p012, (0,2,3): p023}
|
||||
e1 = A._element_constructor_(values)
|
||||
de1 = e1.differential()
|
||||
"""
|
||||
#####################################################################
|
||||
S = SimplicialComplex([[0,1,2,3],[0,2,3,4]],is_mutable=False)
|
||||
A = AlgebraAplK(S)
|
||||
s3.inject_variables()
|
||||
p0123 = (t1**2)*y1+t3*y0+y2+t1*y2+t2*y1
|
||||
p0234 = (t1**2)*y1+t3*y0+y2+t1*y2+t2*y1
|
||||
s2 = SimplicialAlgebraplN(2)
|
||||
s2.inject_variables()
|
||||
p012 = p0123.face(3)
|
||||
p013 = p0123.face(2)
|
||||
p023 = p0123.face(1)
|
||||
p123 = p0123.face(0)
|
||||
p024 = p0234.face(2)
|
||||
p034 = p0234.face(1)
|
||||
p234 = p0234.face(0)
|
||||
s1 = SimplicialAlgebraplN(1)
|
||||
s1.inject_variables()
|
||||
p01 = p012.face(2)
|
||||
p02 = p012.face(1)
|
||||
p03 = p013.face(1)
|
||||
p04 = p024.face(1)
|
||||
p12 = p012.face(0)
|
||||
p13 = p013.face(0)
|
||||
p23 = p123.face(0)
|
||||
p24 = p024.face(2)
|
||||
p34 = p034.face(0)
|
||||
s0 = SimplicialAlgebraplN(0)
|
||||
s0.inject_variables()
|
||||
p0 = p01.face(1)
|
||||
p1 = p01.face(0)
|
||||
p2 = p12.face(0)
|
||||
p3 = p03.face(0)
|
||||
p4 = p04.face(0)
|
||||
|
||||
values = {(0,): p0, (1,): p1, (2,): p2, (3,):p3, (4,):p4,
|
||||
(0,1): p01, (0,2): p02, (0,3): p03, (0,4): p04, (1,2): p12, (1,3):p13, (2,3): p23,
|
||||
(0,1,2): p012, (0,2,3): p023}
|
||||
e1 = A._element_constructor_(values)
|
||||
de1 = e1.differential()
|
||||
|
||||
#####################################################################
|
||||
"""
|
||||
for k in de1.elements.keys():
|
||||
e = de1.elements[k]
|
||||
@ -63,13 +134,14 @@ for k in de1.elements.keys():
|
||||
if e:
|
||||
print(e.total_degree())
|
||||
"""
|
||||
e2 = de1.solve_primitive()
|
||||
e2 = e1.solve_primitive()
|
||||
print("de1: ",de1)
|
||||
print("e2: ",e2)
|
||||
print("e1: ",e1)
|
||||
|
||||
if e1.differential() == e2.differential():
|
||||
print("the differentials of e1 and e2 are equal")
|
||||
if e1 == e2.differential():
|
||||
print("the differential of e2 is EQUAL to e1")
|
||||
else:
|
||||
print("the differentials are different")
|
||||
print("the differential of e1 is NOT EQUAL to e1")
|
||||
|
||||
#############################################
|
||||
|
||||
@ -1,14 +1,23 @@
|
||||
from sage.all import *
|
||||
import itertools
|
||||
load('aplK.py')
|
||||
load('minimalModel.py')
|
||||
#######################################################
|
||||
# TESTS
|
||||
#S1 = simplicial_complexes.Sphere(3)
|
||||
def findsubsests(S,m):
|
||||
return set(itertools.combinations(S,m))
|
||||
|
||||
simplices = [list(e) for e in findsubsets([0,1,2,3],3)]
|
||||
simplices += [list(e) for e in findsubsets([0,1,2,4],3)]
|
||||
simplices += [list(e) for e in findsubsets([2,3,4,5],3)]
|
||||
S = SimplicialComplex(simplices,is_mutable=False)
|
||||
|
||||
#S1 = simplicial_complexes.Sphere(2)
|
||||
#S2 = simplicial_complexes.Sphere(3)
|
||||
#S = S1.wedge(S2, is_mutable=False)
|
||||
#S = simplicial_complexes.KleinBottle().suspension()
|
||||
#S.set_immutable()
|
||||
S = simplicial_complexes.K3Surface()
|
||||
#S = simplicial_complexes.K3Surface()
|
||||
#print("Complejo simplicial")
|
||||
#print(S.facets())
|
||||
#######################################################
|
||||
|
||||
Loading…
Reference in New Issue
Block a user