The Forum > Math & Science > Math Problem Thread
Dangit, I forgot this one thing for triangles. Can't find it online. So, in triangles is it the longest side that is opposite the largest measure of an angle. Like if the vertex is 66, and the other two angles are 50 and 64 the longest side would be the one opposite of the 66. (I'm pretty sure that's how it is, seeing as the hypotenuse on a right triangle is longest, but the side looks so much smaller than than the other two.) |
These review packets I'm getting seem to be messed up... Alright, so the questions says that there is a regular octagon. It's asking for the perimeter, two of the sides are 14-x and x+6. Because of that the perimeter should be 32ft right? However the only options provided are 4, 40, 8 and 80. Am I doing something wrong or does the paper just not have the right option? |
Hydrogen777 said: Solving that directly looks like a real headache. I'd probably just carry out the algorithm a few hundred thousand (or some other large number) times and estimate the variance from the data I collected. Now you made me feel like writing a short hack to do the Monte Carlo simulation...only issue is that at 100k there's more than the allotted variance between trials, and at 1 mil it takes too long, at least for my Python hack. Might need to go try with OpenCL... |
Hydrogen777 said: I tried it with C++, and 1,000,000 trials completes in just a few seconds. Though something's wrong with my analysis, and I keep getting the wrong answer. >_> Well, yeah, C++ will be much faster. If I were serious about getting speed, I'd use C#, likely. But Python is fun to play with, especially since pyopencl is apparently a thing. |
I take it back. My answer is correct; I just don't have nearly enough digits of precision. And trying to run my program for N = 500,000,000 just made it crash after 40% completion. Maybe I'll split the difference and try something on the order of 50,000,000. This is indeed an ideal task for parallel processing though. |
Hydrogen777 said: I take it back. My answer is correct; I just don't have nearly enough digits of precision. And trying to run my program for N = 500,000,000 just made it crash after 40% completion. Maybe I'll split the difference and try something on the order of 50,000,000. This is indeed an ideal task for parallel processing though. Eh, there are some issues with a parallel processing implementation. Each process needs a place to store its results. You could either allocate a large array for them to put their results in, one per process, or have a lock and have them update it in mutex format. The former needs to be aggregated in serial afterwards, and the latter reduces a segment of the problem to serial execution, assuming all processes handle their tasks in the same amount of time, which of course they don't, but it will hinder them. Something such as ray-tracing where the array *is* the final form for the data is more ideal, imho. Edit: Huh, CS seems to have jacked the Math Problem thread. I have no issues with that. Edit 2: Also, I'm pretty sure that a properly coded algorithm could find the exact answer handily without taking forever. I'm just too lazy to work on it. |
In my brief experience with the problem, memory does not appear to be especially critical. And once the data set is generated, the task of actually performing statistical analysis on it appears to be very small in comparison with the first task. So the first option would probably work just fine (because the serial part is so much faster than the parallel part). |
The Forum > Math & Science > Math Problem Thread
