computer algebra soft to minimize the number of operations in a set of polynomials

好久不见. 提交于 2019-12-11 06:08:02

问题


I have systems of polynomials, fairly simple polynomial expressions but rather long to optimize my hand. Expressions are grouped in sets, and in a given set there are common terms in several variables.

I would like to know if there is a computer algebra system, such as Mathematica, Matlab, or sympy, which can optimize multiple polynomials with common terms to minimize number of operations. It would be also great if such system can minimize the number of intermediate terms to reduce number of registers.

If such system is not existing, I am going to do my own, using Python symbolic algebra Sympy. If you are working on such package or are interested in developing or using one, please let me know.

here is a made-up example

x0 = ((t - q*A)*x + B)*y
y0 = ((t - q*A)*y + B)*z
z0 = ((t - q*A)*z + B)*x

so you can obviously factor the (t - qA) term. Now if you make number of terms very large with various combinations of common terms it becomes difficult to do by hand. The equations I have involve up to 40 terms and the size of set is around 20. Hope that helps

Thank you


回答1:


Is sympy what you're looking for? I do believe it has support for polynomials although I don't know if it supports all the features you may desire (still, tweaking it to add what you think it might be missing has to be easier than writing your own from scratch;-).




回答2:


Have you considered Maxima?

It is an impressive symbolical computation package that is free, open source, and has a strong and active community that provides valuable assistance when dealing with non-obvious formulations. It is readily availability for all three major operating systems, and has a precompiled Windows binary.

You have a variety of algebraic manipulation commands available for expressions and for systems of equations (such as yours): expand, factor, simplify, ratsimp, linsolve, etc.

This page (Maxima for Symbolic Computation)should get you started — downloading, installing, a few examples, and then pointing out additional resources to guide you on your way, including a quick command reference / cheat sheet, and some guidlines for writing your own scripts.




回答3:


Mathomatic may be the lightweight solution you are looking for. Have a look: http:www.mathomatic.org.

It does simple algebra with all the usual operators, is able to simplify symbolic expressions, solve for variables and sets of eqns.

It has no programming capability. You can build a standalone app, or use the API in the form of a library and header files to incorporate it in C,C++ or Objective-C, or you could launch the app from your application where you supply the command line and environment.

Have a look at NSTask, which also allows to pipe stdin and stdout to datastreams in your own app.

Mathomatic is also able to save the resulting expressions in java, python or maxima format for inclusion in the program code on these systems.




回答4:


Well Mathematica can certainly do all sorts of transformations on sets of polynomial equations such as yours, and some of those transformations could be to reduce the number of terms. Whether that is the right answer for you is open to question, as you don't seem to have a copy available. I expect that the same is true for Maple and for most of the other CAS out there.

But your mention of

reduce number of registers

suggests that you are actually trying to do some data-flow analysis for compilation. You might want to look at the literature on that topic too. Some of that literature does indeed refer to computer-algebra-like transformations on expressions.



来源:https://stackoverflow.com/questions/1736034/computer-algebra-soft-to-minimize-the-number-of-operations-in-a-set-of-polynomia

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!