Re: MultiDimFit Print method.

From: Christian Holm Christensen <cholm_at_nbi.dk>
Date: Tue, 12 Jul 2005 09:22:46 +0200


Hi Marcos,

On Mon, 2005-07-11 at 20:48 +0200, Marcos Gimenez wrote:
> Hello all
>
> After making a succesfull fit using the MultiDimFit class, i printed the
> output function using fit->Print("m"); and i found that there were diferences
> in the powers shown between fit->Print("m") and fit->Print("c");
>
>
> Using Print("m") (bad results after testing the fit)
>
> Parameterization:
> -----------------
> Normalised variables:
> y_0 = 1 + 2 * (x_0 - 1) / (1 - -1)
> y_1 = 1 + 2 * (x_1 - 1) / (1 - -1)
>
> f(y_0, y_1) = 0.6374
> + 28.69 * y_0
> - 0.4414 * y_0^3
> + 0.005439 * y_0 * y_1^3
> + 14.73 * y_0^4
> + 19.87 * y_1^5
> + 0.5973 * y_0^3 * y_1^3
> - 0.1731 * y_0^5
> - 22.42 * y_0^6
> - 17.31 * y_1^7
> + 0.2964 * y_1
> - 3.186 * y_1^3
> - 0.2975 * y_1^4
>
>
>
> Using Print("c") (good results after testing the fit, same results when using
> fit->Eval(x) method)
>
> Coefficients:
> -------------
> # Value Error Powers
> ---------------------------------------
> 0 0.6374 0.3363 0 0
> 1 28.69 1.419 1 0
> 2 -0.4414 2.462 2 0
> 3 0.005439 0.8616 1 2
> 4 14.73 10.56 3 0
> 5 19.87 75.6 0 4
> 6 0.5973 1.171 2 2
> 7 -0.1731 2.452 4 0
> 8 -22.42 9.288 5 0
> 9 -17.31 65.37 0 6
> 10 0.2964 0.63 0 1
> 11 -3.186 10.77 0 2
> 12 -0.2975 0.7781 0 3
>
> If i look in the TMultiDimFit source and i search what it does when "m" option
> it is selected there is a part in the code after the switch(fPolyType) that i
> think it should be using p-1 instead of p, because TMultiDimFit stores
> power+1.
>
> Now
>
> for (Int_t j = 0; j < fNVariables; j++) {
> Int_t p = fPowers[fPowerIndex[i] * fNVariables + j];
> switch (p) {
> case 1: break;
> case 2: cout << " * y_" << j; break;
> default:
> switch(fPolyType) {
> case kLegendre: cout << " * L_" << p << "(y_" << j << ")"; break;
> case kChebyshev: cout << " * C_" << p << "(y_" << j << ")"; break;
> default: cout << " * y_" << j << "^" << p; break;
> }
> }
>
> }
>
> I think it should be
>
> for (Int_t j = 0; j < fNVariables; j++) {
> Int_t p = fPowers[fPowerIndex[i] * fNVariables + j];
> switch (p) {
> case 1: break;
> case 2: cout << " * y_" << j; break;
> default:
> switch(fPolyType) {
> case kLegendre: cout << " * L_" << p-1 << "(y_" << j << ")"; break;
> case kChebyshev: cout << " * C_" << p-1 << "(y_" << j << ")"; break;
> default: cout << " * y_" << j << "^" << p-1; break;
> }
> }
>
> }
>

You are right. TMultiDimFit stores the powers as `p+1', rather than `p', so you are right - the Print method, under option `m', one (1) should be subtracted from `p' to get the right result.

Rene, will you fix it? Thanks.

Yours,

-- 
 ___  |  Christian Holm Christensen 
  |_| |  -------------------------------------------------------------
    | |  Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
     _|           DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
    _|            Denmark                    Office: (+45) 353  25 404
 ____|   Email:   cholm_at_nbi.dk               Web:    www.nbi.dk/~cholm
 | |
Received on Tue Jul 12 2005 - 09:24:10 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:10 MET