Theano: implementing an integral function -
i trying implement function in theano. not solving integral (which immediate) rather how implement it. far have gotten this
import theano theano import tensor t import numpy np import scipy.integrate integrate x = t.vector('x') h = t.vector('h') t = t.scalar('t') = np.asarray([[0,1],[1,0]]) = theano.shared(name='a', value=a) b = np.asarray([[-1,0],[0,-1]]) b = theano.shared(name='b', value=b) xn = a.dot(x) hn = b.dot(h) res = (t + xn.dot(hn))**(-2) g = theano.function([t,x,h],res) # computes integrand f = theano.function([x,h], integrate.quad(lambda t: g(t,x,h), 10, np.inf))
unfortunately, doesn't work. getting error missing 2 required positional arguments: 'x' , 'h'
. maybe integrate.quad
function cannot "see" inputs x,h
.
thanks lot help!
Comments
Post a Comment