From Łukasz Graczykowski
(Difference between revisions)
|
|
Line 25: |
Line 25: |
| 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) | | 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:
| + | Example: |
| double function(double *x, double *params) | | double function(double *x, double *params) |
| { | | { |
Revision as of 12:20, 14 March 2022
Task
We have a probability distribution function given with the following formula:
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);
Wynik
Wykresy:
Output:
Wspolczynnik normujacy c=6