# Recipe for solving equations

I am making a script that's solving algebra. I am 16 years old so my script should be able to solve all middle school equations. (Because this is the level I have when it comes to maths. Got the grade: A)

Do anyone have a complete recipe that would apply to all equations?

I've come up with: (I'm from Norway, so the definitions may be a bit odd...)

1. Multiply in powers outside of brackets.
2. Try to sum the terms inside the brackets.
3. Multiply variables, brackets or numbers into a bracket. ($5x(3x+5) = 15x^2+25x$)
4. Remove unnecessary brackets. (Brackets with + or - in front.)
5. Sum all the terms.
6. Sort the terms with $x$s on the left side of the equation sign. The rest on the other side. (Remember to switch negative terms to positive terms and positive terms to negative terms).
7. Sum all the terms again.
8. Divide by eventually numbers multiplied with $x$. ($5x = 25$, divide all the terms with $5$ to get $x=5$).

Do you have a recipe that works for every equation you get in middle school, so that I can interpret that into my script?

Thanks! :D

-
will your method work for quadratics? –  tom Nov 20 '11 at 13:31
#4 requires dynamic programming; –  Quixotic Nov 20 '11 at 13:39
Symbolic computation can solve most of the equations given in middle school. However, some things cannot be computed, such as the probability that a random Turing machine will stop. en.wikipedia.org/wiki/Algebraic_algorithms computeralgebra.nl/systemsoverview/special/systems.html –  Angela Richardson Nov 20 '11 at 14:09
It should work for all equations you can find in a middle school math book. I can do the programming here, the question is the mathematics. I want to make a script that do everything like a human would have done it. This is because I want it to show the steps for solving the equation. –  Friend of Kim Nov 20 '11 at 14:43
I have no idea what "middle school equations" are, can you write a formal grammar that covers the problems you want to solve? –  user16697 Nov 20 '11 at 16:46