Next: romberg, Previous: quantum_computing-pkg [Contents][Index]

## 84 ratpow

The package `ratpow` provides functions that return the coefficients of the numerator of a CRE polynomial in a given variable.

For example,

- `ratp_coeffs(5*x^7-3*x^2+4,x)` returns `[[7,5],[2,-3],[0,4]]`, which omits zero terms;
- `ratp_dense_coeffs(5*x^7-y*x^2+4,x)` returns `[5,0,0,0,0,-y,0,4]`, which includes zero terms;
- `ratp_dense_coeffs((x^4-y^4)/(x-y),x)` returns `[1,y,y^2,y^3]`, because CRE simplifies the expression to `x^3+y*x^2+y^2*x+y^3`;
- `ratp_dense_coeffs(x+sqrt(x),x)` returns `[1,sqrt(x)]` while `ratp_dense_coeffs(x+sqrt(x),sqrt(x))` returns `[1,x]`: in CRE form, `x` and `sqrt(x)` are treated as independent variables.

The returned coefficients are in CRE form except for numbers.

For the list of vars of a CRE polynomial, use `showratvars`. For the denominator of a CRE polynomial, use `ratdenom`.

For information about CREs see also `rat`, `ratdisrep` and `showratvars`.

Next: romberg, Previous: quantum_computing-pkg [Contents][Index]