Computation of the gradient and sensitivity coefficients in sum of squares minimization problems with differential equation models