I have been having a problem where I can’t get the pymc.math.sum function to return non-zero answers. In the following code the numpy version works, but the pymc version prints Sum{axes=None}.0 (and generates -inf in a likelihood when ‘a’ is a variable).
import pymc as pm
import numpy as np
def combine(x,a,dx):
weights = np.ones_like(x)
weights[0] = 0.5; weights[-1] = 0.5
return pm.math.sum(a*3*x**2*weights*dx)
x = np.linspace(0,1.0,num=101)
y = 3.6*x**3
err_y = y*0.1
dx = x[1]-x[0]
weights = np.ones_like(x)
weights[0] = 0.5; weights[-1] = 0.5
print(dx,combine(x,0.145,dx),np.sum(3*0.145*x**2*dx*weights),0.145*x[-1]**3)