text: PyMinuit
  Minuit numerical function minimization in Python
  Minuit
  Minuit has been the standard package for minimizing general N-dimensional functions in high-energy physics since its introduction in 1972. It features a robust set of algorithms for optimizing the search, correcting mistakes, and measuring non-linear error bounds. It is the minimization engine used behind-the-scenes in most high-energy physics curve fitting applications.
  New: more robust installation instructions!
  Python interface.
  PyMinuit versus PyMinuit2
  There are two versions of Minuit, both of which are C++ re-writes of the original Fortran Minuit. The first of these, "SEAL-Minuit", is an independent software package that has all the functionality of the original Minuit, but is no longer maintained. The second, "Minuit2", is a part of the ROOT package and is actively being developed. There are correspondingly two versions of PyMinuit, which appeal to different users:
  - PyMinuit (this package): contains SEAL-Minuit 1.7.9 and the Python interface to it; installs in one step. Use this if you don't have ROOT (or don't know what it is) and you just want to find the minimum of functions.
  - PyMinuit2 (click the link): only contains an interface to Minuit2 and must be linked to an existing ROOT distribution. Use this if you want to use the algorithms contained in a specific ROOT version.
  PyMinuit and PyMinuit2 present the same interface to the Python user, so the documentation on this site applies to PyMinuit2. See Minuit2Features for extra features specific to PyMinuit2.
  Examples
  Here is an example interactive session. See Features for a complete list of features.
  >>> import minuit
  Provide any function or lambda expression
  >>> def f(x, y): ... return ((x-2) / 3)**2 + y**2 + y**4 ... >>> m = minuit.Minuit(f, x=10, y=10)
  Watch the minimization call-by-call
  >>> m.printMode = 1 >>> m.migrad() FCN Result | Parameter values -------------+-------------------------------------------------------- 10107.1 | 10 10 10107.1 | 10.0049 10 10107.1 | 9.99509 10 . . . 1.49272e-06 | 2.00231 0.000948002 1.16063e-06 | 2.00231 0.000752745 3.37671e-06 | 2.00378 0.00133852 >>> m.printMode = 0
  Access all the fit information
  >>> m.fval, m.ncalls, m.edm (3.376717443623469e-06, 72, 1.317141520434002e-06) >>> m.values["x"], m.values["y"] (2.0023781572817986, 0.00133852332346628303)
  Full parameter errors with correlations
  >>> m.hesse() >>> m.errors {'y': 0.99999733060860929, 'x': 2.9999999999998779} >>> m.covariance {('y', 'x'): 3.17636386e-16, ('x', 'y'): 3.17636386e-16, ('y', 'y'): 0.99999466122434422, ('x', 'x'): 8.9999999999992681} >>> m.matrix(correlation=True) ((1.0, 1.0587907808231194e-16), (1.0587907808231194e-16, 1.0))
  Non-linear error measurement
  >>> m.minos() >>> m.merrors {('y', 1.0): 0.78583633002473874, ('y', -1.0): -0.78583633325395974, ('x', -1.0): -3.0, ('x', 1.0): 3.0000000000000004}
  Contour lines and scans for plots
  >>> m.contour("x", "y", 1.) [(-1.0, 1.6093607605426052e-09), (-0.77000687450165384, -0.35921924433026176), (-0.38156620163194066, -0.53542692886885834), ...] >>> m.scan(("x", 5, 0, 10), ("y", 5, 0, 10), corners=True) [[5.9400792175e-07, 20.000000594007922, 272.00000059400793, 1332.0000005940078, 4160.0000005940083], [5.9400792175e-07, ...]]
  Versions and system requirements
  PyMinuit requires Python 2.4 or later, and has been tested on Linux and Windows. In principle, it should also compile and run on Mac OS X or any other Unix-based operating system.