![]() |
Re: Math Quiz 9
Quote:
Some warmup questions to this if you can't figure out where to start:
OBTW, with proper scaling, Greg's answer for the 100000-gon of area 1 provides an answer to the original problem good to within 1 part per 10,000: Quote:
Quote:
|
Re: Math Quiz 9
I have posted this figure which I created to describe variables in my calculation of the length of the average line segment from a point on the edge of a circle to a point on the interior. I used this, or a very similar coordinate system, to solve all the "circle questions" except for the one about the mean square of the segments. I am also confident that the same questions can be answered for the sphere using a similar point of view.
|
Re: Math Quiz 9
Quote:
|
Re: Math Quiz 9
0.9525383819936485
Sample size: 60 million |
Re: Math Quiz 9
Quote:
|
Re: Math Quiz 9
Quote:
|
Re: Math Quiz 9
Quote:
|
Re: Math Quiz 9
Quote:
|
Re: Math Quiz 9
Quote:
Given AM's interest, I will hold off until at least Friday at 6pm to post solutions. When posting a candidate solution, please show your work, and specify whether you are solving for:
|
Re: Math Quiz 9
A Monte Carlo simulation written in python and running on my laptop isn't a great solution if 1 part in a million accuracy is required, but since I had essentially already written the program, I figured that I might as well give it a shot. For the average length of line segments in the interior of an r=1 circle, I got 0.9054124568 after 4e10 trials. I'm not certain whether or not this meets the accuracy requirement. I also made minor modifications so that I could simulate the chord problem, and I got 1.2732310914 after 7e09 trials. This problem requires far fewer trials to get an accurate result and I believe this solution meets the accuracy spec. I can post my code if anyone is interested.
|
Re: Math Quiz 9
Quote:
Quote:
|
Re: Math Quiz 9
Quote:
2) Yes, please post your code. edit: 3) What's the period of the PRNG you used? |
Re: Math Quiz 9
Quote:
Quote:
Code:
import numpy as npCode:
import numpy as npQuote:
|
Re: Math Quiz 9
Quote:
|
Re: Math Quiz 9
Greg, try this for the internal points problem: taking advantage of symmetry, generate 2 random points in Quadrant1, then reflect one of the points into Quadrants 2 thru 4 so you get 4 lengths per iteration. Then you can use 4 times fewer iterations. Also, doing this allows you to significantly optimize the code to eliminate a lot of repetitious floating point operations. I think you'll find that approach to be much faster. I was able to get 1 ppm accuracy in 7 minutes of runtime on a 10-year-old Pentium D desktop machine (using 32 bit compiled code). Here's the pseudocode for it: Code:
pio2=pi/2; // initialize constantUsing symmetry for the chords problem, you can reduce the length computation to: Code:
sum += sin(pi*abs(random-random)); |
| All times are GMT -5. The time now is 01:03. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi