Go to Post Saying that something cannot be done, is always good inspiration for someone to find a way to do it. - Josh Hambright [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #36   Spotlight this post!  
Unread 22-08-2016, 20:35
Aren Siekmeier's Avatar
Aren Siekmeier Aren Siekmeier is offline
on walkabout
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: 대한민국
Posts: 735
Aren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond reputeAren Siekmeier has a reputation beyond repute
Re: Math Quiz 9

Still stuck in my old ways aren't I.

Here's the distribution of endpoints using your sampling procedure.
https://plot.ly/~compwiztobe/9/

Code:
from random import random
from math import pi,cos,sin,sqrt
import numpy

def randseg():
	hl=random()/sqrt(2)
	th=random()*pi
	cx=random()
	cy=random()
	return [cx-hl*cos(th),cx+hl*cos(th),cy-hl*sin(th),cy+hl*sin(th)]

def inbox(seg):
	return(all([x>=0 and x<=1 for x in seg]))

def go(n):
	l=[]
	for i in range(n):
		x=randseg()
		if inbox(x):
			l.append(x)
	return(l)

def pts(l):
	p=[]
	for x in l:
		p.append([x[0],x[2]])
		p.append([x[1],x[3]])
	return(p)

data=pts(go(1000000))

#then bin and plot 2d histrogram with plotly API
Curious about an analytical form, but this at least shows the idea. The way we solved the problem before assumed this plot was all one color.
Reply With Quote
 


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 06:18.

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