问题描述
我正在构建一种基于Web的编程语言,部分受到Prolog和Haskell的启发(不要笑)。
I'm building a web-based programming language partially inspired by Prolog and Haskell (don't laugh).
它已经具有很多功能,您可以在。您可以在中查看源代码,并在。请记住,这是一个原型。
It already has quite a bit of functionality, you can check out the prototype at http://www.lastcalc.com/. You can see the source here and read about the architecture here. Remember it's a prototype.
当前,LastCalc无法简化表达式或求解方程式。除了使用Java对其进行硬编码之外,我还想增强基本语言,以便可以扩展该语言以使用这些语言本身(例如Prolog)来完成这些事情。与Prolog不同,LastCalc具有更强大的搜索算法,Prolog是具有回溯功能的深度优先搜索,LastCalc当前使用启发式最佳优先搜索。
Currently LastCalc cannot simplify expressions or solve equations. Rather than hard-coding this in Java, I would like to enhance the fundamental language such that it can be extended to do these things using nothing but the language itself (as with Prolog). Unlike Prolog, LastCalc has a more powerful search algorithm, Prolog is "depth-first search with backtracking", LastCalc currently uses a heuristic best-first search.
我想更多地了解其他系统如何解决此问题,尤其是Mathematica / Wolfram Alpha。
Before delving into this I want to understand more about how other systems solve this problem, particularly Mathematica / Wolfram Alpha.
我认为,至少在一般情况下,您的想法是给系统提供一堆规则来处理方程式(例如 a *(b + c)= a * b + a + c
)指定目标(例如,隔离变量x)然后放开。
I assume the idea, at least in the general case, is that you give the system a bunch of rules for manipulation of equations (like a*(b+c) = a*b + a+c
) specify the goal (eg. isolate variable x) and then let it loose.
所以,我的问题是:
- 我的假设正确吗?
- 应用规则的搜索策略是什么?例如。深度优先,宽度优先,深度优先,迭代加深,某种最佳优先?
- 如果它是最佳优先,则使用什么启发式方法来确定某个特定对象是否可能规则申请使我们更接近我们的目标了吗?
我还要感谢其他建议(放弃除外-我经常忽略该建议,这样做对我很有帮助;)。
I'd also appreciate any other advice (except for "give up" - I regularly ignore that piece of advice and doing so has served me well ;).
推荐答案
我前段时间亲自处理过此类问题。然后,我发现有关表达式的简化。它的标题是基于规则的表达式简化,并显示了有关Mupad中简化的一些细节,后来该Mupad成为了Matlab的一部分。
I dealt with such questions myself some time ago. I then found this document about simplification of expressions. It is titled Rule-based Simplification of Expressions and shows some details about simplification in Mupad, which later became a part of Matlab.
这个文件,您的假设是正确的。有一组用于操纵表达式的规则。启发式质量度量用作简化的目标函数。
According to this document, your assumption is correct. There is a set of rules for manipulation of expressions. A heuristic quality metric is is used as a target function for simplification.
这篇关于Wolfram Alpha或Mathematica之类的系统如何求解方程式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!