i am trying to set up a quick and dirty, but efficient way to calculate permutation and combination. anyone out there dealt with this?any takers?|||The method depends on what kind of permutations you want to do.
Given N objects in X different positions, do you want to allow repetitions? Do you want to include permutations with less than X values?
There are formulas available that will calculate these. Excel actually has some good statistical functions that not only do the calculations, but the help file does a good job of explaining the formula used. You might run a couple test on a spreadsheet until you are sure what kind of permutation you want, and then port the formula from Excel's help file into a TSQL statement.|||ok, it's been awhile, and i barely passed it, but knowing the total number (9999), what is the n in this combination formula:
9999 = n! / (4!(n-4)!)|||never mind, it doesn't jive, back to the drawing board|||N is the number of items, and I believe 4 is the number of locations.
N! is N Factorial, which SQL Server does not have as a standard function, but is simply 1*2*3*4*5...*N, so you could write the function easily enough.|||...and 9999 factorial would be HUGE! We're way beyond "grains of sand" and into "atoms in the universe" here...
Thursday, March 22, 2012
computation and promutation
Labels:
calculate,
combination,
computation,
database,
dealt,
dirty,
efficient,
microsoft,
mysql,
oracle,
permutation,
promutation,
server,
sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment