Please help, my brain has stopped working

Discussion in 'UK Motorcycles' started by AndrewR, Aug 14, 2008.

  1. AndrewR

    AndrewR Guest

    Can somebody here help me out with some basic maths, please? I've got a
    problem[1] which I think should be trivial, but when I try to work it out my
    head starts hurting, my vision goes blurry and I feel sick[2].

    I have 12 variables, each of which has a number of permitted values. Each
    variable has between 1 and 10 permitted values.

    If we call the number of permitted values V1, V2, V3, etc. then obviously
    the total number of combinations is V1 x V2 x V3 x V4 x V5 x V6 x V7 x V8 x
    V9 x V10 x V11 x V12 and this equals roughly 207,000.

    However, what I'm interested in is the number of combinations one gets if
    you also make how many variables you consider a variable.

    So I know that the total number of combinations for 12 variables is 207,000
    and the total number of combinations for 1 variable is V1+V2+V3...+V12 = 39,
    but I'm sure there must be an easy formula to work out the total number of
    possible combinations. Damned if I can think of it though.

    Anybody care to help?

    [1] I have so many problems, but I'm trying to focus on this one right now.
    [2] To be fair this may be more to do with school-night drinking.
     
    AndrewR, Aug 14, 2008
    #1
    1. Advertisements

  2. AndrewR

    Ace Guest

    Buggered if I can work out what you mean.
    Possibly the fact that you don't appear to be able to state your
    requirements[1] clearly is hindering you. Have another go.


    [1] Doubtless someone here will be able to understand you, but it
    ain't me.

    --
    _______
    ..'_/_|_\_'. Ace (b.rogers at ifrance.com)
    \`\ | /`/
    `\\ | //' BOTAFOT#3, SbS#2, UKRMMA#13, DFV#8, SKA#2, IBB#10
    `\|/`
    `
     
    Ace, Aug 14, 2008
    #2
    1. Advertisements

  3. AndrewR

    Colin Irvine Guest

    Depends what you mean by formula. I suspect it'll involve a sigma
    function, which I don't think Excel, for example, can handle.
     
    Colin Irvine, Aug 14, 2008
    #3
  4. AndrewR

    AndrewR Guest

    Sorry, what I want to know is the sum of ...

    The number of possible values I could have if I only look at one (any one)
    of the 12 variables (which is 39)

    Plus

    The number of possible combinations of values if I look at any two of the 12
    variables

    Plus

    The number of possible combinations of values if I look at any three of the
    12 variables

    And so on to ...

    Plus the number of possible combinations of values of all 12 variables
    (which is 207,360)

    So I should be able to add the 12 numbers, but I don't know what 10 of them
    are.

    Moving to the second step, where I consider the number of combinations of
    any 2 values that should be:

    V1+V2+2(V3)+3(V4)+4(V5)+5(V6)+6(V7)+7(V8)+8(V9)+9(V10)+10(V11)+11(V12)

    I think, but I'm not sure.

    Any the wiser?
     
    AndrewR, Aug 14, 2008
    #4
  5. AndrewR

    Eddie Guest

    Explain how you get this result...
    .... and this result...
    .... and I might be able to work out what you mean.
    How about your friendly, local maths teacher?
    Lightweight.
     
    Eddie, Aug 14, 2008
    #5
  6. AndrewR

    Ace Guest

    Is it? What do you mean by "look at"?

    I'm afraid your "specification writing" skills, if you had any, seem
    to have deserted you.

    From the fact that you're trying to add the combinations, I might
    infer that you're wanting to combine all twelve variables into one,
    which could indeed give 39 distinct values, but only if there are no
    common values across the 12 variables, which, as you only know the
    number of possible values for each, you presumably can't guarantee.
    Nope.

    --
    _______
    ..'_/_|_\_'. Ace (b.rogers at ifrance.com)
    \`\ | /`/
    `\\ | //' BOTAFOT#3, SbS#2, UKRMMA#13, DFV#8, SKA#2, IBB#10
    `\|/`
    `
     
    Ace, Aug 14, 2008
    #6
  7. AndrewR

    Eddie Guest

    AndrewR wrote:
    Nope, still don't follow that.
     
    Eddie, Aug 14, 2008
    #7
  8. AndrewR

    AndrewR Guest


    OK.

    Variable 1 has 3 possible values (E, A and C)
    Variable 2 also has 3 possible values (P, C and N)
    Variable 3 has 4 possible values (U, B, E and S)
    Variable 4 has 2 values (T and F)
    Variable 5 has 2 values (N and C)
    Variable 6 has the same 2 values as variable 5
    Variable 7 has 3 values (E, L and N)
    Variable 8 has the same 3 values as variable 7
    Variable 9 has 4 values (X, L, N and B)
    Variable 10 has 2 values (O and N)
    Variable 11 has 10 values (bugger it)
    and variable 12 has 1 value (NA)

    So, considering the variables as a set (which is how they're used) the
    number of possible combinations is 3x3x4x2x2x2x3x3x4x2x10x1=207,360 (or
    something very close to that)

    If I were to deal with a single variable at a time then I'd be looking at 1
    or 39 possible values (ignore the fact that some values are the same - a
    value of 'N' for variable 1 means something different to a value of 'N' for
    variable 5, for example)

    Now, if I considered any 2 variables how many possible combinations of
    values are there?

    Then any 3, and so on.

    Basically what I'm trying to do is a write a series of nested loops which
    will loop through all of the possible values of a single variable, all the
    values of 2 variables and so on all the way to looping through all of the
    possible values of 12 variables, but I want to know how many loops will be
    involved.

    The code inside the loops is going to be fairly complex and will involve,
    among other things, looping through another list of 200-300 items for every
    iteration of the loop, which is (I suspect) going to make for a
    stratospheric number of loops. If so then I might not bother as I'm working
    in Excel on a lap-top, so I'm not going to waste my time writing something
    that's going to have a processing time of days.
     
    AndrewR, Aug 14, 2008
    #8
  9. AndrewR

    Eddie Guest

    I think I'm with you now... at a rough guess, without bothering to think
    about it too much: 39! = 2.03978821 × 10^46
     
    Eddie, Aug 14, 2008
    #9
  10. AndrewR

    Ace Guest

    STILL not getting through. What do you mean by "deal with"?

    If you're "dealing with" V1 then you have 3 possible values, v3 has 4,
    etc. etc. But this is your starting point, so you know that. But where
    do you get the idea of adding all the ranges together from?

    If you don't know which variable you'll be "dealing with" you
    presumably would like to know the greatest number of possible values,
    but that would just be max(V1_vals-V12_vals).
    So you are trying to combine them into a single variable?
    Ahh, you really are trying to combine them - why didn't you say so?
    You want to know how many unique combinations there may be across any
    or all of the variables. Let's see.... around 207,000 ought to do it.

    Although it sounds like you may also want to add a _null_ value to
    every range, to represent the values of a combination of variables Vx
    and Vy, where values of Vother are ignored, so you'd need to calculate
    (V1+1)*(V2+1)*(V3+1) etc.

    Doing your "adding all the possible numbers of values together" is
    just a very long way of performing the multiplication.
    It's all right - just post it here and some other **** will do it for
    you, I'm sure.

    --
    _______
    ..'_/_|_\_'. Ace (b.rogers at ifrance.com)
    \`\ | /`/
    `\\ | //' BOTAFOT#3, SbS#2, UKRMMA#13, DFV#8, SKA#2, IBB#10
    `\|/`
    `
     
    Ace, Aug 14, 2008
    #10
  11. AndrewR

    AndrewR Guest

    D'Oh! Of course - that's both blindingly obvious and keeps my number of
    loops down to a reasonable value.

    Thank you, sir.

    My apologies for not explaining myself very well, but this is a very small
    piece of a very large puzzle and I was trying not to suck all of the
    bandwidth out of the Internet by explaining everything.

    --
    AndrewR, D.Bot (Celeritas)
    Aprilia RSV-1000R, Honda VFR750F-L, Kawasaki ZX-6R, Fiat Coupe 20v Turbo
    BOTAFOT#2,ITJWTFO#6,UKRMRM#1/13a,MCT#1,DFV#2,SKoGA#0 (and KotL)
    BotToS#5,SBS#25,IbW#34, DS#5, COSOC# Suspended, KotTFSTR#
    The speccy Geordie twat.
     
    AndrewR, Aug 14, 2008
    #11
  12. AndrewR

    Jérémy Guest

    At the age of 18, in around 1975, when I got my hands for the first time
    on a real computer, I decided to solve the problem of the caterpillar on
    the infinitely extensible piece of elastic[1] iteratively[2]. I waited
    around for a few minutes but no answer was forthcoming, so I went home
    intending to return next day for the answer. What I actually got the
    following morning was a surprisingly polite and sympathetic note from
    the computer centre staff explaining that they had had to end the job as
    the computer was devoting its entire time to projecting my virtual
    caterpillar across light years of elastic, followed by a solution to the
    problem in about three lines (they'd inferred the problem from my
    program, which may or may not have had a comment or two) and a
    suggestion that a more sophisticated approach might be in order next
    time.

    You're not trying to do something similar, are you?

    --
    Jeremy
    R1200RT

    [1] The elastic is initially 1m long, and the caterpillar starts from
    one end at 1cm/s. At the end of each second the elastic is stretched by
    another metre (so it's 2m after 1 second, 3m after 2 seconds etc.). Will
    the caterpillar ever reach the other end?

    [2] Being fairly useless at maths, but ever enthusiastic to apply a
    combination of ignorance and brute force.
     
    Jérémy, Aug 14, 2008
    #12

  13. = A Suffusion of Yellow.

    HTH.
     
    Brownz @ Work, Aug 14, 2008
    #13
  14. AndrewR

    AndrewR Guest

    No, I'm trying to do something infinitely more futile ... work out if a
    government agency is going to fall flat on its face in 6.5 weeks.

    --
    AndrewR, D.Bot (Celeritas)
    Aprilia RSV-1000R, Honda VFR750F-L, Kawasaki ZX-6R, Fiat Coupe 20v Turbo
    BOTAFOT#2,ITJWTFO#6,UKRMRM#1/13a,MCT#1,DFV#2,SKoGA#0 (and KotL)
    BotToS#5,SBS#25,IbW#34, DS#5, COSOC# Suspended, KotTFSTR#
    The speccy Geordie twat.
     
    AndrewR, Aug 14, 2008
    #14
  15. AndrewR

    Eddie Guest

    Well, duh.
     
    Eddie, Aug 14, 2008
    #15
  16. AndrewR

    AndrewR Guest


    It could be, as the other list of 200-odd items that I'm looping through
    with every iteration is independent of the 12 variables, but, even though it
    sounds cool, I suspect it's going to be much easier to code out the
    completely null case.

    --
    AndrewR, D.Bot (Celeritas)
    Aprilia RSV-1000R, Honda VFR750F-L, Kawasaki ZX-6R, Fiat Coupe 20v Turbo
    BOTAFOT#2,ITJWTFO#6,UKRMRM#1/13a,MCT#1,DFV#2,SKoGA#0 (and KotL)
    BotToS#5,SBS#25,IbW#34, DS#5, COSOC# Suspended, KotTFSTR#
    The speccy Geordie twat.
     
    AndrewR, Aug 14, 2008
    #16
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.