Python中具有负指数的多项式 [英] Polynomials with negative exponents in Python

查看:352
本文介绍了Python中具有负指数的多项式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当多项式可以具有负指数时,是否存在可以使用多项式算法的库?我在numpy中找到了 poly1d 类,但是我找不到弄清楚我如何表示像x**-3 + x**-2 + x**2 + x**3这样的多项式.

Is there a library to work with polynomial arithmetic when polynomials can have negative exponents? I found the poly1d class in numpy, but I cannot figure out how I could represent a polynomial like x**-3 + x**-2 + x**2 + x**3.

推荐答案

引用维基百科:

在数学中,多项式是由变量(也称为不确定对象)和常量构造的有限长度表达式,仅使用加,减,乘和非负整数指数运算.

您要查询的不是多项式-例如,多项式始终是有限的,但您想要的奇异性为0.在积极的一面,有一些用于符号处理的库.看看符号.

What you're asking about isn't a polynomial -- for example polynomials are always finite, but what you want has a singularity at 0. On the positive side, there are libraries for symbolic manipulation. Take a look at sympy.

这篇关于Python中具有负指数的多项式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