Reverse polynomial, reciprocal polynomial and reflected polynomial(逆多项式,倒数多项式和反射多项式)

本文介绍了在实数和复数域下多项式的倒数(反射)多项式概念,即通过改变系数顺序或取共轭,以及自变量的反转。重点在于解释这两种形式的定义和它们与原多项式的关系。
摘要由CSDN通过智能技术生成

Reverse polynomial, reciprocal polynomial and reflected polynomial

引言

读文章的时候,经常会遇到一种说法,叫做 reflected polynomial,由于不知道什么意义,特来记录一下。

正文

多项式自变量取值范围为为实数时

比如,我们有一个 polynomial(多项式),其形式如下:
p ( x ) = a 0 + a 1 x + a 2 x 2 + ⋯ + a n x n (1) p\left ( x \right ) =a_0+a_1x+a_2x^2+\cdots +a_nx^{n} \tag{1} p(x)=a0+a1x+a2x2++anxn(1)
其中 a 0 , a 1 , ⋯   , a n a_0, a_1, \cdots,a_n a0,a1,,an 为多项式系数,它们可以来源于任意的数集,比如实数,复数等等。对应这种类型的多项式,它的 reciprocal polynomial(倒数多项式) 或者 reflected polynomial(反射多项式) 被定义为:
p ∗ ( x ) = p R ( x ) = a n + a n − 1 x + ⋯ + a 0 x n = x n p ( x − 1 ) (2) p^*\left ( x \right ) =p^R\left ( x \right ) =a_n+a_{n-1}x+\cdots+a_0x^{n}=x^{n}p\left ( x^{-1} \right ) \tag{2} p(x)=pR(x)=an+an1x++a0xn=xnp(x1)(2)
可以看到,一个多项式的倒数多项式或者反射多项式实际上是将它的系数顺序倒置,将它的自变量序列保持原状,或者说将系数顺序保持原状,自变量序列倒置的多项式。

注意:在有些文献中,有时候也会将倒数多项式称作 Reverse polynomial(逆多项式)。

多项式自变量取值范围为为复数时

p ( z ) = a n + a 1 z + a 2 z 2 + ⋯ + a n z n (3) p\left ( z \right ) =a_n+a_1z+a_2z^2+\cdots+a_nz^n \tag{3} p(z)=an+a1z+a2z2++anzn(3)
注意,此时 z 的取值范围为复数。
那么 p ( z ) p\left ( z \right ) p(z) 的共轭多项式倒数 p † p^{\dagger } p 为:
p † ( z ) = a n ‾ + a n − 1 ‾ z + ⋯ ⋅ + a 0 ‾ z n = z n p ( z ˉ − 1 ) ‾ (4) p^{\dagger }\left ( z \right ) =\overline{a_n} + \overline{a_{n-1}}z+\cdots\cdot+\overline{a_0}z^n=z^n\overline{p\left ( \bar{z}^{-1} \right ) } \tag{4} p(z)=an+an1z++a0zn=znp(zˉ1)(4)
其中, a i ‾ \overline{a_i} ai 表示 a i a_i ai 的复共轭。可能这种书写方式并不直观,我们采用一般化的书写方式,即使用 a i ∗ a_i^* ai 来表示 a i a_i ai 的复共轭,则(4)式变为:
p † ( z ) = a n ∗ + a n − 1 ∗ z + ⋯ ⋅ + a 0 ∗ z n = z n p ∗ ( z ∗ − 1 ) (5) p^{\dagger }\left ( z \right ) =a_n^* + a_{n-1}^*z+\cdots\cdot+a_0^*z^n=z^np^*\left ( z^{*-1} \right ) \tag{5} p(z)=an+an1z++a0zn=znp(z∗−1)(5)

