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...)
- Multiply in powers outside of brackets.
- Try to sum the terms inside the brackets.
- Multiply variables, brackets or numbers into a bracket. ($5x(3x+5) = 15x^2+25x$)
- Remove unnecessary brackets. (Brackets with + or - in front.)
- Sum all the terms.
- 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).
- Sum all the terms again.
- 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?