Engineer and Mathematician programmer,
I have computed a cost function J(x1,..xn) and her gradient J\'(x1,..xn) defined over a volume using finite element analysis. s