Lua Algebra Solver help?
Posted: February 13th, 2015, 3:12 pm
I would like to create a lua script in a rainmeter skin that would solve an equation such as x^2+3x=-2 or 3x+5=14 or even more complex (but still simple algebra (including trigonometric functions such as cos, sin, and tan)) equations. The only problem is, I have no idea how to do this.
My only idea so far is to create something that checks how long the input string is, then creates a two dimensional matrix that keeps track of what kind of character each one is, as well as important things such as if it is inside parenthesis or not (I would like support for distributive property), and then decides the first step to get x by itself on one side of the =. It would then change the string, and re-evaluate until it got to a simple x=#.
I would love feedback on if this method is even feasible, and any ideas would be much appreciated!
Thanks in advance to anyone who helps!
My only idea so far is to create something that checks how long the input string is, then creates a two dimensional matrix that keeps track of what kind of character each one is, as well as important things such as if it is inside parenthesis or not (I would like support for distributive property), and then decides the first step to get x by itself on one side of the =. It would then change the string, and re-evaluate until it got to a simple x=#.
I would love feedback on if this method is even feasible, and any ideas would be much appreciated!
Thanks in advance to anyone who helps!