Go Back   English Forum Switzerland > Off-Topic > Off-Topic > General off-topic  
Reply
 
Thread Tools Display Modes
  #21  
Old 14.11.2011, 17:40
quark's Avatar
Forum Veteran
 
Join Date: Sep 2010
Location: Aargh-Ow!
Posts: 1,321
Groaned at 12 Times in 11 Posts
Thanked 1,838 Times in 756 Posts
quark has a reputation beyond reputequark has a reputation beyond reputequark has a reputation beyond reputequark has a reputation beyond reputequark has a reputation beyond repute
Re: A question for the math geeks

Quote:
View Post
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*(N-1)/(N+1)

The probability density function of the range r is a beta function, N*(N-1)*(1-r/100)*(r/100)^(n-2), 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.
Reply With Quote
  #22  
Old 14.11.2011, 17:40
Phil_MCR's Avatar
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
Phil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond repute
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= a-b; else d=b-a;
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).
Reply With Quote
  #23  
Old 14.11.2011, 17:41
Nelly_Da_Hefferlump's Avatar
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
Nelly_Da_Hefferlump has a reputation beyond reputeNelly_Da_Hefferlump has a reputation beyond reputeNelly_Da_Hefferlump has a reputation beyond reputeNelly_Da_Hefferlump has a reputation beyond reputeNelly_Da_Hefferlump has a reputation beyond repute
There is no spoon. ;-)
Reply With Quote
  #24  
Old 14.11.2011, 17:46
The_Love_Doctor's Avatar
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
The_Love_Doctor has a reputation beyond reputeThe_Love_Doctor has a reputation beyond reputeThe_Love_Doctor has a reputation beyond reputeThe_Love_Doctor has a reputation beyond reputeThe_Love_Doctor has a reputation beyond reputeThe_Love_Doctor has a reputation beyond repute
Re: A question for the math geeks

I deleted my previous post as I think there is something wrong somewhere lol
Reply With Quote
  #25  
Old 14.11.2011, 17:50
Phil_MCR's Avatar
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
Phil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond repute
Re: A question for the math geeks

Quote:
View Post
The expected range is 100*(N-1)/(N+1)

The probability density function of the range r is a beta function, N*(N-1)*(1-r/100)*(r/100)^(n-2), 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.
Reply With Quote
  #26  
Old 14.11.2011, 21:07
st2lemans's Avatar
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
st2lemans has a reputation beyond reputest2lemans has a reputation beyond reputest2lemans has a reputation beyond reputest2lemans has a reputation beyond reputest2lemans has a reputation beyond reputest2lemans has a reputation beyond repute
Re: A question for the math geeks

Quote:
View Post
the answer seems to be 34
I always thought that the answer was 42!

(now what was the question?)

Tom
Reply With Quote
  #27  
Old 14.11.2011, 22:12
Sky's Avatar
Sky Sky is offline
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
Sky has a reputation beyond reputeSky has a reputation beyond reputeSky has a reputation beyond reputeSky has a reputation beyond reputeSky has a reputation beyond reputeSky has a reputation beyond repute
Re: A question for the math geeks

So the answer is 100 ?

Where is our lovely Mathnut ?
Reply With Quote
  #28  
Old 14.11.2011, 23:22
Phil_MCR's Avatar
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
Phil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond repute
Re: A question for the math geeks

Quote:
View Post
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 (n-1) interval between the smallest and the largest, therefore the length is (n-1)*100/(n+1)
thanks. this is a very intuitive and elegant way to tackle it.
Reply With Quote
  #29  
Old 15.11.2011, 00:10
Village Idiot's Avatar
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
Village Idiot has a reputation beyond reputeVillage Idiot has a reputation beyond reputeVillage Idiot has a reputation beyond reputeVillage Idiot has a reputation beyond reputeVillage Idiot has a reputation beyond reputeVillage Idiot has a reputation beyond repute
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.
Reply With Quote
  #30  
Old 15.11.2011, 00:33
Phil_MCR's Avatar
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
Phil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond repute
Re: A question for the math geeks

Quote:
View Post
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.
Reply With Quote
  #31  
Old 15.11.2011, 00:37
Phil_MCR's Avatar
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
Phil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond repute
Re: A question for the math geeks

Quote:
View Post
But it's really what I said...in less words...and without an explanation
Quote:
View Post
100*n/(n+1) is what pops into my mind
nope: your answer was wrong.
Reply With Quote
  #32  
Old 15.11.2011, 00:52
Phil_MCR's Avatar
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
Phil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond repute
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 re-thrown 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 royalty-free 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.
Reply With Quote
  #33  
Old 15.11.2011, 01:01
MrVertigo's Avatar
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
MrVertigo has a reputation beyond reputeMrVertigo has a reputation beyond reputeMrVertigo has a reputation beyond reputeMrVertigo has a reputation beyond reputeMrVertigo has a reputation beyond reputeMrVertigo has a reputation beyond repute
Re: A question for the math geeks

Reply With Quote
  #34  
Old 15.11.2011, 01:09
marksmadsen's Avatar
Member
 
Join Date: Jun 2010
Location: Geneva
Posts: 180
Groaned at 1 Time in 1 Post
Thanked 209 Times in 93 Posts
marksmadsen has a reputation beyond reputemarksmadsen has a reputation beyond reputemarksmadsen has a reputation beyond reputemarksmadsen has a reputation beyond repute
Re: A question for the math geeks

Quote:
View Post
OK. Here's another question.
No. Do your own homework now!
Reply With Quote
  #35  
Old 15.11.2011, 01:11
Guest
 
Posts: n/a
Re: A question for the math geeks

Quote:
View Post
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 heavy-cylinder 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.
Reply With Quote
  #36  
Old 15.11.2011, 14:18
Phil_MCR's Avatar
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
Phil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond repute
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 heavy-cylinder 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
Reply With Quote
  #37  
Old 15.11.2011, 14:27
Guest
 
Posts: n/a
Re: A question for the math geeks

Quote:
View Post
would have repped if i didn't run out of rep points to give
I can wait ...
Reply With Quote
  #38  
Old 15.11.2011, 15:12
NotAllThere's Avatar
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
NotAllThere has a reputation beyond reputeNotAllThere has a reputation beyond reputeNotAllThere has a reputation beyond reputeNotAllThere has a reputation beyond reputeNotAllThere has a reputation beyond reputeNotAllThere has a reputation beyond repute
Re: A question for the math geeks

Quote:
View Post
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]
Reply With Quote
  #39  
Old 15.11.2011, 15:14
The_Love_Doctor's Avatar
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
The_Love_Doctor has a reputation beyond reputeThe_Love_Doctor has a reputation beyond reputeThe_Love_Doctor has a reputation beyond reputeThe_Love_Doctor has a reputation beyond reputeThe_Love_Doctor has a reputation beyond reputeThe_Love_Doctor has a reputation beyond repute
Re: A question for the math geeks

Quote:
View Post
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 re-thrown 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...
Reply With Quote
  #40  
Old 15.11.2011, 16:58
Phil_MCR's Avatar
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
Phil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond reputePhil_MCR has a reputation beyond repute
Re: A question for the math geeks

Quote:
View Post
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.
Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
iPhone geeks, this ones for you sam ali TV/internet/telephone 6 30.09.2011 23:16
Gadgets for Geeks! Odyssey General off-topic 8 30.11.2010 11:31
Show me your geeks Polorise Jokes/funnies 8 14.12.2009 12:17
For the real geeks about coffee flavio Food and drink 25 07.12.2009 03:43
About geeks dende General off-topic 0 15.04.2008 20:12


All times are GMT +2. The time now is 07:55.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0