如何使该乘法方法返回没有重复指数的多项式?

问题描述

我需要此方法来返回简化的多项式 例如:如果结果是3.00x ^ 4 + 6.00x ^ 2 + 2.00x ^ 3 + 4.00x + x ^ 2 + 2.00我需要将其简化为3.00x ^ 4 + 2.00x ^ 3 + 7.00x ^ 2 + 4.00x + 2.00

解决方法

执行此操作的一种方法是使用整数数组。 x n 的系数位于数组的第n th 位置。并将其添加到列表中时,会将数字添加到其中。默认情况下,整数数组的每个位置都为0。

这会为您添加多项式。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...