

SSCrazy
Group: General Forum Members
Last Login: Today @ 1:34 AM
Points: 2,904,
Visits: 1,822





Ten Centuries
Group: General Forum Members
Last Login: Friday, July 4, 2014 9:03 AM
Points: 1,415,
Visits: 796


Excellent article.
Even better, I see you used to work in Manchester!
Paul. Manchester,UK.




SSCommitted
Group: General Forum Members
Last Login: Wednesday, August 13, 2014 6:34 AM
Points: 1,566,
Visits: 1,851


I enjoyed your article because it was relevant on multiple levels. Thank you for a wellwritten article!




Forum Newbie
Group: General Forum Members
Last Login: Tuesday, September 16, 2014 3:13 PM
Points: 6,
Visits: 260


Hi David,
This is fantastic! I can find many uses for this..
Thanks!
John R




Ten Centuries
Group: General Forum Members
Last Login: Friday, September 12, 2014 7:18 PM
Points: 1,325,
Visits: 1,693


Good article.
Of course, the point you omitted is how the actual probability of any given failure alters the calculations.
With the lottery example, because each of the numbers is (supposedly) equally likely to be chosen, Pascal's triangle is a perfect model, and shows the true (im)probability of winning.
With the car example, QA testing ensures that parts generally have a much higher probability of working than failing, thus although there's only one way for the whole system to work perfectly, it's more likely than the millions of ways it can fail.




SSCrazy
Group: General Forum Members
Last Login: Today @ 1:34 AM
Points: 2,904,
Visits: 1,822


Yes, and apparently each space shuttle launch expected at least 6000 components to fail but was still designed to work.
On my list of things not to think about is precisely how fast a piece of metal moves inside a motorbike engine when it's between your legs
LinkedIn Profile Newbie on www.simpletalk.com




SSCommitted
Group: General Forum Members
Last Login: Yesterday @ 5:15 PM
Points: 1,945,
Visits: 3,008


I think you got trapped in teh procedural mindset. I would use a look up table with DECIMAL(s, 0) columns so i can get the range I need. Ther is one for 1 to 23! at
http://membres.multimania.fr/rsirdey/facttabl.htm
Now, we can apply a little algebra in a CASE expression instead of brute force: CREATE FUNCTION Perm(@n DECIMAL, @r DECIMAL) RETURNS DECIMAL (s,0) AS RETURN CASE WHEN @r = (0, @n) THEN 1.0 WHEN @r = 1.0 THEN @n THEN (SELECT fact FROM Factrorials WHERE @f = @n) / (SELECT fact FROM Factrorials WHERE @f = (@n@r) ELSE CAST (NULL AS DECIMALs,0)) END;
Books in Celko Series for MorganKaufmann Publishing Analytics and OLAP in SQL Data and Databases: Concepts in Practice Data, Measurements and Standards in SQL SQL for Smarties SQL Programming Style SQL Puzzles and Answers Thinking in Sets Trees and Hierarchies in SQL




SSCrazy
Group: General Forum Members
Last Login: Today @ 1:34 AM
Points: 2,904,
Visits: 1,822


Joe, I should have remembered that. I think one of your books mentioned storing a calendar table rather than trying to workout calendar maths on the fly.
It is so easy to forget that storing a few thousand records for utility sets costs next to nothing but delivers one hell of a lot of utility
LinkedIn Profile Newbie on www.simpletalk.com




Grasshopper
Group: General Forum Members
Last Login: Wednesday, May 29, 2013 11:18 AM
Points: 10,
Visits: 51


Thanks for the great article. It reminds me of why when I used to fly airplanes my instructor kept telling me that the probability of an engine failure in a twin engine plane was twice as high as a single... of course you still had one engine running in a twin.
do it right, or do it over and over, it's up to you




Valued Member
Group: General Forum Members
Last Login: Tuesday, July 15, 2014 8:11 AM
Points: 55,
Visits: 406


Don't you also need to make sure that @n <> @r so you don't divide by 0? And @r <> 0 either.



