Results 1 to 10 of 19
Hiya,
Does anyone know how to solve this:
We input 2 numbers (EDIT: See my later post) into an unspecified algorithm, and get an answer. We know the 2 numbers ...
- 11-17-2005 #1Linux Guru
- Join Date
- Apr 2003
- Location
- London, UK
- Posts
- 3,284
Anyone good at math? - Reverse engineer an algorithm
Hiya,
Does anyone know how to solve this:
We input 2 numbers (EDIT: See my later post) into an unspecified algorithm, and get an answer. We know the 2 numbers we put in, and we know the answer. What we need to do is find the algorithm used to generate the answer.
I've got 3 examples:
IN: 847 & 3240
OUT: 12,851
IN: 1360 & 4590
OUT: 17,787
IN: 313 & 1000
OUT: 5,034
How do I work out what the algorithm is?
I've tried googling a few things as well, but I guess my terminology might be wrong... If anyone can find any links on how to solve these type of problems it would be much appriciated.
A BIG BIG thanks in advance to anyone who can help with this.
Ta,
J.
edited: spelling
- 11-17-2005 #2Linux Newbie
- Join Date
- Jun 2005
- Posts
- 123
There's an infinite amount of functions to give a value given two values, given that that we have 3 data points.
Assuming this isn't overly complex (i.e. it just has a few plus, subtract, multiply and divide) it shouldn't be that difficult, I'll work on it when I get in.
- 11-17-2005 #3
Now now, Jason. We can't do your homework for you, it's in the rules.
Registered Linux user #270181
TechieMoe's Tech Rants
- 11-17-2005 #4
What's the context for the question Jason? It might give a clue to the answer.
Actually my maths isn't very good, but the first one got me going. Eg.:
847 + 3240 = 4087
4087*3.142 = 12841
12841 + 10 = 12851
Hmmmmm, am I seeing things or what? It doesn't work for the others.
I am always doing that which I can not do, in order that I may learn how to do it. - Pablo Picasso
- 11-17-2005 #5Linux Guru
- Join Date
- Apr 2003
- Location
- London, UK
- Posts
- 3,284
It is actually a bit more complex than I first described... there are 3 in values, not 2. I missed the 3rd off by accident, sorry.
--------------------
IN: 6 & 847 & 3,240
OUT: 12,851
IN: 6 & 1,360 & 4,590
OUT: 17,787
IN: 5 & 313 & 1,000
OUT: 5,034
--------------------
The good news:
- All of the in values will always be whole numbers >= 0 (ie, the algorithm does not have to account for negative's).
- There is no randomization in the algorithm; the same in values will always produce the same out value.
- I can get hold of more example data if needed, if anyone want's it send an email to mail@jasonlambert.co.uk or PM me here.
context - sorry I can't disclose it
homework - ha, they never taught us anything this complex at school
I wish they had 
Once again, thanks to anyone who can help solve this
J.
- 11-17-2005 #6
- 11-17-2005 #7Just Joined!
- Join Date
- Jun 2005
- Location
- Canada, Halifax
- Posts
- 86
As TomX pointed out, without additional boundary conditions there are an infinite set of equations that can solve the problem. Here is a trivial solution that _PROBABLY_ will not suit your purposes. It is a simple polynomial model:
given the set of boundary conditions, X's inputs and Y's outputs:
[ X11 X12 ... X1n | Y1 ]
[ X21 X22 ... X2n | Y2 ]
[... ]
[ Xm1 Xm2 ... Xmn | Ym ]
1. Sum your inputs such that:
Z1 = X11 + X12 + ... + X1n
Z2 = X21 + X22 + ... + X2n
...
Zm = Xm1 + Xm2 + ... + Xmn
2. Form a system of linear equations:
A Z1^(n-1) + B Z1 ^(n-2) + ... = Y1
A Z2^(n-1) + B Z2 ^(n-2) + ... = Y2
...
A Zm1^(n-1) + B Z2 ^(n-2) + ... = Ym
3. Solve the system uning any common technique (first year linear algebra course) for the coefficients A,B,C, etc.
As I mentioned earlier this is a particular solution to an infinite family of problems and this technique makes _MANY_ assumptions. Without further information any less general of a solution is not possible.
BTW: I'm not a mathematician and cannot prove the assertion presented in the preceding statement!
- 11-17-2005 #8Linux Enthusiast
- Join Date
- Aug 2005
- Posts
- 542
Somebody's being hypocritical... we aren't allowed to assist with homework here...
So it's okay when Jason does it, but not when anybody else does it...
What political corruption...
- 11-17-2005 #9Linux Guru
- Join Date
- Apr 2003
- Location
- London, UK
- Posts
- 3,284
davebardsley, thanks, i'll look into that.
chopin1810, as I have already stated this is not a homework question
- 11-18-2005 #10
This sounds like a classic learning algorythm problem. I am by no means any good at using them, much less understanding them, but you could take a look into neural networks, and other simpler or even more complex learning algorithms. All learning algorythms are written to try deduce the value of an output when given only inputs. More complex algorythms can solve multimensional problems by giving a specific "weight" to each element. This sums up just about all i know, so good luck, and i hope this will help you more than confuse you.


Reply With Quote
