Go to Post A team does not achieve "Powerhouse" status by dominating every once in a while... they achieve that status by consistently dominating every year. - Jon Jack [more]
Home
Go Back   Chief Delphi > Other > Math and Science
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #61   Spotlight this post!  
Unread 19-07-2016, 18:13
Caleb Sykes's Avatar
Caleb Sykes Caleb Sykes is online now
Registered User
FRC #4536 (MinuteBots)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: St. Paul, Minnesota
Posts: 1,042
Caleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond repute
Re: Math Quiz 9

Quote:
Originally Posted by Richard Wallace View Post
So the distribution of lengths is Rayleigh. Neat example.
Rayleigh distributions can't have upper bounds though, right? This distribution will clearly have an upper bound at sqrt(2).
Reply With Quote
  #62   Spotlight this post!  
Unread 19-07-2016, 19:24
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,570
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Math Quiz 9

Quote:
Originally Posted by Richard Wallace View Post
So the distribution of lengths is Rayleigh. Neat example.

What would the distribution look like if the line segments were contained in a cube (3D) boundary? That one may be easier to visualize using a Monte Carlo simulation.
Quote:
Originally Posted by Caleb Sykes View Post
Rayleigh distributions can't have upper bounds though, right? This distribution will clearly have an upper bound at sqrt(2).
Similar, but not quite a Rayleigh Distribution.

Quote:
Originally Posted by Rayleigh distribution
The Rayleigh distribution, named for William Strutt, Lord Rayleigh, is the distribution of the magnitude of a two-dimensional random vector whose coordinates are independent, identically distributed, mean 0 normal variables.
After going to signed x ̅ = x1-x2 and y ̅ = y1-y2 components, but before collapsing the four quadrants, this problem is to evaluate the mean of the magnitude of a two-dimensional random vector whose coordinates are independent, identcially distributed, mean 0 triangular variables. That is, x ̅ and y ̅ are defined by the triangle function, max(0,1-abs(x)), rather than the normal distribution which would mean one proportional to e-ax2 (aka the Gaussian "bell curve"). As Caleb notes, this distribution, like the normal distribution, has no upper bound (an infinitely long tail).

If the working space were a cube, the small end of the distribution would start out with zero slope and a parabolic ramp of 4πr2. It would peak at a somewhat higher length (WAG of 0.6), have a similar change of curvature at length 1, and have an upper bound at √3.

Spoiler for Did you notice?:
For those who noticed, yes, the 2πr in the square case is the length of a circle of radius r, and 4πr2 is the area of a sphere of radius r in the cubic case. In the near-zero-radius limit, the size of the locus of points r units away from any given point is the population density.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 20-07-2016 at 06:20. Reason: tweaks and spoiler wrapper - and no thirds
Reply With Quote
  #63   Spotlight this post!  
Unread 19-07-2016, 21:31
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,028
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Math Quiz 9

Quote:
Originally Posted by Richard Wallace View Post
What would the distribution look like if the line segments were contained in a cube (3D) boundary?
...
Attached Thumbnails
Click image for larger version

Name:	cube_hist.png
Views:	33
Size:	17.2 KB
ID:	20923  
Reply With Quote
  #64   Spotlight this post!  
Unread 20-07-2016, 15:44
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,028
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Math Quiz 9


Wrapping up some loose ends...

Quote:
Originally Posted by smitikshah View Post
by "inside" are they allowed to touch the edge of the square?
Quote:
Originally Posted by Ether View Post
Does it matter?
Why or why not? Explain.

Reply With Quote
  #65   Spotlight this post!  
Unread 20-07-2016, 16:41
Hitchhiker 42's Avatar
Hitchhiker 42 Hitchhiker 42 is offline
Roboter
AKA: Mark Lavrentyev
FRC #4557 (FullMetal Falcons)
Team Role: Programmer
 
Join Date: Oct 2015
Rookie Year: 2015
Location: Cromwell, CT
Posts: 471
Hitchhiker 42 is a splendid one to beholdHitchhiker 42 is a splendid one to beholdHitchhiker 42 is a splendid one to beholdHitchhiker 42 is a splendid one to beholdHitchhiker 42 is a splendid one to beholdHitchhiker 42 is a splendid one to beholdHitchhiker 42 is a splendid one to beholdHitchhiker 42 is a splendid one to behold
Re: Math Quiz 9

Quote:
Originally Posted by Ether View Post

Wrapping up some loose ends...



Why or why not? Explain.

If I could,

The reason I don't think it matters is that let's say you were to take one end point of any line very very very close to the edge. If you keep pushing it infinetly closer, it's essentially on the edge already (limits woo), so it doesn't matter.
__________________



