jimrandomh comments on Automatic programming, an example - Less Wrong

12 Post author: Thomas 01 February 2012 08:55PM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (32)

You are viewing a single comment's thread. Show more comments above.

Comment author: jimrandomh 02 February 2012 02:03:55AM 28 points [-]

The three problems with the code are that the variable names are all lies, there's a bunch of redundant rescaling which isn't consolidated because it's done in integer math when it should be floating point, and there are a couple bits of overfitting (bitwise operators) that don't belong. If you convert to SSA and wipe out the misleading names, you get:

a1 = perihelion+aphelion Real
a2 = a1+a1 Rescaling
a3 = a2+a2 Rescaling
g1 = 12 Rescaling
a4 = a3>>g1 Rescaling
t1 = a4/g1 Rescaling
a5 = a4-t1 Rescaling
d1 = sqrt(a5) Real
a6 = g1|a5 Overfit
a7 = a6*d1 Real
a8 = g1^a7 Overfit
guess = a8/g1 Rescaling

If you replace the overfitting with pass-throughs (a6=a5, a8=a7), then pretend it's floating point so that you can consolidate all the rescaling into a single multiplicative constant, you get

guess = k * (perihelion+aphelion)*sqrt(perihelion+aphelion)

Which is Kepler's third law.