I need a way to randomise an input math equation (mainly their coefficients).
So for example "x+y-ze^5" could be randomized into "x-y+2ze^4" or "2x+y-3z*e^4".
I am doing this in rails at the moment, and one of the main issues I have is that I can only store equations in strings rather than a math object. How do I do this? Is there any gems or API's I can use? I would also need to use this with Latex input equations. I have used latex API's but I have only found ones that can display equations, not those that turn strings into usable and modifiable math equations.
For example if I input "x+y+z", it should get randomized into "x-y+2ze^4".
Similarly if I give it "x'+sin(x/2)-Integral(xdx)", it could get randomized into "2x'-sin(x/4)-Integral(2xdx)". The idea here the function can take any equation I give it and randomise it's coefficients.