2016 - NE District Championship Entrepreneurship Award
2016 - Hartford District Industrial Design Award
2016 - Waterbury District Engineering Inspiration Award
Reply With Quote
  #66   Spotlight this post!  
Unread 21-07-2016, 00:34
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,570
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Math Quiz 9

Quote:
Originally Posted by Ether View Post

Wrapping up some loose ends...



Why or why not? Explain.

Enough hours have passed:

Allowing the borders of the square does NOT matter. The likelihood of one of the endpoints falling in any given area within the permissible bounds is proportional to the area. The lines at the edge of the square have length but zero area, so even if they're allowed, the selected point will "never" be on the edge. A bit more formally, the chances of a point on an edge being chosen is infinitesimally small and (excepting something massively discontinuous like a delta function) does not affect the integration over the area.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #67   Spotlight this post!  
Unread 21-07-2016, 01:48
Greg Woelki's Avatar
Greg Woelki Greg Woelki is offline
FRC Alumnus
FRC #1768
 
Join Date: May 2014
Rookie Year: 2013
Location: Bolton, MA
Posts: 97
Greg Woelki is a glorious beacon of lightGreg Woelki is a glorious beacon of lightGreg Woelki is a glorious beacon of lightGreg Woelki is a glorious beacon of lightGreg Woelki is a glorious beacon of light
Re: Math Quiz 9

Quote:
Originally Posted by GeeTwo View Post
Edit - and thanks, Caleb! I was thinking about attacking the same problem with the unit circle next, and I just realized I can adapt this technique to randomly pick r and theta with a uniform spatial distribution.
You can generate uniformly distributed coordinates in a unit circle much more easily, actually (if you look at genPolyPt() in my code, I do exactly that). Just setting r to the square root of a random number will correct the unevenness of the distribution.
Reply With Quote
  #68   Spotlight this post!  
Unread 21-07-2016, 09:18
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,028
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Math Quiz 9



What's the average length of all the line segments whose endpoints both lie on the unit square's perimeter?


Reply With Quote
  #69   Spotlight this post!  
Unread 21-07-2016, 11:36
z_beeblebrox's Avatar
z_beeblebrox z_beeblebrox is offline
Custom User Title
AKA: Cal
FRC #4183 (Bit Buckets)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Cambridge MA
Posts: 811
z_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond repute
Re: Math Quiz 9

Quote:
Originally Posted by Ether View Post


What's the average length of all the line segments whose endpoints both lie on the unit square's perimeter?


Modified above Monte Carlo code to solve this:

Code:
import numpy as np

iterations = 100000

avg = 0

for i in range(1000):
    print(i)
    for j in range(iterations):
        perimeter = 4*np.random.rand(2)

        if perimeter[0] < 1:
            y1 = 0
            x1 = perimeter[0]
        elif perimeter [0] < 2:
            y1 = perimeter[0] - 1
            x1 = 1
        elif perimeter[0] < 3:
            y1 = 1
            x1 = 3 - perimeter[0]
        else:
            y1 = 4 - perimeter[0]
            x1 = 0

        if perimeter[1] < 1:
            y2 = 0
            x2 = perimeter[1]
        elif perimeter[1] < 2:
            y2 = perimeter[1] - 1
            x2 = 1
        elif perimeter[1] < 3:
            y2 = 1
            x2 = 3 - perimeter[1]
        else:
            y2 = 4 - perimeter[1]
            x2 = 0

        length = np.sqrt((x1-x2)**2+(y1-y2)**2)
        avg = (avg*j + length)/(j+1)
    with open("9.1.txt", "a") as f:
        f.write(str(avg)+'\n')
2.1e7 iterations yields 0.73511, standard deviation 0.00095 (between blocks averaging 1e6 iterations). More iterations will give a more accurate answer.
__________________
2012 Utah Regional Rookie All-Star
2013 Phoenix Regional Judge's Award for "design process and prototyping"
2014 Hub City Regional Quality Award, Arizona Regional Excellence in Engineering Award
2015 Arizona East Regional Creativity Award, Winner
2016 Arizona North Regional Finalist, Arizona West Excellence in Engineering Award, Finalist

Last edited by z_beeblebrox : 21-07-2016 at 11:44.
Reply With Quote
  #70   Spotlight this post!  
Unread 21-07-2016, 18:51
smitikshah's Avatar
smitikshah smitikshah is offline
Drive Coach
AKA: Smiti
FRC #2869 (Regal Eagles)
Team Role: Coach
 
Join Date: Dec 2015
Rookie Year: 2015
Location: New York
Posts: 146
smitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond repute
Re: Math Quiz 9

Quote:
Originally Posted by Hitchhiker 42 View Post
If I could,

