Strategies for simplifying math expressions

前端 未结 6 1714
醉梦人生
醉梦人生 2020-11-27 10:28

I have a well-formed tree that represents a mathematical expression. For example, given the string: \"1+2-3*4/5\", this gets parsed into:

subtr         


        
6条回答
  •  春和景丽
    2020-11-27 11:05

    You're wanting to build a CAS (compute algebra system) and the topic is so wide that there is an entire field of study dedicated to it. Which means there are a few books that will probably answer your question better than SO.

    I know some systems build trees that reduce constants first and then put the tree into a normalized form and then use a large database of proven/known formulas to transform the problem into some other form.

提交回复
热议问题