Tengo cuatro independientes distribuidos de manera uniforme variables a,b,c,d, cada uno en [0,1]. Quiero calcular la distribución de (a−d)2+4bc. He calculado la distribución de u2=4bc f2(u2)=−14lnu24 (hence u2\en(0,4]), and of u1=(a−d)2 to be f1(u1)=1−√u1√u1. Now, the distribution of a sum u1+u2 is (u1,u2 are also independent) fu1+u2(x)=∫+∞−∞f1(x−y)f2(y)dy=−14∫401−√x−y√x−y⋅lny4dy, because y∈(0,4]. Here, it has to be x>y so the integral is equal to fu1+u2(x)=−14∫x01−√x−y√x−y⋅lny4dy. Now I insert it to Mathematica and get that fu1+u2(x)=14[−x+xlnx4−2√x(−2+lnx)].
I made four independent sets a,b,c,d consisting of 106 numbers each and drew a histogram of (a−d)2+4bc:
and drew a plot of fu1+u2(x):
Generally, the plot is similar to the histogram, but on the interval (0,5) most of it is negative (the root is at 2.27034). And the integral of the positive part is \aprox0.77.
Where's the mistake? Or where am I missing something?
EDIT: I scaled the histogram to show the PDF.
EDIT 2: I think I know where's the problem in my reasoning - in the integration limits. Because s\en(0,4] and x−y∈(0,1], I cannot simply ∫x0. The plot shows the region I have to integrate in:
This means I have ∫x0 for y∈(0,1] (that's why part of my f was correct), ∫xx−1 in y∈(1,4], and ∫4x−1 in y\en(4,5]. Por desgracia, Mathematica no computar las dos últimas integrales (bueno, calcular el segundo, hay una unidad imaginaria en la salida que estropea todo...).
EDIT 3: parece que Mathematica PUEDE calcular los últimos tres integrales con el siguiente código:
(1/4)*Integrate[((1-Sqrt[u1-u2])*Log[4/u2])/Sqrt[u1-u2],{u2,0,u1},
Assumptions ->0 <= u2 <= u1 && u1 > 0]
(1/4)*Integrate[((1-Sqrt[u1-u2])*Log[4/u2])/Sqrt[u1-u2],{u2,u1-1,u1},
Assumptions -> 1 <= u2 <= 3 && u1 > 0]
(1/4)*Integrate[((1-Sqrt[u1-u2])*Log[4/u2])/Sqrt[u1-u2],{u2,u1-1,4},
Assumptions -> 4 <= u2 <= 4 && u1 > 0]
el que da la respuesta correcta :)