Formula transform
-
Are there any algorithms or source codes could transforms formulas like these: from: a=b*(c-d) to: c=a/b-d or b=a/(c-d)
Hi ! Well, the usual way is to parse the string to create a tree, with parameters as leaves (* + / =) and standard operations as nodes, such as : * / \ b - which is equal to a / \ c d and with some recursive operations, reverse the tree to get c. That´s less complicated that it seems, but requires a little bit time for debugging =) RaGe
-
Hi ! Well, the usual way is to parse the string to create a tree, with parameters as leaves (* + / =) and standard operations as nodes, such as : * / \ b - which is equal to a / \ c d and with some recursive operations, reverse the tree to get c. That´s less complicated that it seems, but requires a little bit time for debugging =) RaGe
-
I actually coded such a thing a couple of years ago, but i do not have the source anymore (that was a project at school), sorry. RaGe Unfortunately, brute-force solutions tend to be slow even when performed by modern-day microcomputers, which are capable of several MIPS except when I'm late for an appointment and want to finish a compile and run just one more test before I leave, in which case the crystal in my computer is apparently designed to automatically revert to 1 Hz. -- Michael Abrash