  
14.11.2011, 17:40
  Forum Veteran   Join Date: Sep 2010 Location: AarghOw!
Posts: 1,321
Groaned at 12 Times in 11 Posts
Thanked 1,838 Times in 756 Posts
  Re: A question for the math geeks  Quote:      Take the interval of real numbers [0,100].
From this interval, n different numbers are picked randomly, where n>1.
What is the expected difference between the largest and smallest number picked for a given value of n? (assume uniform distribution, where required)
Happy to hear an answer for the case n=2, as well as the more general case for arbitrary integer values of n>1.      The expected range is 100*(N1)/(N+1)
The probability density function of the range r is a beta function, N*(N1)*(1r/100)*(r/100)^(n2), so you can multiply that by r and integrate between 0 and 100 to get the expected range.
To test the answer, we can look at special cases:
N = 1, expected range is 0 (obviously correct)
As N goes to infinity, chances are the minimum is very close to 0 and the maximum is very close to 100, so the range will tend to 100.

14.11.2011, 17:40
  Forum Legend   Join Date: Oct 2009 Location: Basel
Posts: 14,750
Groaned at 284 Times in 189 Posts
Thanked 18,639 Times in 7,827 Posts
  Re: A question for the math geeks
just wrote a quick program to test the n=2 case:
[PHP]#include <stdio.h>
#include <stdlib.h>
int main (int argc, int argv[]){
int i,a,b,d,total=0;
int numtrials=8000;
int max=50, min=50;
for (i=0;i<numtrials;i++){
a = rand()%101;
b = rand()%101;
if (a>b) d= ab; else d=ba;
total+=d;
if (a>max) max=a;
if (a<min) min=a; if (b>max) max=b;
if (b<min) min=b;
}
printf("Avg: %i\n",total/numtrials);
printf("Min: %i\n",min);
printf("Max: %i\n",max);
return 0;
}[/PHP]
output is:
Avg: 34
Min: 0
Max: 100
so the answer seems to be 34 (using this 'discrete' approximation).

14.11.2011, 17:41
  Forum Veteran   Join Date: Jun 2008 Location: Zürich, Switzerland
Posts: 767
Groaned at 8 Times in 7 Posts
Thanked 876 Times in 356 Posts
 
There is no spoon. ;)

14.11.2011, 17:46
  Forum Legend   Join Date: Aug 2009 Location: Zugerberg, Zug
Posts: 3,266
Groaned at 72 Times in 58 Posts
Thanked 3,715 Times in 1,747 Posts
  Re: A question for the math geeks
I deleted my previous post as I think there is something wrong somewhere lol 
14.11.2011, 17:50
  Forum Legend   Join Date: Oct 2009 Location: Basel
Posts: 14,750
Groaned at 284 Times in 189 Posts
Thanked 18,639 Times in 7,827 Posts
  Re: A question for the math geeks  Quote:      The expected range is 100*(N1)/(N+1)
The probability density function of the range r is a beta function, N*(N1)*(1r/100)*(r/100)^(n2), so you can multiply that by r and integrate between 0 and 100 to get the expected range.
To test the answer, we can look at special cases:
N = 1, expected range is 0 (obviously correct)
As N goes to infinity, chances are the minimum is very close to 0 and the maximum is very close to 100, so the range will tend to 100.      thanks. this seems to make sense.

14.11.2011, 21:07
  Forum Legend   Join Date: Dec 2010 Location: Lugano
Posts: 32,226
Groaned at 2,458 Times in 1,778 Posts
Thanked 39,330 Times in 18,537 Posts
  Re: A question for the math geeks  Quote:      the answer seems to be 34      I always thought that the answer was 42!
(now what was the question?)
Tom

14.11.2011, 22:12
  Forum Legend   Join Date: Apr 2009 Location: Somewhere special far away
Posts: 4,319
Groaned at 69 Times in 51 Posts
Thanked 7,177 Times in 2,657 Posts
  Re: A question for the math geeks
So the answer is 100 ?
Where is our lovely Mathnut ?

14.11.2011, 23:22
  Forum Legend   Join Date: Oct 2009 Location: Basel
Posts: 14,750
Groaned at 284 Times in 189 Posts
Thanked 18,639 Times in 7,827 Posts
  Re: A question for the math geeks  Quote:      Since you assume an uniform distribution, n points will split the range [1..100] in (n+1) smaller intervals. Each interval length is 100/(n+1).
