Re: TMatrix inverting/ binomial coefficients

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Aug 19 1999 - 19:26:02 MEST


Marco van Leeuwen wrote:
> 
> Hi all,
> 
> I'm writing a polynomial fitting routine, using the least squares
> approximation, but I'm encountering some difficulties with the
> matrix-inversion. It seems that the problem is sensitive for numerical
> roudoff's.
> Of course, using the fitting functionality of ROOT is still an alternative,
> but if anyone knows the answers to the following, please let me know.
> 
> 1) Is there an improved version TMatrix, in double precision??
> 

This is currently under discussion. Something will come.
I do not understand why you cannot use 
   TH1::Fit
or TGraph::Fit with polynomials.

You can may be look anyhow at the following static functions defined
in the implementation of the class TH1.

  extern void H1LeastSquareFit(Int_t n, Int_t m, Double_t *a);
  extern void H1LeastSquareLinearFit(Int_t ndata, Double_t &a0, Double_t
&a1,                                         Int_t &ifail);
  extern void H1LeastSquareSeqnd(Int_t n, Double_t *a, Int_t idim, Int_t
&ifail,                                     Int_t k, Double_t *b);



> 2) Does anyone know a standard routine for calculating the binomial
> coeefficients (i.e. n over k, the number of permutions of k things in a
> pool of n: n!/(k!*(n-k)!) )
> 
> 3) Or: is there already a straight-forward least-square fitting algorithm
> for polynomials?

Yes, this is the ABC of fitting. As I said above, polynomial fitting
is provided by TH1::Fit or TGraph::Fit using the predefined functions
pol0,
pol1, pol2, etc.

Polynimial fitting is also possible via the mouse on a TH1 or TGraph
object.
select the Fitpanel item in the context menu.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET