Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Random vectors

  1. Feb 4, 2016 #1
    Hi

    There are so many different kinds of probability distributions regarding a uniform distribution
    of points on the surface or inside a hypersphere in 2D and 3D and it's hard to see the big picture
    or any pattern between them. I'm confused and exhausted :)

    The overall fuzzy plan is to go from 2D polar coordinates (integrating by r*dr*dθ) to 3D suitable
    coordinates (integrating by whatever the equivalent might be).
    In both cases, I want to multiply the independent components PDF's, get the CDF and invert it
    to get the cartesian coordinates of a point that will be uniformly distributed inside the
    hypersphere. I guess normalization after this will give me a random vector?
    Then I want to show that independent standard normal distributed coordinates will also accomplish
    this after normalization, in a more unified way.

    Does that plan make sense from a mathematician point of view and have I got something wrong?

    Right now I'm stuck at the 2D case, I guess I want to multiply V_PDF(v) = 1/(2*pi) with some R_PDF(r).
    How do I get such an R_PDF(r)?
    I should end up with (x,y) = r*sqrt(u)*e^(i*2*pi*v) with u and v ~ U(0,1).

    /rabbed
     
  2. jcsd
  3. Feb 4, 2016 #2

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Your area between r and r+dr is proportional to r, so the right pdf should have the same property. That leads to r^2 plus normalization for the cumulative probability distribution. Compare this to the area where the radial coordinate is smaller than r...
    For low dimensions, suitable distributions for cartesian coordinates are so much easier.
     
  4. Feb 5, 2016 #3
    First lame attempt:

    R_PDF(r) = k
    V_PDF(v) = 1/(2*pi)

    RV_PDF(r,v) = R_PDF(r)*V_PDF(v) = k*r/(2*pi)

    RV_CDF(r,v) =
    P(R < r AND V < v) =
    integral wrt v from 0 to 2*pi of integral wrt r from 0 to x of RV_PDF(r,v) * r*dr*dv =
    integral wrt v from 0 to 2*pi of integral wrt r from 0 to x of k/(2*pi) * r*dr*dv =
    integral wrt v from 0 to 2*pi of dv * [k*r^2/(2*pi)] wrt r from 0 to x =
    integral wrt v from 0 to 2*pi of k*x^2/(2*pi) * dv =
    [v*k*x^2/(2*pi)] wrt v from 0 to 2*pi =
    k*x^2 = 1
    so k = 1/(x^2) ?

    Not sure what that means :)

    Also, do I have to do this in two steps where the second step gives the cartesian coordinate Y using Y_PDF(y) calculated below, and also include R_PDF(r) to get the CDF and then invert it?

    V_PDF(v) = 1/(2*pi)
    Y = r*sin(V)

    Y_CDF(y) =
    integral wrt v from pi-arcsin(y/r) to pi+arcsin(y/r) of V_PDF(v)*dv =
    integral wrt v from pi-arcsin(y/r) to pi+arcsin(y/r) of 1/(2*pi)*dv =
    [v/(2*pi)] wrt v from pi-arcsin(y/r) to pi+arcsin(y/r) =
    (pi+arcsin(y/r))/(2*pi) - (pi-arcsin(y/r))/(2*pi) =
    ( (pi+arcsin(y/r)) - (pi-arcsin(y/r)) )/(2*pi) =
    ( pi+arcsin(y/r) - pi + arcsin(y/r) )/(2*pi) =
    2*arcsin(y/r)/(2*pi) =
    arcsin(y/r)/pi

    Y_PDF(y) =
    d[arcsin(y/r)/pi]/dy =
    1/(pi*sqrt(r^2-y^2))
     
  5. Feb 6, 2016 #4

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    If x is your radius, that prefactor will give the right normalization.
    Looks like a reasonable result. I don't think it is helpful if you want to generate points, however, as X and Y are correlated then.

    A fast way if you have access to random numbers with uniform distribution: scale/shift the distribution so it goes from -r to r. Calculate a point (x,y), compare x^2+y^2 to r^2: if the point is in the circle, you are done, if it is outside, repeat the process. While it is not guaranteed to succeed, you have a pi/4 > 75% chance each time, so on average you just need ~2.6 random numbers and a few multiplications and additions.
     
  6. Feb 6, 2016 #5
    Ok, thanks..
    I spotted some errors and did some research and there is still something not adding up.
    So if we have a disc with radius K on which we randomize points by using the random variables R (radius) and V (angle):

    R_PDF(r) = c where (0 < r < K)
    V_PDF(v) = 1/(2*pi) where (0 < v < 2*pi)

    RV_PDF(r,v) = R_PDF(r)*V_PDF(v) = c/(2*pi)

    RV_CDF(r,v) =
    P(R < r AND V < v) =
    integral wrt v from 0 to 2*pi of integral wrt r from 0 to K of RV_PDF(r,v) * r*dr*dv =
    integral wrt v from 0 to 2*pi of integral wrt r from 0 to K of c/(2*pi) * r*dr*dv =
    integral wrt v from 0 to 2*pi of dv * [c*r^2/(4*pi)] wrt r from 0 to K =
    integral wrt v from 0 to 2*pi of c*K^2/(4*pi) * dv =
    [v*c*K^2/(4*pi)] wrt v from 0 to 2*pi =
    2*pi*c*K^2/(4*pi) =
    c*K^2/2 = 1

    so c = 2/(K^2) and we get:
    R_PDF(r) = 2/(K^2)

    but this should be proportional to r?

    am I using the area element r*dr*dv wrong in the integration?
     
  7. Feb 6, 2016 #6

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    You forgot the factor r in R_PDF(r). It has to be proportional to r.
    No, that is fine.
     
  8. Feb 6, 2016 #7
    But won't that give me the following?

    R_PDF(r) = c*r where (0 < r < K)
    V_PDF(v) = 1/(2*pi) where (0 < v < 2*pi)

    RV_PDF(r,v) = R_PDF(r)*V_PDF(v) = c*r/(2*pi)

    RV_CDF(r,v) =
    P(R < r AND V < v) =
    integral wrt v from 0 to 2*pi of integral wrt r from 0 to K of RV_PDF(r,v) * r*dr*dv =
    integral wrt v from 0 to 2*pi of integral wrt r from 0 to K of c*r/(2*pi) * r*dr*dv =
    integral wrt v from 0 to 2*pi of integral wrt r from 0 to K of c*r^2/(2*pi) * dr*dv =
    integral wrt v from 0 to 2*pi of dv * [c*r^3/(6*pi)] wrt r from 0 to K =
    integral wrt v from 0 to 2*pi of c*K^3/(6*pi) * dv =
    [v*c*K^3/(6*pi)] wrt v from 0 to 2*pi =
    2*pi*c*K^3/(6*pi) =
    c*K^3/3 = 1
    so c = 3/(K^3)

    R_PDF(r) = r*3/(K^3)
     
  9. Feb 6, 2016 #8

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Looks good.
     
  10. Feb 6, 2016 #9
  11. Feb 8, 2016 #10
    Can anyone explain this?

    I'm pretty sure R_PDF(r) = 2*r/(K^2)

    But how can it be derived?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Random vectors
Loading...