August 16, 2009 4:55 AM Subscribe

Ive been tearing my hair out trying to work out a mathematical formula for a sequence of numbers I have. Have a look inside and tell me if you see a pattern.

Im trying to reverse engineer a little section of a computer program, I enter the numbers below and get the result out. I have just written out a sample of different numbers I have entered in. I cannot work out what it is doing, there is obviously some rounding in there which is throwing me off..

0.01->2

0.02->3

0.03->3

0.04->3

0.05->4

0.06->4

0.07->4

0.08->4

0.09->4

0.10->5

0.1->5

0.2->6

0.3->7

0.4->7

0.5->8

0.6->8

0.7->9

0.8->9

0.9->10

1.0->10

1.1->10

1.2->11

1.3->11

1.4->11

1.5->11

1.6->12

1.7->12

1.8->12

1.9->12

2.0->12

3.0->14

4.0->16

10.0->22

100.0->46

1000.00->100

Anyone have any idea?
posted by phyle to Science & Nature (18 answers total) 1 user marked this as a favorite

Im trying to reverse engineer a little section of a computer program, I enter the numbers below and get the result out. I have just written out a sample of different numbers I have entered in. I cannot work out what it is doing, there is obviously some rounding in there which is throwing me off..

0.01->2

0.02->3

0.03->3

0.04->3

0.05->4

0.06->4

0.07->4

0.08->4

0.09->4

0.10->5

0.1->5

0.2->6

0.3->7

0.4->7

0.5->8

0.6->8

0.7->9

0.8->9

0.9->10

1.0->10

1.1->10

1.2->11

1.3->11

1.4->11

1.5->11

1.6->12

1.7->12

1.8->12

1.9->12

2.0->12

3.0->14

4.0->16

10.0->22

100.0->46

1000.00->100

Anyone have any idea?

I think effbot's got it.

posted by billysumday at 5:29 AM on August 16, 2009

posted by billysumday at 5:29 AM on August 16, 2009

Yes that's what I got too. The only one with a rounding error is 2.0>12.

posted by spaghettification at 5:29 AM on August 16, 2009

posted by spaghettification at 5:29 AM on August 16, 2009

Have you tried plotting your data points? That's always one place to start. Looks logarithmic to me.

posted by Blazecock Pileon at 5:31 AM on August 16, 2009

posted by Blazecock Pileon at 5:31 AM on August 16, 2009

A loglog plot will give you a straight line. That means we're looking at a power law.

posted by spaghettification at 5:35 AM on August 16, 2009

If I may suggest something a little bit different: decompile the program. If this is a simple program then even if all of the symbol information is gone is still shouldn't take terribly long to work out. If it is a longer program you can probably narrow down where to look considering the program prints something out on the screen in what seems to be a regular format.

posted by Green With You at 8:26 AM on August 16, 2009

posted by Green With You at 8:26 AM on August 16, 2009

Not a huge help since these are (x, y) pairs rather than a formal sequence {a1, a2, a3, ... }, but for future reference: The On-Line Sequence Database.

posted by ecsh at 8:33 AM on August 16, 2009

posted by ecsh at 8:33 AM on August 16, 2009

Let's see: A018004: Powers of cube root of 10 rounded to nearest integer: 1,

posted by effbot at 8:54 AM on August 16, 2009

An easy way to solve this is to put your sequence into excel, make a scatter plot, then try various regression lines (excel calls them trendlines) until one fits.

In this case 9.93x^0.335 is the closest fit. Assuming integers are rounding down, probably 10x^1/3, as effbot said.

posted by skintension at 9:04 AM on August 16, 2009

In this case 9.93x^0.335 is the closest fit. Assuming integers are rounding down, probably 10x^1/3, as effbot said.

posted by skintension at 9:04 AM on August 16, 2009

That's far from true. 0.8->9, to pick one at random, also has a big rounding error.

Of that order, maybe. There are an infinite number of solutions, though. The only way to decide between them is to know more about the source of the numbers.

posted by DU at 9:24 AM on August 16, 2009

Eh, what? 10*2^1/3 is 9.283.

posted by effbot at 9:57 AM on August 16, 2009

Not only is that wrong (the cube root of 2 is around 1.25, not .9anything), but it also seems to be in response to the wrong comment. ?

Also, 10 * (.8^(1/3)) ~= 7.

As I said, we need to know more about the source of these numbers.

posted by DU at 10:07 AM on August 16, 2009

I was explaining how to find the best fit using Excel. Sorry if that wasn't clear. There are six possible solutions, at least in my version with the default values, of which 9.93x^0.335 is clearly the best fit (well; I left out the last couple extreme values to make the graph easier to read).

posted by skintension at 10:16 AM on August 16, 2009

(Ok, there was a copy and paste error in my earlier post. But 10*(0.8^1/3) is still 9.283.)

posted by effbot at 10:18 AM on August 16, 2009

posted by effbot at 10:18 AM on August 16, 2009

Not sure how I got 7. I think I conflated two problems.

*There are six possible solutions...*

Excel may be giving you 6 possible solutions, but that doesn't necessarily mean much. If the solution involves just a cube root, that might be "the" solution, though. But how do we know the it only involves a cube root? By knowing the context of the problem--which is missing from the question.

posted by DU at 10:24 AM on August 16, 2009

Excel may be giving you 6 possible solutions, but that doesn't necessarily mean much. If the solution involves just a cube root, that might be "the" solution, though. But how do we know the it only involves a cube root? By knowing the context of the problem--which is missing from the question.

posted by DU at 10:24 AM on August 16, 2009

I'm not sure what you're getting at. The guy asked for some clues, Excel is a handy desktop tool to provide them. I'm not implying that Excel solves unsolvable math problems, and **phyle** asked for "any ideas", not a mathematically provable solution. I think his question has been answered.

posted by skintension at 10:49 AM on August 16, 2009

posted by skintension at 10:49 AM on August 16, 2009

Thankyou everyone, I think effbot got it first go! Sorry Ive taken a while to respond, I asked the question and then went off to bed.

Ive gone back and checked 2.0>12 and thats my fault! it is 13, I just wrote the numbers down wrong..

posted by phyle at 3:10 PM on August 16, 2009

Ive gone back and checked 2.0>12 and thats my fault! it is 13, I just wrote the numbers down wrong..

posted by phyle at 3:10 PM on August 16, 2009

This thread is closed to new comments.

posted by effbot at 5:22 AM on August 16, 2009 [1 favorite]