algorithmalgebra

Algorithm(s) for rearranging simple symbolic algebraic expressions


I would like to know if there is a straightforward algorithm for rearranging simple symbolic algebraic expressions. Ideally I would like to be able to rewrite any such expression with one variable alone on the left hand side. For example, given the input:

m = (x + y) / 2

... I would like to be able to ask about x in terms of m and y, or y in terms of x and m, and get these:

x = 2*m - y
y = 2*m - x

Of course we've all done this algorithm on paper for years. But I was wondering if there was a name for it. It seems simple enough but if somebody has already cataloged the various "gotchas" it would make life easier.

For my purposes I won't need it to handle quadratics.

(And yes, CAS systems do this, and yes I know I could just use them as a library. I would like to avoid such a dependency in my application. I really would just like to know if there are named algorithms for approaching this problem.)


Solution

  • What you want is equation solving algorithm(s). But i bet that this is huge topic. In general case, there may be:

    Hard answer is - your best bet is to take source code of some CAS,- for example you can take a look at MAXIMA CAS source code which is written in LISP. And find code which is responsible for equation solving.

    Easy answer - if all that you need is solving equation which is linear and is composed only from basic operators +-*/. Then you know answer already - use old good paper method - think of what rules we used on paper, and just re-write these rules as symbolic algorithm which manipulates equation string.

    good luck !