Ask Your Question

Revision history [back]

When I ran this code, I got an error about global variable v not being defined. I changed the last function to

def calcMobiusEnergy(gamma):
    def f2(v):
        def f1(u):
            return mobiusEnergyIntegrand(gamma,u,v)
        return numerical_integral(f1,0,2*pi)[0]
    return numerical_integral(f2,0,2*pi)

which, I think, lets sage work a little faster. Then I got warnings (not errors) about division by zero. I changed mobiusEnergyIntegrand to:

def mobiusEnergyIntegrand(gamma,u,v):
    ed = euclideanDistance(gamma,u,v)
    gal = geodesicArcLength(gamma,u,v)
    if gal == 0:
        return 0
    else:
        return speed(gamma)(u)*speed(gamma)(v)*(ed)^(2) - 1/(gal^(2))

and now the code has been running, with no warnings or errors (or output), for a few minutes. How long does it take for you to get your error message?

UPDATE:

I got bored, so I quit the calculation added %cython to the top of the (notebook) cell containing definitions, to see what would happen. The calculation finished surprisingly fast, but only after printing 't' many many times (once for each call to f1, which I determined by inserting extra print statements). For the circle, the answer I get is (0.0,0.0) -- can this possibly be right?