Re: Tabulating

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Wed, 22 Nov 2006 15:05:37 +0100

Hi Andrey,

andreyk1_at_post.tau.ac.il wrote:
> Hi Rooters!
>
> I have to calculate some quantity involving a 9 dimensional
> integration. I used the option "IntegralMultiple" with N=9, well it
> works, but takes a lot of time to complete the calculation. Is there
> another possibility to perform this?
>

If you find a better one, let me know ::)
> Actually, my expression consists of three parts, two of them (a 4
> dimensional integration) can be calculated only one time and be
> expressed as a table. Hence, instead the 4d integration, I can refer
> to a table and interpolate the values. Is there in Root some
> function which can do this? Tabulating and interpolation.
>
>
>

You will find below a small script showing how to interpolate an array of N points X,Y

Rene Brun

void gint1() {

//example showing how to use a spline to interpolate a TGraph    Double_t x[] = {-0.22, 0.05, 0.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95};    Double_t y[] = {1,2.9,5.6,7.4,9,9.6,8.7,6.3,4.5,1};    TGraph *gr = new TGraph(10,x,y);

```   gr->SetMarkerColor(kBlue);
gr->SetMarkerStyle(21);
gr->Draw("ALP");

```

//create a cubic spline smoothing this graph    TSpline *spline = new TSpline3("spline3",gr);

//interpolate points randomly in the graph range    TRandom3 r;
TMarker m;

```   m.SetMarkerStyle(20);
m.SetMarkerSize(0.5);
m.SetMarkerColor(kRed);
for (Int_t i=0;i<200;i++) {
Double_t xr = r.Uniform(-0.3,1);
Double_t yr = gr->Eval(xr,spline);
m->DrawMarker(xr,yr);
```

}
}

> Thanks a lot!
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
Received on Wed Nov 22 2006 - 15:05:43 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:02 MET