mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2019-12-18, 21:59   #23
what
 
Dec 2019
Kansas

24 Posts
Default

I got mse of 8.27604×10^-6 (12 times better)
Attached Thumbnails
Click image for larger version

Name:	plot.png
Views:	151
Size:	60.5 KB
ID:	21451  

Last fiddled with by what on 2019-12-18 at 22:52
what is offline   Reply With Quote
Old 2019-12-24, 09:02   #24
dg211
 
Jun 2016

3 Posts
Default Brackets

I think there was some discussion earlier about whether expressions would be allowed which used brackets in such a way that they have subexpressions that can't be evaluated in a single pass without storing intermediate results.

Could one of the people who has had a solution accepted please confirm whether an expression like (x - 1) * (x + 2) would be allowed for example?
dg211 is offline   Reply With Quote
Old 2019-12-25, 00:23   #25
SmartMersenne
 
Sep 2017

7×11 Posts
Default

Quote:
Originally Posted by dg211 View Post
I think there was some discussion earlier about whether expressions would be allowed which used brackets in such a way that they have subexpressions that can't be evaluated in a single pass without storing intermediate results.

Could one of the people who has had a solution accepted please confirm whether an expression like (x - 1) * (x + 2) would be allowed for example?
The point was not to store the results but saving operations by substitution. For example:

x*x*x*x*x*x*x*x requires 7 operations, but you can do it using only 3 operations if you were allowed to save and substitute the results:

y = x*x
z = y*y
z*z

so z would be x*x*x*x and z*z would give the x*x*x*x*x*x*x*x

In your case you can do it in 3 operations in any case, by finding the subexpressions and mutliply them or

x*x+x-2

or

(1+x)*x - 2

In computer language: keeping the intermediate results in registers is allowed, but you can't assign them to variables and reuse them later.
SmartMersenne is offline   Reply With Quote
Old 2019-12-25, 01:10   #26
what
 
Dec 2019
Kansas

24 Posts
Default

I wonder how someone got an error of only 1.803E-7. The best I have managed is 2.9E-6, and I can't think of anything to decrease it.

Last fiddled with by what on 2019-12-25 at 02:04
what is offline   Reply With Quote
Old 2019-12-25, 03:26   #27
Dieter
 
Oct 2017

1318 Posts
Default

Quote:
Originally Posted by SmartMersenne View Post
The point was not to store the results but saving operations by substitution. For example:

x*x*x*x*x*x*x*x requires 7 operations, but you can do it using only 3 operations if you were allowed to save and substitute the results:

y = x*x
z = y*y
z*z

so z would be x*x*x*x and z*z would give the x*x*x*x*x*x*x*x

In your case you can do it in 3 operations in any case, by finding the subexpressions and mutliply them or

x*x+x-2

or

(1+x)*x - 2

In computer language: keeping the intermediate results in registers is allowed, but you can't assign them to variables and reuse them later.
That‘s right. I have asked the puzzlemaster (9.12.):

„Is it allowed to write for example

y=x*x (one operation) and f =(a*y+b)*y+... (the other operations),

or have all 15 operations to be in the same expression?“

The answer was:

You can not define new variables.
Dieter is offline   Reply With Quote
Old 2019-12-25, 03:57   #28
Dieter
 
Oct 2017

89 Posts
Default

Quote:
Originally Posted by SmartMersenne View Post
The point was not to store the results but saving operations by substitution. For example:

x*x*x*x*x*x*x*x requires 7 operations, but you can do it using only 3 operations if you were allowed to save and substitute the results:

y = x*x
z = y*y
z*z

so z would be x*x*x*x and z*z would give the x*x*x*x*x*x*x*x

In your case you can do it in 3 operations in any case, by finding the subexpressions and mutliply them or

x*x+x-2

or

(1+x)*x - 2

In computer language: keeping the intermediate results in registers is allowed, but you can't assign them to variables and reuse them later.
In computer language: keeping the intermediate results in registers is allowed, but you can't assign them to variables and reuse them later.

You will say: in ONE Register.

Otherwise I could write:

movsd xmm1,x
mulsd xmm1,x (x*x in xmm1)

movsd xmm0,a
mulsd xmm0,xmm1
addsd xmm0,b (a*x*x+b in xmm0)
mulsd xmm0,xmm1
addsd xmm0,c ((a*x*x+b)*x*x+c in xmm0)

and so on. I think that this is not allowed.
Dieter is offline   Reply With Quote
Old 2019-12-25, 10:25   #29
SmartMersenne
 
Sep 2017

7×11 Posts
Default

Quote:
Originally Posted by Dieter View Post
In computer language: keeping the intermediate results in registers is allowed, but you can't assign them to variables and reuse them later.

You will say: in ONE Register.

Otherwise I could write:

movsd xmm1,x
mulsd xmm1,x (x*x in xmm1)

movsd xmm0,a
mulsd xmm0,xmm1
addsd xmm0,b (a*x*x+b in xmm0)
mulsd xmm0,xmm1
addsd xmm0,c ((a*x*x+b)*x*x+c in xmm0)

and so on. I think that this is not allowed.
Well, this is practically assigning it to a new variable and re-using it.
SmartMersenne is offline   Reply With Quote
Old 2019-12-26, 05:21   #30
SmartMersenne
 
Sep 2017

7×11 Posts
Default

Quote:
Originally Posted by what View Post
I wonder how someone got an error of only 1.803E-7. The best I have managed is 2.9E-6, and I can't think of anything to decrease it.
It may be a bug in their integral computation
SmartMersenne is offline   Reply With Quote
Old 2019-12-26, 14:36   #31
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

23×3×5×29 Posts
Default

I note that they corrected the MSE for their example from .125 to 1/6.

I fault the statement of the problem, in that it did not specify the type(s) of constants that were acceptable. I guessed that decimal fractions were OK since the MSE bound and the original, incorrect MSE value for the example were stated as such.

I note that they also changed the criteria for "bonus" asterisk(s). In the original statement of the problem, they referred to "elegant" solutions. In the current incarnation, they refer to smallest MSE to date.
Dr Sardonicus is offline   Reply With Quote
Old 2019-12-26, 21:24   #32
what
 
Dec 2019
Kansas

24 Posts
Default

Quote:
Originally Posted by SmartMersenne View Post
It may be a bug in their integral computation
Might just be
what is offline   Reply With Quote
Old 2019-12-27, 20:51   #33
what
 
Dec 2019
Kansas

24 Posts
Default

I only managed to get the 1.803E-7 MSE after using 21 operations. I wonder what I'm missing
what is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
December 2018 Xyzzy Puzzles 6 2019-01-06 23:07
December 2017 Batalov Puzzles 4 2018-01-04 04:33
December 2016 Xyzzy Puzzles 11 2017-01-24 12:27
December 2015 Xyzzy Puzzles 15 2016-01-06 10:23
December 2014 Xyzzy Puzzles 13 2015-01-02 19:41

All times are UTC. The time now is 20:52.

Sun Sep 27 20:52:31 UTC 2020 up 17 days, 18:03, 0 users, load averages: 1.25, 1.42, 1.56

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.