Converting a multivariate function to a single variate function