Group Abstract Group Abstract

Message Boards Message Boards

0
|
9.4K Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Zeroing-out polynomial terms?

Posted 9 years ago
POSTED BY: Bruce Colletti
6 Replies
Posted 9 years ago
POSTED BY: Bruce Colletti

I didn't suggest this earlier, because you wanted to keep the constant term while dropping non-constant terms below a threshold. Your last comment suggests that you do want to zero-out the linear term. So, if you wanted to drop all terms below a threshold, including the constant term, then you could use Series as follows:

Normal @ Series[1/x^3 + 1/x^2 + 1/x + 1 + x + x^2 + x^3 + x^4 + x^5, {x, Infinity, -3}]]
(* x^3 + x^4 + x^5 *)

If you wanted to drop terms below 1/x, then:

Normal @ Series[1/x^3 + 1/x^2 + 1/x + 1 + x + x^2 + x^3 + x^4 + x^5, {x, Infinity, 1}]]
(* 1 + 1/x + x + x^2 + x^3 + x^4 + x^5 *)
POSTED BY: Carl Woll
Posted 9 years ago

Thanks Sander. This looks great for use with polynomials.

As it turns out, what I had called a "polynomial" is really a Laurent polynomial, and so the negative integer exponents cause trouble. I'll still further investigate CoefficientRules.

Yours and Brad's replies suggest that maybe Replacement can't be coerced into zeroing-out a linear term in a Laurent polynomial. If so then this is important to know.

POSTED BY: Bruce Colletti

I would recommend using CoefficientRules and FromCoefficientRules:

CoefficientRules[2 + 3 x - x^2 + 5 x^3 + 9 x^8]
DeleteCases[%, ({n_} -> _) /; 1 <= n < 4]
FromCoefficientRules[%, x]

Or if you prefer function based, rather than rule-based:

CoefficientRules[2 + 3 x - x^2 + 5 x^3 + 9 x^8]
Select[%, Not[1 <= #[[1, 1]] < 4] &]
FromCoefficientRules[%, x]
POSTED BY: Sander Huisman
Posted 9 years ago
POSTED BY: Brad Klee
Posted 9 years ago

Thanks for the reply and its good sense approach.

Since my earlier method to strike that subpolynomial took too long, Tech Support used zero replacement to swiftly strike it. But then I noticed an occasional wrong result caused by a linear term c x that replacement didn't touch. Unable to zero out the subpolynomial-with-linear-term, I turned to Wolfram Community to see if Replacement could be made to do so.

In the actual application, the full polynomial (in x) is the sum of many bilinear forms a.B.c where B is the power of another matrix whose entries are powers of x -- B also depends upon the summation index (whose values are tuples). And so computing that subpolynomial isn't so easy. Although it seems that Replacement can't be made to behave as I had hoped, your idea to use Coefficient is a good one that I'll remember.

POSTED BY: Bruce Colletti
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard