1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
// Copyright © 2026 Mikhail Hogrefe
//
// This file is part of Malachite.
//
// Malachite is free software: you can redistribute it and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published by the Free Software Foundation; either version
// 3 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>.
/// Implementations of [`Add`](core::ops::Add) and [`AddAssign`](core::ops::AddAssign), for adding
/// two polynomials.
/// Implementations of [`AddTruncated`](malachite_base::polynomial::AddTruncated) and
/// [`AddTruncatedAssign`](malachite_base::polynomial::AddTruncatedAssign), for adding two
/// polynomials and keeping only their low coefficients.
/// Implementations of [`BalancedMod`](malachite_base::num::arithmetic::traits::BalancedMod), which
/// reduces every coefficient of a polynomial to the representative closest to zero, producing an
/// [`IntegerPolynomial`](crate::integer_polynomial::IntegerPolynomial).
/// Implementations of [`BitPack`](malachite_base::polynomial::BitPack), which packs a polynomial's
/// coefficients into fixed-width fields of a single number.
/// Implementations of [`BitUnpack`](malachite_base::polynomial::BitUnpack), which unpacks a
/// polynomial from the fixed-width fields of a single number.
/// Implementations of
/// [`CanonicalizeUnit`](malachite_base::num::arithmetic::traits::CanonicalizeUnit) and
/// [`CanonicalizeUnitAssign`](malachite_base::num::arithmetic::traits::CanonicalizeUnitAssign),
/// which bring a polynomial into canonical unit form.
/// Implementations of [`ComposePowerOfX`](malachite_base::polynomial::ComposePowerOfX) and
/// [`ComposePowerOfXAssign`](malachite_base::polynomial::ComposePowerOfXAssign), for substituting a
/// power of the variable into a polynomial.
/// Implementations of [`Content`](malachite_base::polynomial::Content),
/// [`PrimitivePart`](malachite_base::polynomial::PrimitivePart),
/// [`PrimitivePartAssign`](malachite_base::polynomial::PrimitivePartAssign), and
/// [`ContentAndPrimitivePart`](malachite_base::polynomial::ContentAndPrimitivePart), which compute
/// the GCD of a polynomial's coefficients and the polynomial divided by it.
/// Implementations of [`DeflatePowerOfX`](malachite_base::polynomial::DeflatePowerOfX) and
/// [`DeflatePowerOfXAssign`](malachite_base::polynomial::DeflatePowerOfXAssign), for undoing the
/// substitution of a power of the variable into a polynomial.
/// Implementations of [`Derivative`](malachite_base::polynomial::Derivative) and
/// [`DerivativeAssign`](malachite_base::polynomial::DerivativeAssign), for differentiating a
/// polynomial.
/// Implementations of [`DivPowerOfX`](malachite_base::polynomial::DivPowerOfX) and
/// [`DivPowerOfXAssign`](malachite_base::polynomial::DivPowerOfXAssign), for dividing a polynomial
/// by a power of its variable and discarding the remainder.
/// Implementations of [`Evaluate`](malachite_base::polynomial::Evaluate), which evaluates a
/// polynomial at a value, and of
/// [`ModPowerOf2Evaluate`](malachite_base::polynomial::ModPowerOf2Evaluate), which does so modulo a
/// power of 2.
/// An implementation of [`ExponentGcd`](malachite_base::polynomial::ExponentGcd), the greatest
/// common divisor of the exponents at which a polynomial has nonzero coefficients.
/// An implementation of [`FloorL2Norm`](malachite_base::polynomial::FloorL2Norm), the floor of a
/// polynomial's $L^2$ norm.
/// Implementations of [`Height`](malachite_base::num::arithmetic::traits::Height) and
/// [`HeightRef`](malachite_base::num::arithmetic::traits::HeightRef), the largest of the magnitudes
/// of a polynomial's coefficients.
/// An implementation of [`IsUnit`](malachite_base::num::arithmetic::traits::IsUnit), a trait for
/// determining whether a number is a unit of its ring.
/// An implementation of [`L2NormSquared`](malachite_base::polynomial::L2NormSquared), the sum of
/// the squares of a polynomial's coefficients.
/// Implementations of [`ModAdd`](malachite_base::num::arithmetic::traits::ModAdd) and
/// [`ModAddAssign`](malachite_base::num::arithmetic::traits::ModAddAssign), for adding two
/// polynomials modulo a [`Natural`](crate::natural::Natural).
/// Implementations of [`ModAddTruncated`](malachite_base::polynomial::ModAddTruncated) and
/// [`ModAddTruncatedAssign`](malachite_base::polynomial::ModAddTruncatedAssign), for adding two
/// polynomials modulo a [`Natural`](crate::natural::Natural) and keeping only their low
/// coefficients.
/// Implementations of [`ModDerivative`](malachite_base::polynomial::ModDerivative) and
/// [`ModDerivativeAssign`](malachite_base::polynomial::ModDerivativeAssign), for differentiating a
/// polynomial modulo a number.
/// Implementations of [`ModIntegral`](malachite_base::polynomial::ModIntegral) and
/// [`ModIntegralAssign`](malachite_base::polynomial::ModIntegralAssign), for integrating a
/// polynomial modulo a value.
/// An implementation of [`ModIsReduced`](malachite_base::num::arithmetic::traits::ModIsReduced),
/// which checks whether every coefficient of a polynomial is less than a given modulus.
/// Implementations of [`ModMakeMonic`](malachite_base::polynomial::ModMakeMonic) and
/// [`ModMakeMonicAssign`](malachite_base::polynomial::ModMakeMonicAssign), which make a polynomial
/// monic modulo a value.
/// Implementations of [`ModMul`](malachite_base::num::arithmetic::traits::ModMul) and
/// [`ModMulAssign`](malachite_base::num::arithmetic::traits::ModMulAssign), for multiplying two
/// polynomials modulo a [`Natural`](crate::natural::Natural).
/// Implementations of [`ModMulTruncated`](malachite_base::polynomial::ModMulTruncated) and
/// [`ModMulTruncatedAssign`](malachite_base::polynomial::ModMulTruncatedAssign), for multiplying
/// two polynomials modulo a [`Natural`](crate::natural::Natural) and keeping only the low
/// coefficients of the product.
/// Implementations of [`ModNeg`](malachite_base::num::arithmetic::traits::ModNeg) and
/// [`ModNegAssign`](malachite_base::num::arithmetic::traits::ModNegAssign), which negate a
/// polynomial modulo a number.
/// Implementations of [`ModNthDerivative`](malachite_base::polynomial::ModNthDerivative) and
/// [`ModNthDerivativeAssign`](malachite_base::polynomial::ModNthDerivativeAssign), for
/// differentiating a polynomial any number of times modulo a number.
/// Implementations of [`Mod`](malachite_base::num::arithmetic::traits::Mod),
/// [`ModAssign`](malachite_base::num::arithmetic::traits::ModAssign), [`Rem`](core::ops::Rem), and
/// [`RemAssign`](core::ops::RemAssign), traits for reducing every coefficient of a polynomial
/// modulo a number.
/// Implementations of [`ModPow`](malachite_base::num::arithmetic::traits::ModPow) and
/// [`ModPowAssign`](malachite_base::num::arithmetic::traits::ModPowAssign), for raising a
/// polynomial to a power modulo a number.
/// Implementations of [`ModPowTruncated`](malachite_base::polynomial::ModPowTruncated) and
/// [`ModPowTruncatedAssign`](malachite_base::polynomial::ModPowTruncatedAssign), for raising a
/// polynomial to a power modulo a number and keeping only the low coefficients.
/// Implementations of [`ModPowerOf2`](malachite_base::num::arithmetic::traits::ModPowerOf2) and
/// [`ModPowerOf2Assign`](malachite_base::num::arithmetic::traits::ModPowerOf2Assign), which reduce
/// every coefficient of a polynomial modulo a power of 2.
/// Implementations of [`ModPowerOf2Add`](malachite_base::num::arithmetic::traits::ModPowerOf2Add)
/// and [`ModPowerOf2AddAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2AddAssign), for
/// adding two polynomials modulo $2^k$.
/// Implementations of
/// [`ModPowerOf2AddTruncated`](malachite_base::polynomial::ModPowerOf2AddTruncated) and
/// [`ModPowerOf2AddTruncatedAssign`](malachite_base::polynomial::ModPowerOf2AddTruncatedAssign),
/// for adding two polynomials modulo $2^k$ and keeping only their low coefficients.
/// Implementations of [`ModPowerOf2Derivative`](malachite_base::polynomial::ModPowerOf2Derivative)
/// and [`ModPowerOf2DerivativeAssign`](malachite_base::polynomial::ModPowerOf2DerivativeAssign),
/// for differentiating a polynomial modulo a power of 2.
/// Implementations of [`ModPowerOf2Integral`](malachite_base::polynomial::ModPowerOf2Integral) and
/// [`ModPowerOf2IntegralAssign`](malachite_base::polynomial::ModPowerOf2IntegralAssign), for
/// integrating a polynomial modulo $2^k$.
/// An implementation of
/// [`ModPowerOf2IsReduced`](malachite_base::num::arithmetic::traits::ModPowerOf2IsReduced), which
/// checks whether every coefficient of a polynomial is less than a given power of 2.
/// Implementations of [`ModPowerOf2Mul`](malachite_base::num::arithmetic::traits::ModPowerOf2Mul)
/// and [`ModPowerOf2MulAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2MulAssign), for
/// multiplying two polynomials modulo $2^k$.
/// Implementations of
/// [`ModPowerOf2MulTruncated`](malachite_base::polynomial::ModPowerOf2MulTruncated) and
/// [`ModPowerOf2MulTruncatedAssign`](malachite_base::polynomial::ModPowerOf2MulTruncatedAssign),
/// for multiplying two polynomials modulo $2^k$ and keeping only the low coefficients of the
/// product.
/// Implementations of [`ModPowerOf2Neg`](malachite_base::num::arithmetic::traits::ModPowerOf2Neg)
/// and [`ModPowerOf2NegAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2NegAssign),
/// which negate a polynomial modulo a power of 2.
/// Implementations of
/// [`ModPowerOf2NthDerivative`](malachite_base::polynomial::ModPowerOf2NthDerivative) and
/// [`ModPowerOf2NthDerivativeAssign`](malachite_base::polynomial::ModPowerOf2NthDerivativeAssign),
/// for differentiating a polynomial any number of times modulo a power of 2.
/// Implementations of [`ModPowerOf2Pow`](malachite_base::num::arithmetic::traits::ModPowerOf2Pow)
/// and [`ModPowerOf2PowAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2PowAssign), for
/// raising a polynomial to a power modulo a power of 2.
/// Implementations of
/// [`ModPowerOf2PowTruncated`](malachite_base::polynomial::ModPowerOf2PowTruncated) and
/// [`ModPowerOf2PowTruncatedAssign`](malachite_base::polynomial::ModPowerOf2PowTruncatedAssign),
/// for raising a polynomial to a power modulo a power of 2 and keeping only the low coefficients.
/// Implementations of [`ModPowerOf2Shl`](malachite_base::num::arithmetic::traits::ModPowerOf2Shl)
/// and [`ModPowerOf2ShlAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2ShlAssign), for
/// left-shifting a polynomial modulo a power of 2.
///
/// # mod_power_of_2_shl
/// ```
/// use core::str::FromStr;
/// use malachite_base::num::arithmetic::traits::ModPowerOf2Shl;
/// use malachite_nz::natural_polynomial::NaturalPolynomial;
///
/// let p = NaturalPolynomial::from_str("5*x^2+x+3").unwrap();
/// assert_eq!(
/// p.clone().mod_power_of_2_shl(1u8, 3).to_string(),
/// "2*x^2+2*x+6"
/// );
/// assert_eq!(
/// p.clone().mod_power_of_2_shl(2u16, 3).to_string(),
/// "4*x^2+4*x+4"
/// );
/// assert_eq!(p.mod_power_of_2_shl(3u32, 3).to_string(), "0");
/// assert_eq!(
/// NaturalPolynomial::from_str("4*x^2+3")
/// .unwrap()
/// .mod_power_of_2_shl(1u64, 3)
/// .to_string(),
/// "6"
/// );
/// assert_eq!(
/// NaturalPolynomial::from_str("x+1")
/// .unwrap()
/// .mod_power_of_2_shl(99u128, 100)
/// .to_string(),
/// "633825300114114700748351602688*x+633825300114114700748351602688"
/// );
///
/// let p = NaturalPolynomial::from_str("5*x^2+x+3").unwrap();
/// assert_eq!((&p).mod_power_of_2_shl(1u8, 3).to_string(), "2*x^2+2*x+6");
/// assert_eq!((&p).mod_power_of_2_shl(2u16, 3).to_string(), "4*x^2+4*x+4");
/// assert_eq!((&p).mod_power_of_2_shl(3u32, 3).to_string(), "0");
/// assert_eq!(
/// (&NaturalPolynomial::from_str("4*x^2+3").unwrap())
/// .mod_power_of_2_shl(1u64, 3)
/// .to_string(),
/// "6"
/// );
/// assert_eq!(
/// (&NaturalPolynomial::from_str("x+1").unwrap())
/// .mod_power_of_2_shl(99u128, 100)
/// .to_string(),
/// "633825300114114700748351602688*x+633825300114114700748351602688"
/// );
/// ```
///
/// # mod_power_of_2_shl_assign
/// ```
/// use core::str::FromStr;
/// use malachite_base::num::arithmetic::traits::ModPowerOf2ShlAssign;
/// use malachite_nz::natural_polynomial::NaturalPolynomial;
///
/// let mut p = NaturalPolynomial::from_str("5*x^2+x+3").unwrap();
/// p.mod_power_of_2_shl_assign(1u8, 3);
/// assert_eq!(p.to_string(), "2*x^2+2*x+6");
///
/// let mut p = NaturalPolynomial::from_str("5*x^2+x+3").unwrap();
/// p.mod_power_of_2_shl_assign(3u32, 3);
/// assert_eq!(p.to_string(), "0");
///
/// let mut p = NaturalPolynomial::from_str("4*x^2+3").unwrap();
/// p.mod_power_of_2_shl_assign(1u64, 3);
/// assert_eq!(p.to_string(), "6");
///
/// let mut p = NaturalPolynomial::from_str("x+1").unwrap();
/// p.mod_power_of_2_shl_assign(99u128, 100);
/// assert_eq!(
/// p.to_string(),
/// "633825300114114700748351602688*x+633825300114114700748351602688"
/// );
/// ```
/// Implementations of
/// [`ModPowerOf2Square`](malachite_base::num::arithmetic::traits::ModPowerOf2Square) and
/// [`ModPowerOf2SquareAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2SquareAssign),
/// for squaring a polynomial modulo $2^k$.
/// Implementations of
/// [`ModPowerOf2SquareTruncated`](malachite_base::polynomial::ModPowerOf2SquareTruncated) and
/// [`ModPowerOf2SquareTruncatedAssign`](
/// malachite_base::polynomial::ModPowerOf2SquareTruncatedAssign), for squaring a polynomial modulo
/// $2^k$ and keeping only the low coefficients of the square.
/// Implementations of [`ModPowerOf2Sub`](malachite_base::num::arithmetic::traits::ModPowerOf2Sub)
/// and [`ModPowerOf2SubAssign`](malachite_base::num::arithmetic::traits::ModPowerOf2SubAssign), for
/// subtracting one polynomial from another modulo $2^k$.
/// Implementations of
/// [`ModPowerOf2SubTruncated`](malachite_base::polynomial::ModPowerOf2SubTruncated) and
/// [`ModPowerOf2SubTruncatedAssign`](malachite_base::polynomial::ModPowerOf2SubTruncatedAssign),
/// for subtracting one polynomial from another modulo $2^k$ and keeping only their low
/// coefficients.
/// Implementations of [`ModShl`](malachite_base::num::arithmetic::traits::ModShl) and
/// [`ModShlAssign`](malachite_base::num::arithmetic::traits::ModShlAssign), for left-shifting a
/// polynomial modulo a number.
///
/// # mod_shl
/// ```
/// use core::str::FromStr;
/// use malachite_base::num::arithmetic::traits::{ModShl, Pow};
/// use malachite_nz::natural::Natural;
/// use malachite_nz::natural_polynomial::NaturalPolynomial;
///
/// let p = NaturalPolynomial::from_str("3*x^2+x+7").unwrap();
/// assert_eq!(
/// p.clone().mod_shl(1u8, Natural::from(10u32)).to_string(),
/// "6*x^2+2*x+4"
/// );
/// assert_eq!(
/// p.mod_shl(3u16, Natural::from(10u32)).to_string(),
/// "4*x^2+8*x+6"
/// );
/// assert_eq!(
/// NaturalPolynomial::from_str("3*x^2+5")
/// .unwrap()
/// .mod_shl(2u32, Natural::from(12u32))
/// .to_string(),
/// "8"
/// );
/// assert_eq!(
/// NaturalPolynomial::from_str("x+1")
/// .unwrap()
/// .mod_shl(100u64, Natural::from(10u32).pow(30))
/// .to_string(),
/// "267650600228229401496703205376*x+267650600228229401496703205376"
/// );
///
/// let p = NaturalPolynomial::from_str("3*x^2+x+7").unwrap();
/// assert_eq!(
/// p.clone().mod_shl(1u8, &Natural::from(10u32)).to_string(),
/// "6*x^2+2*x+4"
/// );
/// assert_eq!(
/// p.mod_shl(3u16, &Natural::from(10u32)).to_string(),
/// "4*x^2+8*x+6"
/// );
/// assert_eq!(
/// NaturalPolynomial::from_str("3*x^2+5")
/// .unwrap()
/// .mod_shl(2u32, &Natural::from(12u32))
/// .to_string(),
/// "8"
/// );
/// assert_eq!(
/// NaturalPolynomial::from_str("x+1")
/// .unwrap()
/// .mod_shl(100u64, &Natural::from(10u32).pow(30))
/// .to_string(),
/// "267650600228229401496703205376*x+267650600228229401496703205376"
/// );
///
/// let p = NaturalPolynomial::from_str("3*x^2+x+7").unwrap();
/// assert_eq!(
/// (&p).mod_shl(1u8, Natural::from(10u32)).to_string(),
/// "6*x^2+2*x+4"
/// );
/// assert_eq!(
/// (&p).mod_shl(3u16, Natural::from(10u32)).to_string(),
/// "4*x^2+8*x+6"
/// );
/// assert_eq!(
/// (&NaturalPolynomial::from_str("3*x^2+5").unwrap())
/// .mod_shl(2u32, Natural::from(12u32))
/// .to_string(),
/// "8"
/// );
/// assert_eq!(
/// (&NaturalPolynomial::from_str("x+1").unwrap())
/// .mod_shl(100u64, Natural::from(10u32).pow(30))
/// .to_string(),
/// "267650600228229401496703205376*x+267650600228229401496703205376"
/// );
///
/// let p = NaturalPolynomial::from_str("3*x^2+x+7").unwrap();
/// assert_eq!(
/// (&p).mod_shl(1u8, &Natural::from(10u32)).to_string(),
/// "6*x^2+2*x+4"
/// );
/// assert_eq!(
/// (&p).mod_shl(3u16, &Natural::from(10u32)).to_string(),
/// "4*x^2+8*x+6"
/// );
/// assert_eq!(
/// (&NaturalPolynomial::from_str("3*x^2+5").unwrap())
/// .mod_shl(2u32, &Natural::from(12u32))
/// .to_string(),
/// "8"
/// );
/// assert_eq!(
/// (&NaturalPolynomial::from_str("x+1").unwrap())
/// .mod_shl(100u64, &Natural::from(10u32).pow(30))
/// .to_string(),
/// "267650600228229401496703205376*x+267650600228229401496703205376"
/// );
/// ```
///
/// # mod_shl_assign
/// ```
/// use core::str::FromStr;
/// use malachite_base::num::arithmetic::traits::{ModShlAssign, Pow};
/// use malachite_nz::natural::Natural;
/// use malachite_nz::natural_polynomial::NaturalPolynomial;
///
/// let mut p = NaturalPolynomial::from_str("3*x^2+x+7").unwrap();
/// p.mod_shl_assign(1u8, Natural::from(10u32));
/// assert_eq!(p.to_string(), "6*x^2+2*x+4");
///
/// let mut p = NaturalPolynomial::from_str("3*x^2+x+7").unwrap();
/// p.mod_shl_assign(3u16, &Natural::from(10u32));
/// assert_eq!(p.to_string(), "4*x^2+8*x+6");
///
/// let mut p = NaturalPolynomial::from_str("3*x^2+5").unwrap();
/// p.mod_shl_assign(2u32, Natural::from(12u32));
/// assert_eq!(p.to_string(), "8");
///
/// let mut p = NaturalPolynomial::from_str("x+1").unwrap();
/// p.mod_shl_assign(100u64, &Natural::from(10u32).pow(30));
/// assert_eq!(
/// p.to_string(),
/// "267650600228229401496703205376*x+267650600228229401496703205376"
/// );
/// ```
/// Implementations of [`ModSquare`](malachite_base::num::arithmetic::traits::ModSquare) and
/// [`ModSquareAssign`](malachite_base::num::arithmetic::traits::ModSquareAssign), for squaring a
/// polynomial modulo a [`Natural`](crate::natural::Natural).
/// Implementations of [`ModSquareTruncated`](malachite_base::polynomial::ModSquareTruncated) and
/// [`ModSquareTruncatedAssign`](malachite_base::polynomial::ModSquareTruncatedAssign), for squaring
/// a polynomial modulo a [`Natural`](crate::natural::Natural) and keeping only the low coefficients
/// of the square.
/// Implementations of [`ModSub`](malachite_base::num::arithmetic::traits::ModSub) and
/// [`ModSubAssign`](malachite_base::num::arithmetic::traits::ModSubAssign), for subtracting one
/// polynomial from another modulo a [`Natural`](crate::natural::Natural).
/// Implementations of [`ModSubTruncated`](malachite_base::polynomial::ModSubTruncated) and
/// [`ModSubTruncatedAssign`](malachite_base::polynomial::ModSubTruncatedAssign), for subtracting
/// one polynomial from another modulo a [`Natural`](crate::natural::Natural) and keeping only their
/// low coefficients.
/// Implementations of [`Mul`](core::ops::Mul) and [`MulAssign`](core::ops::MulAssign), for
/// multiplying two polynomials.
/// Implementations of [`MulPowerOfX`](malachite_base::polynomial::MulPowerOfX) and
/// [`MulPowerOfXAssign`](malachite_base::polynomial::MulPowerOfXAssign), for multiplying a
/// polynomial by a power of its variable.
/// Implementations of [`MulTruncated`](malachite_base::polynomial::MulTruncated) and
/// [`MulTruncatedAssign`](malachite_base::polynomial::MulTruncatedAssign), for multiplying two
/// polynomials and keeping only the low coefficients of the product.
/// Implementations of [`NthDerivative`](malachite_base::polynomial::NthDerivative) and
/// [`NthDerivativeAssign`](malachite_base::polynomial::NthDerivativeAssign), for differentiating a
/// polynomial any number of times.
/// Implementations of [`Pow`](malachite_base::num::arithmetic::traits::Pow) and
/// [`PowAssign`](malachite_base::num::arithmetic::traits::PowAssign), for raising a polynomial to a
/// power.
/// Implementations of [`PowTruncated`](malachite_base::polynomial::PowTruncated) and
/// [`PowTruncatedAssign`](malachite_base::polynomial::PowTruncatedAssign), for raising a polynomial
/// to a power and keeping only the low coefficients of the power.
/// Left-shifting a [`NaturalPolynomial`](super::NaturalPolynomial) (multiplying it by a power of
/// 2), by shifting every coefficient.
///
/// # shl
/// ```
/// use core::str::FromStr;
/// use malachite_base::num::basic::traits::Zero;
/// use malachite_nz::natural_polynomial::NaturalPolynomial;
///
/// assert_eq!((NaturalPolynomial::ZERO << 10u8).to_string(), "0");
/// assert_eq!(
/// (NaturalPolynomial::from_str("x^2+3*x+5").unwrap() << 0u16).to_string(),
/// "x^2+3*x+5"
/// );
/// assert_eq!(
/// (NaturalPolynomial::from_str("x^2+3*x+5").unwrap() << 2u32).to_string(),
/// "4*x^2+12*x+20"
/// );
/// assert_eq!(
/// (NaturalPolynomial::from_str("x^2+3*x+5").unwrap() << 100u64).to_string(),
/// "1267650600228229401496703205376*x^2+3802951800684688204490109616128*x+\
/// 6338253001141147007483516026880"
/// );
///
/// assert_eq!((&NaturalPolynomial::ZERO << 10u8).to_string(), "0");
/// assert_eq!(
/// (&NaturalPolynomial::from_str("x^2+3*x+5").unwrap() << 0u16).to_string(),
/// "x^2+3*x+5"
/// );
/// assert_eq!(
/// (&NaturalPolynomial::from_str("x^2+3*x+5").unwrap() << 2u32).to_string(),
/// "4*x^2+12*x+20"
/// );
/// assert_eq!(
/// (&NaturalPolynomial::from_str("x^2+3*x+5").unwrap() << 100u64).to_string(),
/// "1267650600228229401496703205376*x^2+3802951800684688204490109616128*x+\
/// 6338253001141147007483516026880"
/// );
/// ```
///
/// # shl_assign
/// ```
/// use core::str::FromStr;
/// use malachite_base::num::basic::traits::Zero;
/// use malachite_nz::natural_polynomial::NaturalPolynomial;
///
/// let mut p = NaturalPolynomial::ZERO;
/// p <<= 10u8;
/// assert_eq!(p.to_string(), "0");
///
/// let mut p = NaturalPolynomial::from_str("x^2+3*x+5").unwrap();
/// p <<= 0u16;
/// assert_eq!(p.to_string(), "x^2+3*x+5");
///
/// let mut p = NaturalPolynomial::from_str("x^2+3*x+5").unwrap();
/// p <<= 2u32;
/// assert_eq!(p.to_string(), "4*x^2+12*x+20");
///
/// let mut p = NaturalPolynomial::from_str("x^2+3*x+5").unwrap();
/// p <<= 100u64;
/// assert_eq!(
/// p.to_string(),
/// "1267650600228229401496703205376*x^2+3802951800684688204490109616128*x+\
/// 6338253001141147007483516026880"
/// );
/// ```
/// Implementations of [`Square`](malachite_base::num::arithmetic::traits::Square) and
/// [`SquareAssign`](malachite_base::num::arithmetic::traits::SquareAssign), for squaring a
/// polynomial.
/// Implementations of [`SquareTruncated`](malachite_base::polynomial::SquareTruncated) and
/// [`SquareTruncatedAssign`](malachite_base::polynomial::SquareTruncatedAssign), for squaring a
/// polynomial and keeping only the low coefficients of the square.