1

我想制作一个程序,当给定一个公式时,它可以操纵公式以使任何值(或者在同时公式的情况下,一个共同值)成为公式的主题。

例如,如果给出:

a + b = c
d + b = c

因此,程序应该说:

b = c - a, d = c - b    etc.

当我将原始公式作为输入时,我不确定java是否可以自动执行此操作。我对求解方程并获得每个变量的结果并不感兴趣,我只是对返回一个操纵公式感兴趣。

请让我知道我是否需要为此制定算法,如果需要,我将如何去做。另外,如果您可能有任何有用的链接,请发布它们。

问候

4

4 回答 4

1

看看JavaCC。起初有点令人生畏,但它是处理此类事情的正确工具。另外,已经有一些您正在尝试实现的示例。

于 2013-01-09T14:26:19.793 回答
1

I read a book called Fluid Concepts and Creative Analogies by Douglas Hofstadter that talked about this sort of algebraic manipulations that would automatically rewrite equations in other ways attempting to join equations to other equations an infinite (yet restricted) number of ways given rules. It was an attempt to prove yet unproven theorems/proofs by brute force.

http://en.wikipedia.org/wiki/Fluid_Concepts_and_Creative_Analogies

Douglas Hofstadter's Numbo program attempts to do what you want. He doesn't give you the source, only describes how it works in detail.

It sounds like you want a program to do what highschool students do when they solve algebraic problems to move from a position where you know something, modifying it and combining it with other equations, to prove something previously unknown. It takes a strong Artificial intelligence to do this. The part of your brain that does this is the Neo Cortex, which does science, and it's operating principle is as of yet not understood.

If you want something that will do what college students do when they manipulate equations in calculus, you'll have to build a fairly strong artificial intelligence.

http://en.wikipedia.org/wiki/Neocortex

When we can do whole-brain emulation of a human neo cortex, I will post the answer here.

于 2013-01-09T14:30:20.003 回答
1

不知道你到底在追求什么,但这个问题在它的一般问题中很难。很难。

事实上,给定一组“公式”(公理)和演绎规则(数学等价运算),我们无法推断给定公式是否正确。这个问题其实是不可判定的。

这个问题首先由 Hilbert 作为Entscheidungsproblem解决

于 2013-01-09T14:37:35.327 回答
1

是的,你需要写一些算法来做这种计算机代数。至少

  • 一个解析器来解释输入
  • 将解析的操作数('a'、'b'、...)和运算符('+'、'=')关联起来的代数模型
  • 实施任何适当的规则以支持您希望进行的操作
于 2013-01-09T14:51:14.387 回答