Simulation - Composition method

This is a discussion on Simulation - Composition method within the Tech Board forums, part of the Community Boards category; Hi all, this question doesn't really have to do with C, but it is related to simulation, and without solving ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    8

    Simulation - Composition method

    Hi all, this question doesn't really have to do with C, but it is related to simulation, and without solving this first, I can't do the random variate generator.

    I'm supposed to generate random variates for p(x) ~ pi - x + x^2 + sin(x), for 0 <= x <= pi.

    I got the normalization factor as 6 / (12 + 3*pi^2 + 2*pi^3), which gives me my f(x) as

    f(x) = [6 / (12 + 3*pi^2 + 2*pi^3)] * (pi - x + x^2 + sin(x)).

    I then run into problems decomposing the f(x). I decomposed it into the following equation:

    f(x) = 6*pi / a - (3*pi^2 / a) * f_1(x) + (2*pi^3 / a) * f_2(x) + (12 / a) * f_3(x)
    where a = (12 + 3*pi^2 + 2*pi^3), f_1(x) = 2x/pi^2, f_2(x) = 3x^2 / pi^3, f_3(x) = sinx.

    I reasoned that f_1 is proportional to x, f_2 to x^2, and f_3 to sin(x). I then normalized f_1, f_2 and f_3, obtaining the respective individual distributions.

    However, I'm confused by the presence of the constant term 6*pi / a and the negative sign in front of f_1. What should I do with them?

    I'm really confused with the whole composition method, and I would greatly appreciate it if someone could point me to a website that gives a clear explanation of how to decompose the distributions.

    Thank you.

    Regards,
    Rayne

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,752
    > Hi all, this question doesn't really have to do with C
    Which is why it is now on the Tech board.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. on method pointers and inheritance
    By BrownB in forum C++ Programming
    Replies: 2
    Last Post: 03-02-2009, 07:50 PM
  2. fork, execv, spawn, or something else?
    By DavidP in forum C++ Programming
    Replies: 8
    Last Post: 01-26-2009, 04:25 PM
  3. Best communication method to thousand childs?
    By Ironic in forum C Programming
    Replies: 8
    Last Post: 11-08-2008, 12:30 AM
  4. C# method
    By siten0308 in forum C# Programming
    Replies: 6
    Last Post: 07-15-2008, 08:01 AM
  5. Simulation - M(RT)^2 method
    By wu_weidong in forum C Programming
    Replies: 4
    Last Post: 03-14-2005, 01:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21