我正在寻找 PHP 中的广义方程求解器。这可以是内置功能、库的形式,甚至可以与另一种语言集成(如果需要的话)。我什至对涉及上述某些组合的联合解决方案感到满意。我需要这个用于我正在工作的教育网站。
让我给出一系列我希望这样的求解器能够处理的方程式:
x+5=8 => x=3
x^2=5 => x=+/-sqrt(5) [exact solution in terms of sqrt, ln, or whatever] AND
x=+/-2.236 [approximate solution to certain number of digits]
x+y=-3 [solve in terms of y] => y=-x-3
x^2=-5 => x=+/5i
x+y=3 and x-y=3 => x=3, y=0
我希望这不是一座太远的桥。如果是这样,我将在内部解决每个问题时构建功能,但如果有人知道解决此类问题的合适库,我将不胜感激。
最佳答案
查看 Sage ,来自他们的网站:
Sage is a free open-source mathematics software system licensed under the GPL. It combines the power of many existing open-source packages into a common Python-based interface. Mission: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab.
Sage 有一个基于 AJAX 的 notebook interface ,这可能与您可以从 PHP 使用的 API 一样好。
关于php - 如何在 PHP 中求解方程式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7621171/