Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux HostsFree MagazinesJobs
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > The Community > The Coffee Lounge
Reload this Page Anyone good at math? - Reverse engineer an algorithm
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

The Coffee Lounge General chat about anything that goes, a good place to introduce yourself and say hi, tell a Joke, or just relax.

Site Navigation
Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 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
jasonlambert is offline   Reply With Quote
Old 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.
TomX is offline   Reply With Quote
Old 11-17-2005   #3 (permalink)
Super Moderator
 
techieMoe's Avatar
 
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.
__________________
Registered Linux user #270181
TechieMoe's Tech Rants
techieMoe is offline   Reply With Quote
Old 11-17-2005   #4 (permalink)
Linux Guru
 
fingal's Avatar
 
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
fingal is offline   Reply With Quote
Old 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.
jasonlambert is offline   Reply With Quote
Old 11-17-2005   #6 (permalink)
Linux Enthusiast
 
carlosponti's Avatar
 
Join Date: Dec 2004
Location: Oklahoma
Posts: 556
Send a message via AIM to carlosponti Send a message via MSN to carlosponti Send a message via Yahoo to carlosponti
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
carlosponti is offline   Reply With Quote
Old 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
davebardsley is offline   Reply With Quote
Old 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...
chopin1810 is offline   Reply With Quote
Old 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
jasonlambert is offline   Reply With Quote
Old 11-18-2005   #10 (permalink)
Linux User
 
Tommaso's Avatar
 
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.
Tommaso is offline   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Job Search
keyword location
Post a Job »
job title, keywords or company
city, state or zip jobs by job search

Free Magazines
Free eBook:"Vulnerability Management for Dummies"
Get all the Facts and See How to Implement a Successful Vulnerability Management Program.
subscribe
Google vs The World: The Battle of the Message Security Vendors
With such a powerful name behind it, Google Message Security stands out in a sea of products that do exactly the same thing - or so they say. So when it comes right down to it, how does the Google selection stack up against the rest of messaging security's big guns?
subscribe
The Enterprise Newsweekly
eWeek is the essential technology information source for builders of e-business.
subscribe
Oracle Magazine
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe
Total Telecom
Total Telecom is "The Economist of the communications industry".
subscribe
More free magazines »



All times are GMT. The time now is 01:41 PM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.2.0