Expression Simplification Algorithm

半世苍凉 提交于 2019-12-06 12:13:26

Yes. What you likely want is a computer algebra system, which understands formulas as artifacts to be manipulated by explicit mathematics rules.

Mathematica and Macsyma are applications which do this. However, these are quite sophisticated systems and it is not easy to see how they "work".

What you need to do is:

  • Represent formulas as abstract syntax trees
  • Parse text formulas (your example equations) into such trees
  • Encode a set of tree-manipulation rules that represent algebra operations
  • Apply these rules to your algebra trees
  • Prettyprint the algebra trees back as text when done

Rules are best written in the surface syntax of algebra. (Mathematica doesn't do this; it represents formulas as trees using a kind of prefix S-expressions, and rules as the same kind of trees with special variable nodes).

One of the issues is deciding how many "algebra" rules you are wiling to encode. Mathematics is a lot more than pure 9th grade algebra, and people using such systems tend to want to extend what is there by adding more knowledge (the point of Mathematica and Macsyma: they are infinitely extendable).

Here's a very simple version of this. You can see all the "gears" and how things are described, in terms of parse trees and rewrite rules.

http://www.semdesigns.com/products/DMS/SimpleDMSDomainExample.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!