首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >任意精度多项式求解

任意精度多项式求解
EN

Stack Overflow用户
提问于 2016-01-10 08:23:51
回答 3查看 1.1K关注 0票数 1

我们一直在用GSL求解多项式。然而,我们希望用任意精度来求解多项式。我查看了GMP和Boost多精度库,但是我找不到任何用浮点系数进行多项式求解的例程。

  1. 是否有免费和开放源码的库来解决任意精度的多项式或非常高精度的多项式(小数点后200位以上)?
  2. 随着数据类型的变化,GSL多项式求解程序是否有可能成为GMP的任意精度?
  3. 使用标准算法之一,使用GMP任意精确数据类型,编写多项式求解器更容易吗?

如果不清楚,请随时发表评论。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2016-01-27 18:07:35

  1. MPSolve提供了一个用多精度求解多项式的库.在内部,它使用GMP。 可观察到以下情况:
代码语言:javascript
复制
- The computations can be done in integer, rational, and floating-point arbitrary precision.
- The coefficients of the polynomial and various other options are given as input through a file. One can rig the original code to directly call the function from their own program.
- The solutions can be reported in various formats, such as exponential, only real, etc.
- The solver has been verified for several standard polynomial test cases and checks out. 
- The solver internally uses random number which is seeded through the `/dev/random` on a Linux machine. This causes a problem that the solver is slow on the subsequent runs as the [entropy](https://en.wikipedia.org/wiki/Entropy_%28computing%29) generated is not enough before the start of the future runs. This could be bypassed by replacing it with standard pseudo-random generators.
- An attempt was made to integrate the solver as a library. However, serious segmentation faults occur which were difficult to debug. Hence, the solver was being used by calling its executable. Note: this is just from my experience and hopefully it can be done in a better way.
- A new C++ version is being developed and, hopefully, shall resolve these issues.

  1. 将GSL多项式求解器分叉到使用GMP数据类型是很繁琐的.如果编写了解决程序,代码将更容易控制和理解(参见第3条)。
  2. 正如回答中所建议的那样,可以使用GMPMPFR多精度库,并且可以使用标准多项式求解技术(如基于Jenkins-Traub算法或QR的技术)编写多项式求解器。

Boost C++库为使用GMP和MPFR提供了包装器,使用起来可能非常方便。

票数 1
EN

Stack Overflow用户

发布于 2016-01-10 08:29:11

如果您知道一些求解多项式方程的算法(在许多教科书中都可以找到这些算法),您可以对其进行修改并编写代码以使用GMP。

因为GMP有一个看起来像C++类接口operator + .等等,你可以复制和通过一些现有的C代码,然后使它适应GMP。

票数 1
EN

Stack Overflow用户

发布于 2022-01-30 15:33:08

该程序库具有任意精度和区间算法求解真品多项式和络合多项式的例程。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34703491

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档