From Łukasz Graczykowski
(Difference between revisions)
|
|
(3 intermediate revisions not shown) |
Line 11: |
Line 11: |
| For parameters '''m=1''' and '''n=2''' please: | | For parameters '''m=1''' and '''n=2''' please: |
| * calculate c so that the distribution is normalized (1pkt) | | * calculate c so that the distribution is normalized (1pkt) |
- | * narysować gęstość prawdopodobieństwa f(x,y) (1pkt) | + | * draw probability distribution function f(x,y) (1pkt) |
- | * wyznaczyć i narysować dystrybuante F(x,y) (1pkt) | + | * draw cumulative distribution F(x,y) (1pkt) |
- | * wyznaczyć i narysować gęstość brzegową g(x) (1pkt) | + | * draw marginal distribution g(x) (1pkt) |
- | * wyznaczyć i narysować gęstość brzegową h(y) (1pkt) | + | * draw marginal distribution h(y) (1pkt) |
| | | |
- | == Uwagi == | + | == Attention == |
- | * Wszystkie wielkości (stałą c, dystrybuantę, gęstości brzegowe) wyznaczamy numerycznie np. wykorzystując metodę <code>Integral</code>. | + | * All quantities (constant c, cumulative distribution, marginal distributions) we calculate numerically, i.e. by using <code>Integral</code> method. |
- | * 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) |
| | | |
| 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) |
| { | | { |
Line 40: |
Line 40: |
| TF2 * fun1 = new TF2("fun1",function,xmin,xmax,ymin,ymax,nparams); | | TF2 * fun1 = new TF2("fun1",function,xmin,xmax,ymin,ymax,nparams); |
| | | |
- | == Wynik == | + | == Results == |
- | Wykresy:
| + | Plots: |
| [[File:Zad03_KADD2012.png]] | | [[File:Zad03_KADD2012.png]] |
| | | |
| Output: | | Output: |
- | Wspolczynnik normujacy c=6 | + | Normalization factor c=6 |
Latest revision as of 12:21, 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);
Results
Plots:
Output:
Normalization factor c=6