May 1, 2025, Thursday, 120

KADD 2022 Laboratorium 3 EN

From Łukasz Graczykowski

(Difference between revisions)
Jump to: navigation, search
(Attention)
Line 19: Line 19:
* All quantities (constant c, cumulative distribution, marginal distributions) we calculate numerically, i.e. by using  <code>Integral</code> method.
* All quantities (constant c, cumulative distribution, marginal distributions) we calculate numerically, i.e. by using  <code>Integral</code> 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.
* 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.
-
* Należy oznaczyć i podpisać wszystkie osie.
+
* Please name correctly all axes.
-
* Funkcję rozkladu gestosci (obiekt TF2) tworzymy poprzez wykorzystanie konstruktora zawierającego wskaźnik na funkcję (odpowiednio zdefiniowanej dla wszystkich wartości x i y):  
+
* 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)
  double fcn(double *x, double *params)

Revision as of 12:20, 14 March 2022

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)

Przykład:

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);

Wynik

Wykresy: Zad03 KADD2012.png

Output:

Wspolczynnik normujacy c=6