The Quantum Pyramid

Discussion in 'C Programming' started by virtualadepts@gmail.com, Oct 28, 2006.

  1. Guest

    I spent quite a bit of work trying to get this to format on google
    groups, so let me know if it needs explination. Basicly the tree sorts
    randomly, and can start from any number on the pyramid. It has a 50/50
    chance of moving down either tree. If it continues to the next number
    down the tree it advances. Otherwise it reatreats back up the tree on
    the adjacanet path. When it reaches 0 or 1, it can switch back over,
    and start moving in the opposite direction

    /\
    / \
    / \
    1 0
    / |\ / | \
    2 | \/ | -1
    / |\| |/ | \
    3 | | -2
    / |\| |/| \
    4 | | -3
    / |\| |/| \
    5 | | -4
    / |\| |/| \
    6 | | -5
    / |\| |/| \
    7 | | -6
    \ | | /
    \ | | /
    \| |/
    ^ ^



    Here is how the pyramid looks if you have a universal font installed in
    your usenet or e-mail client.


    /\
    / v
    1 0
    /|^ /|\
    2 | \/ |-1
    /|\| |/|\
    3 | ^ ^ |-2
    /|\| |/|\
    4 | ^ ^ |-3
    /|\| |/|\
    5 | ^ ^ |-4
    /|\| |/|\
    6 | ^ ^ |-5
    /|\| |/|\
    7 | ^ ^ |-6
    \| |/
    ^ ^


    In quantum physics everything functions on random reactions, and we see
    this in traditional physics too, within chaotic systems. But when
    looking at the quantum pyramid there are two different ways you can see
    it. You can let a particle fall through the pyramid completely at
    random, or you can stop and *observe* the particle falling through the
    pyramid at any given point.


    If we just let the particle randomly start at either 1 or 0, it could
    wind up at -6 or 7 next we look. But if we have a particular goal in
    mind and we decide to observe the particle and allow it to start at 1.
    Then the expectation the particle will get to 7, instead of ending at
    -6 are incredibly higher. And if we decide to observe the ball at 2 or
    3 instead of one of the other numbers, then the odds increase even
    more.


    What I am trying to say is that because we are observing the pyramid,
    and by that I mean we are looking at our particle at a given spot on
    the pyramid. We can actually control where the particle will be in the
    future. Otherwise, when we aren't observing the particle, its future
    is entirely random, and it could be literally anywhere on the pyramid.

    But once we observe the pyramid, we know where the particle will be in
    the future, even though it is moving in a completely random pattern.
    8)

    And by observe I mean we actually create, literally. Because we can
    start the particle off at a point in the pyramid ourselves, and let it
    operate within the random chaos sphere.

    Now here is the math:

    To calculate the average number of moves before you advance n steps
    forward. The equation k( n-k ) will
    works according to martingale probability theory. k is equal to the
    absolute value of the number you start at, and n is equal to your final
    goal. So if we start at 4, and only try to advance to 6, the average
    number of moves it will take before we get there is 4(6-4), which
    equals 8 moves.

    To show the final proof of the quantum pyramid you only have to move
    from the probability of winning the first game, and multiply it by the
    probabilities of winning the following games. For example, if we are at
    3 and only try to advance one step, the odds are 3/4 that you will
    advance one step before moving to 0. And once that step is reached
    there is now a 4/5th chance of advancing another step forward.

    You calculate this easily by counting all the possible ways you can
    advance, to get the numerator, and adding 1 to the numerator to get the
    denominator. Because there is only one way you can lose.

    To count all the possible ways you can win, just count how many smaller
    pyramids there are along the path, and add those to the direct route.


    Here is the source code that proves the quantum pyramid's results:

    #include <stdio.h>
    #include <stdlib.h>


    main ()
    {
    double r;
    long int M;
    double x;
    int y;
    int z;
    int count;


    int seed = 10000;
    printf("Enter seend for RNG: ");
    scanf("%d", &seed);
    srand (seed);
    M = 2;


    int score = 0;
    //Score keeps track of the number of beans won every game


    int games = 0;
    // games keeps track of the number of games we have played before
    //losing all of the beans, which is equal to score.


    int beans1 = 0;
    // Initial value set to zero and defined within the loop

    int wins = 0;
    int lost = 0;
    int quit = 0;
    int init = 0;
    int rounds = 0;
    int live = 0;
    printf ("Initial Beans: ");
    scanf ("%d", &init);
    printf ("Stop after winning X number of beans: ");

    scanf ("%d", &quit);
    printf ("Number of rounds in this trial: ");
    scanf("%d", &rounds);
    printf("Show live output (1 or 0): ");
    scanf("%d", &live);
    for (int cnt = 0; cnt < rounds; cnt++)
    {
    // We play up to rounds


    int count = 0;
    beans1 = init + score;
    // Beans gets defined here, as starting with 3 beans, and having a 0
    //bonus score (It changes as you win more beans per round)


    int beans2 = 1;
    // The program attempts to win just one bean for every game.


    while (beans1 != 0 && beans2 != 0)
    // The battle begins


    {
    r = ((double) rand () / ((double) (RAND_MAX) + (double) (1)));


    x = (r * M);
    y = (int) x;


    z = y + 1;
    // A coin is flipped and is either 1 or 2 in value


    if (z == 1)
    {
    // Heads wins.


    beans1 = beans1++;
    // Beans1 gains one bean from Beans2


    beans2 = beans2--;
    }
    if (z == 2)
    {
    // Tails loses


    beans1 = beans1--;
    // Beans2 gains one bean from Beans1


    beans2 = beans2++;
    }
    count++;
    // We keep track of the number of rounds in the battle


    }


    if (beans1 > score + init)
    {
    // If beans1 is greater than the initial value of beans plus the total
    //number of beans that have been won so far in this game, then the
    score
    //goes up, and we go on to the next game. We check this at the end of
    //every game.


    score++;
    games++;
    }
    if (beans1 <= 0)
    {
    //If beans1 has lost the game and doesn't have anymore beans then we
    //know the game is over, so we reset score, and reset games.

    if(live==1){
    printf ("Lost at: %d beans , %d games.\n", score + init, games);
    }

    // And we print out the total number of games played on this trial and
    //show the total score plus the initial value of beans.

    lost++;
    score = 0;
    games = 0;
    }
    if (score >= quit)
    {
    wins++;

    if(live==1){
    printf ("Won at: %d beans , %d games.\n", score + init, games);
    }

    beans1 == 0;
    score = 0;
    games = 0;
    }
    }
    printf ("Total Won: %d/%d\n", wins, wins + lost);
    printf ("Net win: %d beans.\n",(wins*quit)-( (lost)*init ) );
    }
     
    , Oct 28, 2006
    #1
    1. Advertising

  2. On 28 Oct 2006 09:49:11 -0700, wrote:


    snip long explanation and a bunch of code

    >// The battle begins


    These comments are not portable (not part of C89). Your posting has
    problems with this type of comment wrapping, causing syntax errors
    when recompiled. Use the /* ... */ style.

    You also use other not portable techniques such as declarations after
    statements and "for (int x =" type constructs. Your code would not
    compile on my system.

    >
    >
    > {
    > r = ((double) rand () / ((double) (RAND_MAX) + (double) (1)));


    You only need one of the casts.

    >
    >
    > x = (r * M);
    > y = (int) x;


    Some compilers generate a diagnostic when converting a floating value
    to an integer one (loss of precision) but other than that the cast
    serves no purpose.

    >
    >
    > z = y + 1;
    >// A coin is flipped and is either 1 or 2 in value
    >
    >
    > if (z == 1)


    Your coding style has a most egregious waste of vertical space. It
    seriously disrupts the visual flow of your program. Do you get paid
    by the line, regardless of content?

    snip more code


    Remove del for email
     
    Barry Schwarz, Oct 28, 2006
    #2
    1. Advertising

  3. Barry Schwarz said:

    > On 28 Oct 2006 09:49:11 -0700, wrote:
    >
    >>r = ((double) rand () / ((double) (RAND_MAX) + (double) (1)));

    >
    > You only need one of the casts.


    He doesn't need any of them:

    r = rand() / (RAND_MAX + 1.0);


    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at above domain (but drop the www, obviously)
     
    Richard Heathfield, Oct 28, 2006
    #3
  4. Barry Schwarz wrote:
    > On 28 Oct 2006 09:49:11 -0700, wrote:


    >> {
    >> r = ((double) rand () / ((double) (RAND_MAX) + (double) (1)));

    >
    > You only need one of the casts.


    Or none at all:
    r = rand() / (RAND_MAX + 1.);
     
    Martin Ambuhl, Oct 28, 2006
    #4
  5. Bill Reid Guest

    <> wrote in message
    news:...

    > I spent quite a bit of work trying to get this to format on google
    > groups, so let me know if it needs explination.


    I think I know what's going on here...after all, I AM a "people
    person"...

    > Basicly the tree sorts
    > randomly, and can start from any number on the pyramid. It has a 50/50
    > chance of moving down either tree. If it continues to the next number
    > down the tree it advances. Otherwise it reatreats back up the tree on
    > the adjacanet path. When it reaches 0 or 1, it can switch back over,
    > and start moving in the opposite direction
    >
    > /\
    > / \
    > / \
    > 1 0
    > / |\ / | \
    > 2 | \/ | -1
    > / |\| |/ | \
    > 3 | | -2
    > / |\| |/| \
    > 4 | | -3
    > / |\| |/| \
    > 5 | | -4
    > / |\| |/| \
    > 6 | | -5
    > / |\| |/| \
    > 7 | | -6
    > \ | | /
    > \ | | /
    > \| |/
    > ^ ^
    >
    > But when
    > looking at the quantum pyramid there are two different ways you can see
    > it. You can let a particle fall through the pyramid completely at
    > random, or you can stop and *observe* the particle falling through the
    > pyramid at any given point.
    >

    Ever play Pachinko?
    >
    > But once we observe the pyramid, we know where the particle will be in
    > the future, even though it is moving in a completely random pattern.
    > 8)
    >
    > And by observe I mean we actually create, literally. Because we can
    > start the particle off at a point in the pyramid ourselves, and let it
    > operate within the random chaos sphere.
    >
    > Now here is the math:
    >
    > To calculate the average number of moves before you advance n steps
    > forward. The equation k( n-k ) will
    > works according to martingale probability theory.


    "Martingale probability theory"? What does the length of trousers
    on Carribean islands have to do with this?

    It looks more like a classic job (and simple!) job for Bayesian
    analysis...
    >
    > Here is the source code that proves the quantum pyramid's results:
    >
    > #include <stdio.h>
    > #include <stdlib.h>
    >
    >
    > main ()


    Follow-ups set to comp.lang.c, because main() returns an int, and
    should be declared as "int main(void)".

    ---
    William Ernest Reid
     
    Bill Reid, Oct 29, 2006
    #5
  6. Please get back to us with your program when it can print out the basic
    benchmarks of quantum electrodynamics. Hint: you'll need at least
    double precision floats, as QED has been tested out to something like
    14 decimal places.
     
    Ancient_Hacker, Oct 29, 2006
    #6
  7. pete Guest

    [ot]Re: The Quantum Pyramid

    Bill Reid wrote:
    >
    > <> wrote in message


    > > To calculate the average number of moves before you advance n steps
    > > forward. The equation k( n-k ) will
    > > works according to martingale probability theory.

    >
    > "Martingale probability theory"? What does the length of trousers
    > on Carribean islands have to do with this?


    The phrase "Martingale probability theory",
    links this post
    to the "Final Theory Of Everything" series of silly posts on clc.

    --
    pete
     
    pete, Oct 29, 2006
    #7
  8. Bill Reid Guest

    Re: [ot]Re: The Quantum Pyramid

    pete <> wrote in message
    news:...
    > Bill Reid wrote:
    > > <> wrote in message

    >
    > > > To calculate the average number of moves before you advance n steps
    > > > forward. The equation k( n-k ) will
    > > > works according to martingale probability theory.

    > >
    > > "Martingale probability theory"? What does the length of trousers
    > > on Carribean islands have to do with this?

    >
    > The phrase "Martingale probability theory",
    > links this post
    > to the "Final Theory Of Everything" series of silly posts on clc.
    >

    And without even noting any similarity between said posts, the
    phrase in and of itself screams out:

    "ATTENTION MORONS OF COMP.LANG.C YOU ARE
    BEING TROLLED YET AGAIN BY A KOOK AND THERE
    AIN'T A DAMN THING YOU CAN DO ABOUT IT!!!"

    Of course, you'd have to know a) probability theory and b) the
    Martingale "system" to "get the joke". "People skills" are actually
    secondary...

    Maybe all follow-ups here should just go to alt.syntax.tactical, where
    I am beginning to suspect there are a group sniggering frat boys that
    rejoice at just about every reply post in the group...

    ---
    William Ernest Reid
     
    Bill Reid, Oct 29, 2006
    #8
  9. Re: [ot]Re: The Quantum Pyramid

    Bill Reid wrote:
    > pete <> wrote in message
    > news:...
    >> Bill Reid wrote:
    >>> <> wrote in message
    >>>> To calculate the average number of moves before you advance n steps
    >>>> forward. The equation k( n-k ) will
    >>>> works according to martingale probability theory.
    >>> "Martingale probability theory"? What does the length of trousers
    >>> on Carribean islands have to do with this?

    >> The phrase "Martingale probability theory",
    >> links this post
    >> to the "Final Theory Of Everything" series of silly posts on clc.
    >>

    > And without even noting any similarity between said posts, the
    > phrase in and of itself screams out:
    >
    > "ATTENTION MORONS OF COMP.LANG.C YOU ARE
    > BEING TROLLED YET AGAIN BY A KOOK AND THERE
    > AIN'T A DAMN THING YOU CAN DO ABOUT IT!!!"
    >
    > Of course, you'd have to know a) probability theory and b) the
    > Martingale "system" to "get the joke". "People skills" are actually
    > secondary...
    >
    > Maybe all follow-ups here should just go to alt.syntax.tactical, where
    > I am beginning to suspect there are a group sniggering frat boys that
    > rejoice at just about every reply post in the group...
    >

    Don't hold back, man. It's unhealthy.
     
    Clever Monkey, Oct 30, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gautam Thaker

    error on quantum:superposition module

    Gautam Thaker, Apr 27, 2005, in forum: Perl
    Replies:
    0
    Views:
    2,763
    Gautam Thaker
    Apr 27, 2005
  2. rjtucke
    Replies:
    0
    Views:
    268
    rjtucke
    Feb 22, 2007
  3. rrtucci
    Replies:
    0
    Views:
    400
    rrtucci
    Feb 25, 2008
  4. Fab Pad
    Replies:
    0
    Views:
    339
    Fab Pad
    Feb 26, 2012
  5. johannes falcone
    Replies:
    1
    Views:
    215
    Rainer Weikusat
    Apr 20, 2013
Loading...

Share This Page