Created
May 24, 2016 11:12
-
-
Save stakemori/2848b3717a9993b6c2b2552089b609b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
from sage.rings.all import Integer, PolynomialRing, QuadraticField | |
from sage.matrix.all import matrix | |
from sage.misc.all import cached_function | |
from sage.modules.all import vector | |
def conj(x): | |
return x.map_coefficients(lambda c: c.conjugate()) | |
@cached_function | |
def _theta_term(a, b): | |
K = QuadraticField(-1, name='i') | |
i = K.gen() | |
R = PolynomialRing(K, names='s1, s2, t1, t2') | |
s1, s2, t1, t2 = R.gens() | |
S = PolynomialRing(R, names='z11, z12, z21, z22') | |
Z = matrix(2, S.gens()) | |
s = s1 + s2 * i | |
t = t1 + t2 * i | |
g = vector([s, t]) | |
a = vector(a) | |
b = vector(b) | |
v1 = (g + (1 + i) * a / Integer(2)) | |
c = (1 + i) * b * g / Integer(2) | |
return v1.apply_map(conj) * Z * v1 + c + conj(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment