google / mathsteps

Step by step math solutions for everyone
https://socratic.org
Apache License 2.0
2.12k stars 275 forks source link

compute a reverse expression #248

Open yboujraf opened 4 years ago

yboujraf commented 4 years ago

Dear @michaelmior , @shreyansb , @hmaurer , @jdolecki , @josdejong

I am looking to compute the reverse on an expression.

Use case :

$ is the output value for example of a sensor and the manufacturer gives us the expr1 as formula to convert the $ to a display value for the user

But when the user wants to interact with the sensor, he needs to translate the display value to an expr2 to be sure the sensor could interpret the value.

That's my example :

The user write the expr1 and the library compute the reverse of the expr1 to expr2 expr1 = 1 + log($, 2) expr2 = 2^($ - 1)

expr1 = sin($ / 7.43) where $ is of type INTEGER expr2 = int(7.43 * asin($))

expr1 = $ - log($ / (e^(-$) * $^sin(1 / $)), 10) expr2 = exercise left to the reader

Thanks in advance if you could help us to find a solution of our issue.

Best Regards Youssef

josdejong commented 4 years ago

For reference, see: https://github.com/josdejong/mathjs/issues/1699. It's not trivial to achive but should be possible at least for a basic set of functions and operators.