| |  | |
11-17-2005
|
#1 (permalink)
| | Linux 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
|
#2 (permalink)
| | Linux 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 (permalink)
| | Super Moderator
Join Date: Aug 2004 Location: Texas
Posts: 8,749
| Now now, Jason. We can't do your homework for you, it's in the rules.  |
| |
11-17-2005
|
#4 (permalink)
| | Linux Guru
Join Date: Jul 2003 Location: Birmingham - UK
Posts: 1,533
| 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
|
#5 (permalink)
| | Linux 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 (permalink)
| | Linux Enthusiast
Join Date: Dec 2004 Location: Oklahoma
Posts: 556
| Quote: |
Originally Posted by jasonlambert context - sorry I can't disclose it | will you have to kill us if you do tell us 
__________________ Blog Registered Linux user 396557 |
| |
11-17-2005
|
#7 (permalink)
| | Just 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!
__________________
Engineering is the art of making what you
want from things you can get - Jerry Avins
Registered Linux User #395804
|
| |
11-17-2005
|
#8 (permalink)
| | Linux Enthusiast
Join Date: Aug 2005
Posts: 541
| 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
|
#9 (permalink)
| | Linux 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 (permalink)
| | Linux User
Join Date: Oct 2005
Posts: 292
| 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. |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | Job Search | | | All times are GMT. The time now is 01:41 PM. |
| |