[AccessD] Math Problem

MartyConnelly martyconnelly at shaw.ca
Thu Oct 16 23:05:58 CDT 2003


Functions came from
http://www.visual-basic-data-mining.net/Forum/ShowPost.aspx?PostID=616
somebody posted from a company pareto.com

Pareto Chart This simple bar chart is the most widely used data display 
tool in Six Sigma because it identifies which problems occur with the 
greatest frequency or incur the highest cost and therefore should be 
attacked first. A typical chart might feature reasons for the problem 
along the horizontal axis and frequency or location along the vertical 
axis. Italian economist Vilfredo Pareto theorized that 20% of possible 
causes are responsible for 80% of any problem.

What I was thinking of doing was dumping everything into matrices to do 
the calculations for speed
sort of like this rather than trying to resolve everything in SQL.

'3 columns and 50 rows into StateDate(2,49)
Dim StateDate (2,49) as String
Dim rs as DAO.Recordset
Set rs = CurrentDB.Openrecordset( _
         SELECT Name, ShortName, TaxRate FROM tblSalesTax', dbOpenDynaset)
StateData = rs.GetRows(50)
rs.Close
Set rs = Nothing

Gustav Brock wrote:

>Hi Marty
>
>Interesting functions. Where have you obtained those?
>
>However, they are not quite valid for the original subject as you
>can't count on having a fixed number of selected items; you need
>minimum two (if two rows carry the same amount, only positive and
>negative, they will sum to zero) but the selection could as well
>include all items and anything in between.
>
>A collection of two has four combinations
>
>  0 0
>  1 0
>  0 1
>  1 1
>
>but we rule out the selection of none and one item leaving only one
>useful selection (1,1) out of four.
>
>For every item added after the first two you have twice as many
>combinations. Thus, the number of different useful combinations is 2^n
>minus 3 or 
>
>  2^(n-1)-1
>
>This doesn't help us much, though, as you all know that 2 raised to
>something very quickly turns out as astronomical numbers.
>
>At n = 20 we have already passed 0.5 mio. combinations and at n = 30
>five hundred mio. At numbers like these applying brute computing power
>only makes no sense, you have to be smart too.
>
>Here, for example, one can quickly see that selecting positive or
>negative values only would lead to nothing as such a collection would
>never sum to zero. You would need to separate the items in two pools,
>positives and negatives, and for any valid combination from pool
>Positives compare the sum to any valid combination from pool Negatives
>and check if the absolute value of the two sums are equal.
>
>The number of tests would be:
>
>  (2^(p-1)-1) * (2^(n-1)-1)
>
>Still comes out as large numbers; matching 10 positives and 10
>negatives results in 261121 combinations ...
>
>/gustav
>
>
>  
>
>>With six objects A,B,C,D,E,F you would have 20 unique combinations 
>>without regard to order.
>>Try code below to calculate the number of objects you can reasonably 
>>use, the calculation fails on overflow when n > 170
>>There are several methods to list out these combinations, in one of 
>>Knuth's programming textbooks.
>>I believe the third volume. I haven't got a copy handy, it's in another 
>>province. TAOCP should be required reading. 
>>http://www-cs-staff.stanford.edu/~knuth/taocp.html
>>    
>>
>
>
>  
>
>>Counting combinations - example
>>    
>>
>
>
>  
>
>>How many different groups of 3 could be selected from the 5 objects A, 
>>B, C, D, E?
>>    
>>
>
>  
>
>>5 ways to select the first, 4 to then select the second, and 3 ways to 
>>select the third, so 5*4*3 ways to choose when order matters
>>    
>>
>
>  
>
>>But, every group of 3 (e.g. A, B, C) is counted 6 (=3!) times: ABC, ACB, 
>>BAC, BCA, CAB, CBA
>>    
>>
>
>  
>
>>So, total number of groups when ignore order is 5*4*3/(3*2*1) = 10
>>    
>>
>
>  
>
>>5! / 3!(5-3)! 120/6*2 =10
>>    
>>
>
>  
>
>>Counting combinations
>>    
>>
>
>
>  
>
>>In general, the number of different groups of r objects out of n is
>>    
>>
>
>  
>
>>n* (n-1) * ... * (n-r+1)/r! = n!/( r! (n-r)! )
>>    
>>
>
>  
>
>>This number is written ( nr ), and is pronounced n choose r
>>    
>>
>
>  
>
>>Example: How many 5 card poker hands are possible (out of a deck of 52 
>>cards)?
>>    
>>
>
>  
>
>>There are ( 525 ) = 2,598,960 poker hands
>>    
>>
>
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada





More information about the AccessD mailing list