Initial setup for period computation #13

Merged
julian merged 11 commits from period-calculations into master 2026-08-17 19:51:33 +02:00
Showing only changes of commit a4f47e31b5 - Show all commits
+25
View File
@@ -0,0 +1,25 @@
import logger
from sage.all import sage_eval, PolynomialRing, QQ
class PFOperator:
"""
A class representing a Picard-Fuchs operator in a single variable z.
"""
def _operator_from_string(self, operator_string):
z_names = ['z%d' % i for i in range(self.no_variables)]
theta_names = ['theta%d' % i for i in range(self.no_variables)]
self.ring = PolynomialRing(QQ, z_names + theta_names)
self.z_gens = self.ring.gens()[:self.no_variables]
self.theta_gens = self.ring.gens()[self.no_variables:]
try:
operator = sage_eval(operator_string, locals=self.ring.gens_dict())
except Exception as e:
raise ValueError("Invalid operator string: %s" % e)
return self.ring(operator)
def __init__(self, operator_string, no_variables=1):
self.no_variables = no_variables
self.operator = self._operator_from_string(operator_string)