Little math problem(s) January 2019

01262019, 10:19 PM
Post: #1




Little math problem(s) January 2019
You got a superpower (well, you or you have a computer with a good math library).
If you know the formula or model to be computed, you can compute it approximating the numerical answer with a maximum of 20% relative error. It seems at the end that you are not very precise (for some value of "precise"), but can you somehow use this superpower and get even more accurate answers? Wikis are great, Contribute :) 

01272019, 02:26 AM
Post: #2




RE: Little math problem(s) January 2019
Would it be allowed to calculate the answer 1 million times and take the median?
17bii  32s  32sii  41c  41cv  41cx  42s  48g  48g+  48gx  50g  30b 

01272019, 10:16 AM
Post: #3




RE: Little math problem(s) January 2019
Interesting idea yours!
Two cases.  In the case of the answer is not always the same, it takes just a long time (spelling out the answer takes time, times one million times)  Second, case, more challenging. You return the same answer given the same input. Wikis are great, Contribute :) 

01272019, 03:28 PM
Post: #4




RE: Little math problem(s) January 2019
In the case where the model was both slow and not precise, I would discard the model and do something else.
In the second case, where the errors are completely deterministic (but not precise), would it be safe to assume the underlying function is differentiable, and rather than look for variations in the output, one could change the input over successive trials, and use the information learned from that to refine the numeric estimate? I can't imagine a real world modeling case where either of these two cases would come up. I could be misunderstanding the question? 17bii  32s  32sii  41c  41cv  41cx  42s  48g  48g+  48gx  50g  30b 

01272019, 04:26 PM
(This post was last modified: 01272019 04:28 PM by pier4r.)
Post: #5




RE: Little math problem(s) January 2019
Quote:I can't imagine a real world modeling case where either of these two cases would come up. I could be misunderstanding the question?It is an hypothetical. Especially in math it shouldn't be something new. It is not a real world application. About "the model could be slow", it is because if you are the guy with the superpower, spelling out (or writing down) the answer literally takes time, although you have it in your mind immediately. Therefore doing it one million times is exhausting a bit. (01272019 03:28 PM)Allen Wrote: In the second case, where the errors are completely deterministic (but not precise), would it be safe to assume the underlying function is differentiable, and rather than look for variations in the output, one could change the input over successive trials, and use the information learned from that to refine the numeric estimate? We couldn't always ensure it is differentiable, but the idea is on the right track. You can get more precision varying the input over iterations. Wikis are great, Contribute :) 

01282019, 01:53 AM
(This post was last modified: 01282019 12:46 PM by Paul Dale.)
Post: #6




RE: Little math problem(s) January 2019
As the function approaches zero, the relative error will become controllable.
Given the function F(x), make an estimate ϕ. Due to the relative error, ϕ lies between 0.8 F(x) and 1.2 F(x). i.e. F(x)  ϕ ⩽ 0.2 F(x). Now, take the function G(x) = F(x)  ϕ. Make an estimate of this function ζ. Again, G(x)  ζ ⩽ 0.2 G(x). This means F(x)  (ϕ  ζ) ⩽ 0.04 F(x). Repeat. Pauli 

01282019, 12:12 PM
Post: #7




RE: Little math problem(s) January 2019
Yes indeed.
When I saw it the first time (as someone commented on the problem "If I can approximate with an error of 20%, I will know the answer as precise as I want") I was like "wha?" and then "oh, well done". Wikis are great, Contribute :) 

01282019, 09:59 PM
Post: #8




RE: Little math problem(s) January 2019
Hi: (01272019 02:26 AM)Allen Wrote: Would it be allowed to calculate the answer 1 million times and take the median? This ^ It works perfectly and requires no clever thought or sophistication whatsoever, simply perform N independent calculations (each with a maximum relative error of 20%), then simply output the mean: probabilistically, the error will be reduced by a factor of Sqr(N) and so will tend to zero as N tends to infinity As proofofconcept, simply run this short HP71B BASIC code snippet: (Sin(1) can be replaced by any other value or formula) 1 DESTROY ALL @ RANDOMIZE 1 @ T=SIN(1) @ FOR K=1 TO 6 @ N=10^K 2 S=0 @ FOR I=1 TO N @ S=S+T*(.8+.4*RND) @ NEXT I 3 DISP USING "8D,3(2X,Z.6D)";N;S/N;T;ABS(S/NT) @ NEXT K > RUN N Mean Exact Abs(error)  10 0.867936 0.841471 0.026465 100 0.832384 0.841471 0.009087 1000 0.838462 0.841471 0.003009 10000 0.840485 0.841471 0.000986 100000 0.841524 0.841471 0.000053 1000000 0.841477 0.841471 0.000006 As can be seen, the error diminishes steadily as N goes from 10 to one million evaluations by a factor of approximately Sqr(10) = 3.16+ as N increases tenfold, and you eventually get about 5 correct digits, a relative error reduction from the initial 0.2 (20%) for a single evaluation to 0.0000006 (0.0006%) for the average of one million evaluations. Regards. V. 

01282019, 11:03 PM
Post: #9




RE: Little math problem(s) January 2019
(01282019 01:53 AM)Paul Dale Wrote: As the function approaches zero, the relative error will become controllable. Here's an HP42S program that uses this idea to calculate \(sin(1)\approx8.41470984808e1\): Code: 00 { 20Byte Prgm } Make sure to use RAD mode. Example: 0 R/S 8.13930075171e1 R/S 8.37292640515e1 R/S 8.41890339484e1 R/S 8.41404810797e1 R/S 8.41460042846e1 R/S 8.41472832565e1 R/S 8.41470715347e1 R/S 8.41470956453e1 R/S 8.41470980231e1 R/S 8.41470985454e1 R/S 8.41470984835e1 R/S 8.41470984811e1 R/S 8.41470984808e1 R/S 8.41470984808e1 … Cheers Thomas 

02042019, 03:15 PM
Post: #10




RE: Little math problem(s) January 2019
(01272019 02:26 AM)Allen Wrote: Would it be allowed to calculate the answer 1 million times and take the median? Actually I didn't see that one could expand the initial numerical problem to consider the median of it. Therefore obtaining the answer relatively quickly according to the superpower. Still I am not sure whether the second approach that Paul is getting a precise enough answer with less effort. I didn't dive in it. Wikis are great, Contribute :) 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)