求解相关方程的算法

发布于 2024-09-17 23:20:09 字数 289 浏览 3 评论 0原文

我正在开发一个项目来创建一个通用方程求解器...设想它采用 25-30 个方程的形式,这些方程将与运算符一起保存在表中 - 变量名称。

然后,我会调用该表来求解缺少变量的任何方程,并且它将运算符/其他部分移动到缺少变量的另一侧,

例如2x+ 3y=z 并且如果 x 缺少变量。我会用 y 和 z 的值调用方程,它将转换为求解 x=(z-3y)/2

方程可以是线性、多项式、二进制(是/否结果)...

我不确定是否可以获取任何可用的轻量级库,或者是否需要从头开始构建......任何指示或指导将不胜感激

I am working on a project to create a generic equation solver... envision this to take the form of 25-30 equations that will be saved in a table- variable names along with the operators.

I would then call this table for solving any equation with a missing variable and it would move operators/ other pieces to the other side of the missing variable

e.g. 2x+ 3y=z and if x were missing variable. I would call equation with values for y and z and it would convert to solve for x=(z-3y)/2

equations could be linear, polynomial, binary(yes/no result)...

i am not sure if i can get any light-weight library available or whether this needs to built from scratch... any pointers or guidance will be appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

美人如玉 2024-09-24 23:20:09

请参阅Maxima

我更喜欢它来满足我的符号计算需求。

See Maxima.

I rather like it for my symbolic computation needs.

一身骄傲 2024-09-24 23:20:09

如果这种通用的黑盒算法能够变得准确、鲁棒和稳定,猪就可以飞了。解可以是不存在的、多个、参数化的等等。

即使对于线性方程,正确地完成它也很棘手。

最好的选择是某种形式的牛顿算法,但通常您可以根据您手头的问题对其进行调整。

编辑:我没有看到你想要象征性的东西,而不是数字。这又是一袋虫子。

If such a general black-box algorithm could be made accurate, robust and stable, pigs could fly. Solutions can be nonexistent, multiple, parametrized, etc.

Even for linear equations it gets tricky to do it right.

Your best bet is some form of Newton algorithm, but generally you tailor it to your problem at hand.

EDIT: I didn't see you wanted something symbolic, rather than numerical. It's another bag of worms.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文