Truncating to order n: truncate

### 5.27.24 Truncating to order n: truncate

The truncate command truncates a polynomial; i.e., it removes higher order terms.

- truncate takes two arguments:
  - P, a polynomial.
  - n, an integer.
- truncate(P,n) returns P truncated to order n; i.e., all terms of order greater or equal to n+1 are removed.

truncate may be used to transform a series expansion into a polynomial or to compute a series expansion step by step.

#### Examples

- Input:
  truncate((1+x+x^2/2)^3,4)
  Output:

  9 x4+16 x3+18 x2+12 x+4
  4

- Input:
  truncate(series(sin(x)),4)
  Output:

  −x3+6 x
  6

Note that the returned polynomial is normalized.