### Math Libraries

### MathCore

#### `TMath`

- Add some new functions based on std::numeric_limits:
  - `double TMath::QuietNaN()` returning a quite NaN
  - `double TMath::SignalingNaN()` returning a signaling NaN
  - `double TMath::Infinity()` returning an infinity double value
- Added also (based on numeric_limits) templated functions on T (where T can be double, float or int) for computing the limits for a given type:
  - `T TMath::Limits< T >::Max()` returning the maximum number which can be represented for the type T ( `T TMath::Limits< double >::Max()=1.79769e+308`)
  - `T TMath::Limits< T >::Min()` returning the minimum number which can be represented for the type T ( `T TMath::Limits< double >::Max()=2.22507e-308`)
  - `T TMath::Limits< T >::Epsilon()` returning the epsilon (see Wikipedia for its definition) for the type T ( `T TMath::Limits< double >::Epsilon()=2.22045e-16`)

#### `TRandom1 and TRandom3`

- Add an implementation of `UInt_t GetSeed()` to return the first element of the seed table. Before always a fixed value was returned, independently of the random generator state

#### `ROOT::Fit::Fitter` and related classes

- Add new version of the Fitter class with various improvements:
  - add the possibility to just evaluate the objective function (FCN) one time (`Fitter::EvalFCN`) and fill the result (class `ROOT::Fit::FitResult` using the obtained value of FCN plus the parameter values and errors from the Fit configuration class (`ROOT::Fit::FitConfig`). This required adding a nw constructor of `FitResult` from `FitConfig`. This originated from the Savannah request.
  - Add also new methods `Fitter::SetFCN`.
  - Update the configuration (parameter values and errors) after a fit with the FitResult values So next fit will use improved parameter values and errors. This update can be switched on/off by using `FitConfig::SetUpdateAfterFit(on/off)`. By default is on.
  - Add new method `FitConfig::SetFromFitResult`.
  - Add possibility to run Hesse (`Fitter:::CalculateHessErrors`) without having done the minimization.
- Add support for weighted likelihood fits.
  - Add a new method `Fitter::ApplyWeightCorrection(fcn2)` which corrects covariance matrix for the weights using the likelihood function built using the weight square
  - Add the support for weights for the binned Poisson likelihood fits (in the `ROOT::Fit::PoissonLikelihoodFCN` class). A new option (WL) has been added also in `TH1::Fit` for performing weighted fits of histograms (see ).

#### `ROOT::Math::Minimizer`

- Add new methods `Minimizer::GetHessianMatrix(double * mat)` and `Minimizer::GetCovMatrix(double * mat)` to return the full matrices by filling the passed C arrays, which must have a dimension of at least n x n, where n is the total number of parameters. The elements for the fixed parameters will be filled with zeros. These methods are currently implemented by only Minuit and Minuit2.
- Change default tolerance in `ROOT::Math::MinimizerOptions` to be 0.01 from 0.0001.

#### MathMore

- New class `ROOT::Math::GSLMultiRootFinder` for finding the root of system of functions. The class is based on the GSL multi-root algorithm (see the GSL online manual) and it is used to solve a non-linear system of equations:

           f1(x1,....xn) = 0
           f2(x1,....xn) = 0
           ..................
           fn(x1,....xn) = 0

  The available GSL algorithms require the derivatives of the supplied functions or not (they are computed internally by GSL). In the first case the user needs to provide a list of multidimensional functions implementing the gradient interface (ROOT::Math::IMultiGradFunction) while in the second case it is enough to supply a list of functions implementing the ROOT::Math::IMultiGenFunction interface. The available algorithms requiring derivatives (see also the GSL documentation ) are the followings:
  - `ROOT::Math::GSLMultiRootFinder::kHybridSJ` with name "HybridSJ": modified Powell's hybrid method as implemented in HYBRJ in MINPACK
  - `ROOT::Math::GSLMultiRootFinder::kHybridJ` with name "HybridJ": unscaled version of the previous algorithm
  - `ROOT::Math::GSLMultiRootFinder::kNewton` with name "Newton": Newton method
  - `ROOT::Math::GSLMultiRootFinder::kGNewton` with name "GNewton": modified Newton method
  The algorithms without derivatives (see also the GSL documentation ) are the followings:
  - `ROOT::Math::GSLMultiRootFinder::kHybridS` with name "HybridS": same as HybridSJ but using finate difference approximation for the derivatives
  - `ROOT::Math::GSLMultiRootFinder::kHybrid` with name "Hybrid": unscaled version of the previous algorithm
  - `ROOT::Math::GSLMultiRootFinder::kDNewton` with name "DNewton": discrete Newton algorithm
  - `ROOT::Math::GSLMultiRootFinder::kBroyden` with name "Broyden": Broyden algorithm

#### Minuit2

- Improve Printing of information and Error messages. Use the class `ROOT::Minuit2::MnPrint` to store a static print level, which can be set by using the static function `MnPrint::SetLevel(int )`.
- Add new information messages in the `VariableMetricBuilder` (i.e. Migrad), to print some messages during the minimization.The new printing level is now also controlled by the `Minuit2Minimizer` class.
- Print now in the messages the parameter names instead of the parameter indices.
- fix the update of the number of function calls in Minuit2 after calling Hess after Migrad. The number is now not reset in `MnHesse`
- Fix a problem, when, after calling Hesse ,the edm was correct to values below the required tolerance. Now do not flag these cases as failed minimizations but as good ones.
- Correct tolerance by 2E-3 instead 2E-4 to ve conistent with what is done in F77 Minuit or TMinuit
- Avoid when using the `CombinedMinimumBuilder` (i.e. the Minimize algorithm) to call two times `ModularFunctionMinimize::Minimum`. Since this last function correct the tolerance by the Up value, a double correction was applied in this case.
- Implement the methods `Minuit2Minimizer::GetHessianMatrix(double * mat)` and `Minuit2Minimizer::GetCovMatrix(double * mat)`.
- For retrieving the Hessian, a new method has been added, `MnUserParameterState::Hessian`, which returns the Hessian by inverting the covariance matrix, since the Hessian is not stored inside the Minuit2 classes.
- Fix a bug in `MnUserTransformation` when using unnamed parameters (bug 82552).
- Add the possibility when using Minos to pass the tolerance for the Migrad calls. (use a default of 0.1 * Up, which is the same value used in F77).

#### Minuit

- Implement the methods `TMinuitMinimizer::GetHessianMatrix(double * mat)` and `TMinuitMinimizer::GetCovMatrix(double * mat)`.