def length_rational_fraction(self, var='b'): r""" Return the generating series for the number of lengths with the given boundaries """ from sage.symbolic.ring import SR F = SR.one() for dart in range(self._total_darts): if not self._active_darts[dart]: continue i = self._dart_to_edge_index[dart] j1, j2 = self._edge_cycles[i] if j1 == dart: continue else: assert j2 == dart f1 = self._dart_to_face_index[j1] f2 = self._dart_to_face_index[j2] b1 = SR.var('%s%d' %(var, f1)) b2 = SR.var('%s%d' %(var, f2)) F *= b1*b2 / (1 - b1*b2) return F