May 19, 2024, Sunday, 139

KADD 2022 Laboratorium 3 EN

From Łukasz Graczykowski

Jump to: navigation, search

Contents


Task

We have a probability distribution function given with the following formula:

Wzor Lab03 Kadd2012.png

For parameters m=1 and n=2 please:

  • calculate c so that the distribution is normalized (1pkt)
  • draw probability distribution function f(x,y) (1pkt)
  • draw cumulative distribution F(x,y) (1pkt)
  • draw marginal distribution g(x) (1pkt)
  • draw marginal distribution h(y) (1pkt)

Attention

  • All quantities (constant c, cumulative distribution, marginal distributions) we calculate numerically, i.e. by using Integral method.
  • The script has to be written in a way Skrypt powienien być napisany w taki sposób aby wykonywał obliczenia dla dowolnego m i n.
  • Please name correctly all axes.
  • The probability function (TF2 object) we create by using a proper constructor which includes a pointer to the function (appropriately defined for all values x and y):
double fcn(double *x, double *params)
TF2(const char* name, void* fcn, Double_t xmin = 0, Double_t xmax = 1, Double_t ymin = 0, Double_t ymax = 1, Int_t npar = 0)

Example:

double function(double *x, double *params)
{
   if(x[0]>=0 && x[1]>=0)
     return params[0]*x[0]*x[1];
   return 0;
}
...
double xmin = 0;
double xmax = 10;
double ymin = 0;
double xmax = 10;
int nparams = 1;
TF2 * fun1 = new TF2("fun1",function,xmin,xmax,ymin,ymax,nparams);

Results

Plots: Zad03 KADD2012.png

Output:

Normalization factor c=6