views:

56

answers:

2

I am working on a project to create a generic equation solver... envision this to take the form of 25-30 equations that will be saved in a table- variable names along with the operators.

I would then call this table for solving any equation with a missing variable and it would move operators/ other pieces to the other side of the missing variable

e.g. 2x+ 3y=z and if x were missing variable. I would call equation with values for y and z and it would convert to solve for x=(z-3y)/2

equations could be linear, polynomial, binary(yes/no result)...

i am not sure if i can get any light-weight library available or whether this needs to built from scratch... any pointers or guidance will be appreciated

+1  A: 

See Maxima.

I rather like it for my symbolic computation needs.

Paul Nathan
can you share more detail- do you invoke maxima libraries from your code?
raghu
@raghu: No, I typically directly code in it. It's written in Common Lisp, so with some work you should be able to interface it out to at least stdin/out.
Paul Nathan
A: 

If such a general black-box algorithm could be made accurate, robust and stable, pigs could fly. Solutions can be nonexistent, multiple, parametrized, etc.

Even for linear equations it gets tricky to do it right.

Your best bet is some form of Newton algorithm, but generally you tailor it to your problem at hand.

EDIT: I didn't see you wanted something symbolic, rather than numerical. It's another bag of worms.

Alexandre C.
That would be spelled "tailor". Sorry. :-/
Paul Nathan
ah ok. Fixed. I'm not a native english speaker, but definitely a mathematician... Talyor is much more natural to me than tailor (however rich he be).
Alexandre C.
I guess i haven't explained my need properly- not expecting pigs to fly... at one level, all i need is an ability to store a equation comprising of a few variables, and then be able to solve it, if one variable is missing.The 25-30 equations are NOT a system of equations. I will use only one equation at a time. And error checks made in advance before reaching here.If its still a tough problem, will need to revisit approach... at present, solving it through elaborate process
raghu
For one variable, there are a lot of robust numerical methods. Do you want symbolic or numerical solving of your 1-unknown equation ?
Alexandre C.
Clearly am out of my depths... not sure of difference between symbolic and numerical solving.i would have values for all but the missing element and would somehow have to move operators and variabls to other side of equation. I felt this would be a standard algorithm if I knew where to look- could you pls point me to right direction to look. thanks
raghu
you're asking for a algorithm which could replace mathematicians... I wish there were one! The best you can do is have a list of heuristics and apply them cleverly. This is a very very heavy task and definitely needs some math skills, computer skills and a lot of manpower. Have a look at free packages, like maxima.
Alexandre C.
ok- guess there is more complexity than i can fathom... spoke offline to someone who thinks he has an idea... will update the group if i find something simple and workable. thanks
raghu