The n points have (n1) interval between the smallest and the largest, therefore the length is (n1)*100/(n+1)      thanks. this is a very intuitive and elegant way to tackle it.

15.11.2011, 00:10
  Forum Legend   Join Date: Jul 2009 Location: Basel
Posts: 3,701
Groaned at 35 Times in 32 Posts
Thanked 6,966 Times in 2,251 Posts
  Re: A question for the math geeks
All of the words in this thread are in English, but nevertheless, I can't make heads or tails of it.

15.11.2011, 00:33
  Forum Legend   Join Date: Oct 2009 Location: Basel
Posts: 14,750
Groaned at 284 Times in 189 Posts
Thanked 18,639 Times in 7,827 Posts
  Re: A question for the math geeks  Quote:      All of the words in this thread are in English, but nevertheless, I can't make heads or tails of it.      congratulations: you are not a maths geek. now enjoy a life that involves members of the opposite sex.

15.11.2011, 00:37
  Forum Legend   Join Date: Oct 2009 Location: Basel
Posts: 14,750
Groaned at 284 Times in 189 Posts
Thanked 18,639 Times in 7,827 Posts
  Re: A question for the math geeks  Quote:      But it's really what I said...in less words...and without an explanation       Quote:      100*n/(n+1) is what pops into my mind      nope: your answer was wrong.

15.11.2011, 00:52
  Forum Legend   Join Date: Oct 2009 Location: Basel
Posts: 14,750
Groaned at 284 Times in 189 Posts
Thanked 18,639 Times in 7,827 Posts
  Re: A question for the math geeks
OK. Here's another question.
On a flat table, there is drawn a circle with radius r. A line is drawn through the circle running exactly north/south and passes directly through the centre of the circle.
A thin needle of length l, where 0<l<=r is thrown randomly onto the circle. if any part of the needle is outside the circle, it is picked up and rethrown until it lies entirely on or within the circle.
What is the probability that the needle touches the line?
Second part of the question:
n>0 identical needles of lenght l are thrown in the same manner onto the circle. a heavy cylinder then is pressed onto the needles so that they are pressed into a flat plane.
let T be the number of different needles that touch or cross. for example, if 3 needles are thrown and needles 1 and 2 land in exactly the same way and the third lies across both 1 and 2, then T=3: 1 touches 2, 1 touches 3, 2 touches 3.
what is the expected value of T for a given value of n, l and r?
__________________
By replying to this post, you hereby grant Phil_MCR a royaltyfree license to use, in any way, anything posted by you on the internet. If you do not accept, stop using EF and delete your account.
Last edited by Phil_MCR; 18.11.2011 at 12:22.

15.11.2011, 01:01
  Forum Legend   Join Date: Feb 2010 Location: CH
Posts: 3,200
Groaned at 86 Times in 70 Posts
Thanked 5,788 Times in 2,254 Posts
  Re: A question for the math geeks 
15.11.2011, 01:09
  Member   Join Date: Jun 2010 Location: Geneva
Posts: 180
Groaned at 1 Time in 1 Post
Thanked 209 Times in 93 Posts
  Re: A question for the math geeks  Quote:      OK. Here's another question.      No. Do your own homework now! 
15.11.2011, 01:11
  Re: A question for the math geeks  Quote:      OK. Here's another question.
On a flat table, there is drawn a circle with radius r. A line is drawn through the circle running exactly north/south and passes directly through the centre of the circle.
A thin needle of length l, where 0<l<=r is thrown randomly but in such a way that it always falls such that no part of it extends outside the circumference of the circle.
What is the probability that the needle touches the line?
Second part of the question:
n>0 identical needles are thrown in the same manner onto the circle. a heavy cylinder then is pressed onto the needles so that they are pressed into a flat plane.
let T be the number of different needles that touch or cross. for example, if 3 needles are thrown and needles 1 and 2 land in exactly the same way and the third lies across both 1 and 2, then T=3: 1 touches 2, 1 touches 3, 2 touches 3.
what is the expected value of T for a given value of n, l and r?      Just last week, I was confronted with exactly this dilemma while sitting at my desk, trying to improve my company's profitability. Few people understand the impact on corporate revenues of needles crossing from one half of a circle to the other, and even fewer, the devastating consequences of underestimating the number of needles that touch or cross when many needles are thrown with gay abandon into a circle just before the annual heavycylinder squashing ritual takes place.
I hope someone can provide the answer to this problem that has plagued corporate beancounters for centuries, but I only wish that answer had been available when I really needed it, last week. 
15.11.2011, 14:18
  Forum Legend   Join Date: Oct 2009 Location: Basel