如果大家觉得有用,就请点个赞吧~

  • 15
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
好的,我可以帮您设计一个一元多项式计算器,并提供升幂和降幂两种输出方式的C++代码。 首先,我们需要定义一个结构体来表示多项式的每一项,包括系数和指数: ```c++ struct Term { float coef; // 系数 int exp; // 指数 }; ``` 接下来,我们可以定义一个类来表示多项式,并实现常见的操作,例如加、减、乘、除等: ```c++ class Polynomial { private: vector<Term> terms; // 用 vector 存储多项式的每一项 public: Polynomial() { terms.push_back({0, 0}); // 初始化为 0 } void clear() { terms.clear(); terms.push_back({0, 0}); // 清空后初始化为 0 } void insert(float coef, int exp) { if (coef != 0) { // 如果系数不为零,则插入一项 for (auto &term : terms) { if (term.exp == exp) { term.coef += coef; return; } } terms.push_back({coef, exp}); } } Polynomial operator+(const Polynomial &rhs) const { Polynomial res; int i = 0, j = 0; while (i < terms.size() && j < rhs.terms.size()) { if (terms[i].exp > rhs.terms[j].exp) { res.insert(terms[i].coef, terms[i].exp); i++; } else if (terms[i].exp < rhs.terms[j].exp) { res.insert(rhs.terms[j].coef, rhs.terms[j].exp); j++; } else { res.insert(terms[i].coef + rhs.terms[j].coef, terms[i].exp); i++; j++; } } while (i < terms.size()) { res.insert(terms[i].coef, terms[i].exp); i++; } while (j < rhs.terms.size()) { res.insert(rhs.terms[j].coef, rhs.terms[j].exp); j++; } return res; } Polynomial operator-(const Polynomial &rhs) const { Polynomial res; int i = 0, j = 0; while (i < terms.size() && j < rhs.terms.size()) { if (terms[i].exp > rhs.terms[j].exp) { res.insert(terms[i].coef, terms[i].exp); i++; } else if (terms[i].exp < rhs.terms[j].exp) { res.insert(-rhs.terms[j].coef, rhs.terms[j].exp); j++; } else { res.insert(terms[i].coef - rhs.terms[j].coef, terms[i].exp); i++; j++; } } while (i < terms.size()) { res.insert(terms[i].coef, terms[i].exp); i++; } while (j < rhs.terms.size()) { res.insert(-rhs.terms[j].coef, rhs.terms[j].exp); j++; } return res; } Polynomial operator*(const Polynomial &rhs) const { Polynomial res; for (auto &a : terms) { for (auto &b : rhs.terms) { res.insert(a.coef * b.coef, a.exp + b.exp); } } return res; } Polynomial operator/(const Polynomial &rhs) const { Polynomial res, dividend = *this, divisor = rhs; while (dividend.terms.size() > 1 || dividend.terms[0].coef != 0) { Term t = dividend.terms.back() / divisor.terms.back(); res.insert(t.coef, t.exp); Polynomial tmp = divisor * Polynomial(t.coef, t.exp); dividend = dividend - tmp; dividend.terms.pop_back(); } reverse(res.terms.begin(), res.terms.end()); return res; } void print(bool increasing) const { if (terms.size() == 1 && terms[0].coef == 0) { cout << "0\n"; return; } bool first = true; for (auto it = terms.rbegin(); it != terms.rend(); it++) { if (it->coef == 0) continue; if (first) { first = false; } else { if (it->coef > 0) { cout << "+"; } } if (it->exp == 0 || it->coef != 1 && it->coef != -1) { cout << it->coef; } else if (it->coef == -1) { cout << "-"; } if (it->exp != 0) { cout << "x"; if (it->exp != 1) { cout << "^" << it->exp; } } } cout << "\n"; } }; ``` 在这个类中,我们重载了加、减、乘、除等运算符,并实现了一个 `print` 函数,用于将多项式输出为字符串。 在 `print` 函数中,我们使用了一个 `bool` 类型的参数 `increasing`,用于控制输出的顺序。如果 `increasing` 为 `true`,则按指数升序输出;否则按指数降序输出。 最后,我们给出一个简单的 `main` 函数作为示例: ```c++ int main() { Polynomial p1, p2; p1.insert(1, 2); p1.insert(2, 1); p1.insert(3, 0); p2.insert(1, 1); p2.insert(1, 0); cout << "p1 = "; p1.print(true); cout << "p2 = "; p2.print(false); Polynomial p3 = p1 + p2; cout << "p1 + p2 = "; p3.print(true); Polynomial p4 = p1 - p2; cout << "p1 - p2 = "; p4.print(false); Polynomial p5 = p1 * p2; cout << "p1 * p2 = "; p5.print(true); Polynomial p6 = p1 / p2; cout << "p1 / p2 = "; p6.print(false); return 0; } ``` 这个程序会输出: ``` p1 = 3x^0+2x^1+1x^2 p2 = x^1+1x^0 p1 + p2 = 1x^0+3x^1+1x^2 p1 - p2 = 1x^2+1x^1+2x^0 p1 * p2 = 1x^1+2x^2+4x^3+3x^4+1x^5 p1 / p2 = 2x^1+1x^0 ``` 以上就是一个简单的一元多项式计算器,并提供了升幂和降幂两种输出方式的C++代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

勤奋的大熊猫

你的鼓励将是我写作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值