The reason I don't think it matters is that let's say you were to take one end point of any line very very very close to the edge. If you keep pushing it infinetly closer, it's essentially on the edge already (limits woo), so it doesn't matter.
Ah okay that makes sense. Thanks!
__________________
Reply With Quote
  #71   Spotlight this post!  
Unread 21-07-2016, 18:52
smitikshah's Avatar
smitikshah smitikshah is offline
Drive Coach
AKA: Smiti
FRC #2869 (Regal Eagles)
Team Role: Coach
 
Join Date: Dec 2015
Rookie Year: 2015
Location: New York
Posts: 146
smitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond reputesmitikshah has a reputation beyond repute
Re: Math Quiz 9

Quote:
Originally Posted by GeeTwo View Post
Enough hours have passed:

Allowing the borders of the square does NOT matter. The likelihood of one of the endpoints falling in any given area within the permissible bounds is proportional to the area. The lines at the edge of the square have length but zero area, so even if they're allowed, the selected point will "never" be on the edge. A bit more formally, the chances of a point on an edge being chosen is infinitesimally small and (excepting something massively discontinuous like a delta function) does not affect the integration over the area.
Thank you!
__________________
Reply With Quote
  #72   Spotlight this post!  
Unread 22-07-2016, 11:30
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,028
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Math Quiz 9

Quote:
Originally Posted by z_beeblebrox View Post
2.1e7 iterations yields 0.73511
Close enough

Two billion samples yields a value about 0.003% less than that. Plotting the average vs the number of samples gives a rough view of when you've reached the point of diminishing returns.

Note that this problem can be easily solved using all three methods discussed in this thread:

Monte Carlo simulation

Numerical Integration

Symbolic Integration


Quote:
Originally Posted by z_beeblebrox View Post
standard deviation 0.00095
Standard deviation is not so meaningful when the distribution looks this this.


Attached Thumbnails
Click image for larger version

Name:	Monte Carlo simulation (Delphi).png
Views:	11
Size:	5.2 KB
ID:	20927  Click image for larger version

Name:	numerical integration (Octave).png
Views:	10
Size:	9.8 KB
ID:	20928  Click image for larger version

Name:	symbolic integration (Maxima).png
Views:	13
Size:	22.0 KB
ID:	20929  Click image for larger version

Name:	average vs samples.png
Views:	11
Size:	9.6 KB
ID:	20930  Click image for larger version

Name:	histogram.png
Views:	33
Size:	8.8 KB
ID:	20931  

Reply With Quote
  #73   Spotlight this post!  
Unread 22-07-2016, 14:14
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,570
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Math Quiz 9

Quote:
Originally Posted by Ether View Post
Note that this problem can be easily solved using all three methods discussed in this thread:
Yes, apart from the different piecing together the different lengths, every term in the integrals for this problem appeared in Aren's solution.

Quote:
Originally Posted by Ether View Post
Standard deviation is not so meaningful when the distribution looks this this.
This is a non-sequitur. Z.B. was referring to the standard deviation across groups of samples, not standard deviation across line lengths. However, the graph of the population also suggests that a nominal MonteCarlo solution might do well to treat these as three separate populations, as Ether has done with the integration cases.
  • The "same side" population ramps up from zero, follows a third order polynomial, and goes back to zero at 1.0.
  • The "adjacent side" population ramps up linearly from zero to one, has a kink (continuous value, discontinuous slope), and decays back to zero at the square root of two. As Ether has indicated implicitly, note that this side has to be weighted double the other two, because given the first point, the second point can be on only one "same" side, one "opposite" side, or two "adjacent" sides.
  • The "opposite side" set has no population with length less than unity, 13+% of its values between 1.00 and 1.01, and 39+% of its lengths between 1.0 and 1.1, and the population continues to decay down to the square root of two.

Edit: By decay, I mean that the population curve is concave up as it approaches zero, not necessarily an exponential decay.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 22-07-2016 at 14:18.
Reply With Quote
  #74   Spotlight this post!  
Unread 22-07-2016, 18:42
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,028
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Math Quiz 9


5000 samples of sample size 1,000,000.

Mean of the sample means = 0.735089
Standard Error of the Mean = 0.000361
Attached Thumbnails
Click image for larger version

Name:	Standard Error of the Mean.png
Views:	15
Size:	11.1 KB
ID:	20932  
Reply With Quote
  #75   Spotlight this post!  
Unread 25-07-2016, 12:03
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,570
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Math Quiz 9

OK, another follow-on challenge (cleared with Ether):

What is the average length of all the line segments which can be drawn within the unit circle (1 unit in radius, 2 units in diameter)?

Reps for both the first numeric (good to 1 part per million) and first closed form solution.

Edit: Of course, you must show your work in either case!
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 25-07-2016 at 14:05.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:06.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi