1 Jul 13:30 2008

### evaluate multivariate expressions

Hey, I'd like to use Sympy to compute gradients and Hessians of real valued functions. I got this far: #--------------------------------------------------------------------- #!/usr/bin/env python from numpy import * from sympy import * N = 3 x = [Symbol('x%d'%n) for n in range(N)] # define function f: R^N -> R f = 1 for n in range(N): f *= x[n] print 'function=',f # compute gradient g = array([ diff(f,x[n]) for n in range(N)]) print 'gradient=',g # compute Hessian H = array([[diff(g[m],x[n]) for m in range(N)] for n in range(N)]) print 'Hessian=\n',H(Continue reading)