Posts: 14,750
Groaned at 284 Times in 189 Posts
Thanked 18,639 Times in 7,827 Posts
  Re: A question for the math geeks  Quote:     Just last week, I was confronted with exactly this dilemma while sitting at my desk, trying to improve my company's profitability. Few people understand the impact on corporate revenues of needles crossing from one half of a circle to the other, and even fewer, the devastating consequences of underestimating the number of needles that touch or cross when many needles are thrown with gay abandon into a circle just before the annual heavycylinder squashing ritual takes place.
I hope someone can provide the answer to this problem that has plagued corporate beancounters for centuries, but I only wish that answer had been available when I really needed it, last week.      would have repped if i didn't run out of rep points to give 
15.11.2011, 14:27
  Re: A question for the math geeks  Quote:      would have repped if i didn't run out of rep points to give      I can wait ... 
15.11.2011, 15:12
  Modulo 2   Join Date: Oct 2008 Location: Baselland
Posts: 14,500
Groaned at 280 Times in 239 Posts
Thanked 21,738 Times in 8,818 Posts
  Re: A question for the math geeks  Quote:      Avg: 34
Min: 0
Max: 100
so the answer seems to be 34 (using this 'discrete' approximation).      I see your Java(?) and raise you an ABAP. With ten million iterations I get 33.335 on the first run and 33.340 on the second.
[PHP]DATA: n1 TYPE i,
n2 TYPE i.
DATA: t TYPE p LENGTH 16,
r TYPE p LENGTH 16 DECIMALS 3.
DO 10000000 TIMES.
CALL FUNCTION 'GENERAL_GET_RANDOM_INT'
EXPORTING
range = '1000000'
IMPORTING
random = n1.
CALL FUNCTION 'GENERAL_GET_RANDOM_INT'
EXPORTING
range = '1000000'
IMPORTING
random = n2.
t = t + ABS( n2  n1 ).
ENDDO.
r = t / '100000000000'.
WRITE r[/PHP]

15.11.2011, 15:14
  Forum Legend   Join Date: Aug 2009 Location: Zugerberg, Zug
Posts: 3,266
Groaned at 72 Times in 58 Posts
Thanked 3,715 Times in 1,747 Posts
  Re: A question for the math geeks  Quote:      OK. Here's another question.
On a flat table, there is drawn a circle with radius r. A line is drawn through the circle running exactly north/south and passes directly through the centre of the circle.
A thin needle of length l, where 0<l<=r is thrown randomly onto the circle. if any part of the needle is outside the circle, it is picked up and rethrown until it lies entirely on or within the circle.
What is the probability that the needle touches the line?      Hmm wild guess...
I would say the answer is as follows: (probably wrong but here goes)
P(L) = [1  ([[Pi x r ^ 2 / 2] ^ 2] x 2) / ( L x 2r) ]
Where L is the length of the needle, r is the radius and Pi =~ 3.14
Explanation:
P(L) in this case is 1 (100%)  the ratio of the number of positions where the needle would not touch the line over the number of positions where the needle touches the line.
the number of positions where the needle would not touch the line = This is the bit that is probably wrong, as it's the number of 2 points within half a circle where the distance between the points is L, this is of course exluding the diameter and then multiplied by 2.
the number of positions where the needle touches the line = is basically the number of positions along the diamter hence 2r multiplied by L which is the number of points of the needle
Last edited by The_Love_Doctor; 15.11.2011 at 15:27.
Reason: changed it a little bit...

15.11.2011, 16:58
  Forum Legend   Join Date: Oct 2009 Location: Basel
Posts: 14,750
Groaned at 284 Times in 189 Posts
Thanked 18,639 Times in 7,827 Posts
  Re: A question for the math geeks  Quote:      I see your Java(?) and raise you an ABAP. With ten million iterations I get 33.335 on the first run and 33.340 on the second.      it's not java, it's C.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)   Thread Tools   Display Modes  Linear Mode 
Posting Rules
 You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off    All times are GMT +2. The time now is 07:55.  