Maximize a function with many parameters (python)
Don't do it yourself. Install SciPy and use its optimization routines. scipy.optimize.minimize
looks like a good fit.
I think you want to take a look at scipy.optimize (http://docs.scipy.org/doc/scipy-0.10.0/reference/tutorial/optimize.html). A maximization is the minimization of the -1*function.