# CHANGES

## 0.1 (2018/01/11): initial release. Features:

- The \poldef parser itself,

- Differentiation and anti-differentiation,

- Euclidean division and GCDs,

- Various utilities such as \PolFromCSV, \PolMapCoeffs, \PolToCSV, \PolToExpr, …

Only one-variable polynomials so far.

## 0.2 (2018/01/14)

- Fix: `"README thinks \numexpr recognizes ^ operator"`.

- Convert README to reStructuredText markup.

- Move main documentation from README to separate `polexpr.txt` file.

- Provide `polexpr.html` as obtained via DocUtils `rst2html.py`.

- Convert README to (CTAN compatible) Markdown markup.

Due to lack of available time the test suite might not be extensive enough. Bug reports are very welcome!

## 0.3 (2018/01/17)

- Bug fixes:

  - The `0.1` \PolEval accepted expressions for its second argument, but this was removed by mistake at `0.2`. Restored.

    Attention: at `0.4` this has been reverted again, and \PolEval{P}\AtExpr{foo} syntax is needed for using expressions in the second argument.

- Incompatible or breaking changes:

  - \PolToExpr now by default uses descending powers (it also treats differently coefficients equal to 1 or -1.) Use \PolToExpr* for ascending powers.

  - \PolEval reduced the output to smallest terms, but as this is costly with big fractions and not needed if e.g. wrapped in an `\xintRound` or `\xintFloat`, this step has been removed; the former meaning is available as \PolEvalReduced.

- New (or newly documented) macros:

  - \PolTypesetCmd

  - \PolTypesetCmdPrefix

  - \PolTypesetMonomialCmd

  - \PolEvalReducedAt

  - \PolToFloatExpr

  - \PolToExprOneTerm

  - \PolToFloatExprOneTerm

  - \PolToExprCmd

  - \PolToFloatExprCmd

  - \PolToExprTermPrefix

  - \PolToExprVar

  - \PolToExprTimes

- Improvements:

  - Documentation has a table of contents, internal hyperlinks, standardized signature notations and added explanations.

  - One can do `\PolLet{g}={f}` or `\PolLet{g}{f}`.

  - `\PolToExpr{f}` is highly customizable.

  - \poldef and other defining macros prepare the polynomial functions for usage within `\xintthefloatexpr` (or `\xintdeffloatvar`). Coefficients are pre-rounded to the floating point precision. Indispensible for numerical algorithms, as exact fractions, even reduced, quickly become very big. See the documentation about how to use the exact polynomials also in floating point context.

    Attention: this has been reverted at `0.4`. The macro \PolGenFloatVariant must be used for generation floating point polynomial functions.

## 0.3.1 (2018/01/18)

Fixes two typos in example code included in the documentation.

## 0.4 (2018/02/16)

- Bug fixes:

  - When Euclidean division gave a zero remainder, the internal representation of this zero polynomial could be faulty; this could cause mysterious bugs in conjunction with other package macros such as \PolMapCoeffs.

  - \PolGCD was buggy in case of first polynomial being of lesser degree than the second one.

- Breaking changes:

  - Formerly \PolEval{P}\At{foo} allowed `foo` to be an expression, which was transparently handled via `\xinttheexpr`. Now, `foo` must be a fraction (or a macro expanding to such) in the format acceptable by `xintfrac.sty` macros. Use \PolEval{P}\AtExpr{foo} for more general arguments using expression syntax. E.g., if `foo` is the name of a variable known to `\xintexpr`.

    The same holds for \PolEvalReduced and \PolFloatEval.

  - The `3.0` automatic generation of floating point variants has been reverted. Not only do not the package macros automatically generate floating point variants of newly created polynomials, they actually make pre-existing such variant undefined.

    See \PolGenFloatVariant.

- New non-expandable macros:

  - \PolGenFloatVariant

  - \PolGlobalLet

  - \PolTypesetOne

  - \PolQuo

  - \PolRem

  - \PolToSturm

  - \PolToSturm*

  - \PolSetToSturmChainSignChangesAt

  - \PolSetToNbOfZerosWithin

  - \PolSturmIsolateZeros

  - \PolRefineInterval*

  - \PolRefineInterval[N]

  - \PolEnsureIntervalLength

  - \PolEnsureIntervalLengths

  - \PolPrintIntervals

  - \PolPrintIntervalsPrintExactZero

  - \PolPrintIntervalsPrintLeftEndPoint

  - \PolPrintIntervalsPrintRightEndPoint

  - \PolReduceCoeffs*

  - \PolMakeMonic

- New expandable macros:

  - \PolToExprOneTermStyleA

  - \PolIfCoeffIsPlusOrMinusOne

  - \PolLeadingCoeff

  - \PolSturmChainLength

  - \PolSturmNbOfIsolatedZeros

  - \PolSturmIfZeroExactlyKnown

  - \PolSturmIsolatedZeroLeft

  - \PolSturmIsolatedZeroRight

  - `\PolPrintIntervalsTheEndPoint` (removed at 0.7)

  - \PolPrintIntervalsTheIndex

  - `\PolIfEndPointIsPositive` (removed at 0.7)

  - `\PolIfEndPointIsNegative` (removed at 0.7)

  - `\PolIfEndPointIsZero` (removed at 0.7)

  - \PolIntervalWidth

  - \PolDecToString

- Improvements:

  The main new feature is implementation of the Sturm algorithm for localization of the real roots of polynomials.

## 0.4.1 (2018/03/01)

Synced with xint 1.3.

## 0.4.2 (2018/03/03)

Documentation fix.

## 0.5 (2018/04/08)

- Bug fix:

  - \PolGet{polname}\fromarray\macro crashed when `\macro` was an xinttools array macro with no items. It now produces the zero polynomial.

- Breaking changes:

  - \PolToSturm creates primitive integer coefficients polynomials. This speeds up localization of roots via \PolSturmIsolateZeros. In case of user protests the author will make available again the code producing the bona fide Sturm polynomials as used formerly.

  - Polynomials created from \PolFromCSV or \PolGet get their coefficients normalized via xintfrac‘s `\xintRaw`.

- Experimental change:

  - Optional argument to \PolSturmIsolateZeros (see `The degree 41 polynomial with -2, -1.9, -1.8, ..., 0, 0.1, ..., 1.9, 2 as roots` in `polexpr-examples.pdf`). It will presumably be replaced in future by an interval specification.

- New non-expandable macro:

  - \PolMakePrimitive

- New expandable macro:

  - \PolIContent

## 0.5.1 (2018/04/22)

- New feature:

  - The character `'` can be used in polynomial names.

## 0.6 (2018/11/20)

- Bug fixes:

  - The starred variant \PolToSturm*{<polname>}{<sturmname>} was broken. On the occasion of the fix, its meaning has been modified, see its documentation.

  - Using \PolToSturm with a constant polynomial caused a division by zero error.

- New macro:

  - \PolSturmIsolateZeros* acts like the non-starred variant then computes all the multiplicities.

- New expandable macros:

  - \PolSturmIsolatedZeroMultiplicity{<sturmname>}{<index>}

  - \PolSturmNbOfRootsOf{<sturmname>}\LessThanOrEqualTo{<value>}

  - \PolSturmNbOfRootsOf{<sturmname>}\LessThanOrEqualToExpr{<num. expr.>}

  - \PolSturmNbWithMultOfRootsOf{<sturmname>}\LessThanOrEqualTo{<value>}

  - \PolSturmNbWithMultOfRootsOf{<sturmname>}\LessThanOrEqualToExpr{<num. expr.>}

## 0.7 (2018/12/08), 0.7.1 (bugfix), 0.7.2 (2nd bugfix) (2018/12/09)

- Breaking changes:

  - Although \PolPrintIntervals[<varname>]{<sturmname>} default output remains the same, some auxiliary macros for user-customization have been removed: `\PolPrintIntervalsTheEndPoint`, `\PolIfEndPointIsPositive{T}{F}`, `\PolIfEndPointIsNegative{T}{F}`, and `\PolIfEndPointIsZero{T}{F}`.

- Bug fixes:

  - It could happen that, contrarily to documentation, an interval computed by \PolSturmIsolateZeros{<sturmname>} had zero as an endpoint,

  - \PolEnsureIntervalLength{<sturmname>}{<index>}{<exponent>} could under certain circumstances erroneously replace a non-zero root by zero,

  - \PolEnsureIntervalLengths{<sturmname>}{<exponent>} crashed when used with a polynomial with no real roots, hence for which no isolation intervals existed (thanks to Thomas Söll for report).

- New macros:

  - \PolSturmIsolateZeros**{<sturmname>}

  - \PolSturmIsolateZerosGetMultiplicitiesAndRationalRoots{<sturmname>}

  - \PolSturmIsolateZerosAndFindRationalRoots{<sturmname>}

  - \polexprsetup

  - \PolPrintIntervals*

  - \PolPrintIntervalsNoRealRoots

  - \PolPrintIntervalsBeginEnv

  - \PolPrintIntervalsEndEnv

  - \PolPrintIntervalsKnownRoot

  - \PolPrintIntervalsUnknownRoot

  - \PolPrintIntervalsPrintMultiplicity

- New expandable macros:

  - \PolSturmNbOfRationalRoots{<sturmname>}

  - \PolSturmNbOfRationalRootsWithMultiplicities{<sturmname>}

  - \PolSturmRationalRoot{<sturmname>}{<k>}

  - \PolSturmRationalRootIndex{<sturmname>}{<k>}

  - \PolSturmRationalRootMultiplicity{<sturmname>}{<k>}

  - \PolPrintIntervalsTheVar

  - \PolPrintIntervalsTheSturmName

  - \PolPrintIntervalsTheMultiplicity

## 0.7.3 (2019/02/04)

- Bug fixes:

  - Debugging information not destined to user showed in log if root finding was done under `\xintverbosetrue` regime.

  - \PolPrintIntervalsTheVar remained defined after \PolPrintIntervals but was left undefined after \PolPrintIntervals* (reported by Jürgen Gilg). Now remains defined in both cases, and \PolPrintIntervalsTheSturmName also.

  - Polynomial names ending in digits caused errors (reported by Thomas Söll).

## 0.7.4 (2019/02/12)

- Bug fix:

  - 20000000000 is too big for `\numexpr`, shouldn’t I know that? Thanks to Jürgen Gilg for report.

## 0.7.5 (2020/01/31)

Synced with xintexpr 1.4. Requires it.

## 0.8 (2021/03/29)

Synced with xintexpr 1.4d. Requires it.

- Breaking changes:

  - As the usability of character `'` in names has been extended from `\poldef` to also generally `\xintexpr`, `\xintdefvar`, and `\xintdeffunc`, it means that the infix operators `'and'`, `'or'`, and `'mod'` must be replaced by `&&`, `||`, and `/:` if they follow immediately a variable name (similarly `'xor'` must be replaced by the `xor()` function in such case).

  - \PolToExpr by default uses a catcode 12 `^`. See its documentation and the new configuration \PolToExprCaret.

- Deprecated:

  - Usage of `P/Q` for the euclidean quotient of two polynomials is deprecated. Start using `quo(P,Q)` in its place.

- Bug fixes:

  - The `\xintglobaldefstrue` setting was obeyed only partially by the polexpr macros defining polynomials.

  - The `\xintexpr` variables storing the values of the extremities of the intervals as found by \PolSturmIsolateZeros were not updated at 0.7.5 to the xintexpr 1.4 format and thus caused low-level TeX errors if used.

  - Attempting to use in `\poldef` a function previously declared via `\xintdeffunc` which made usage of the indexing or slicing “ople” syntax typically caused `TeX capacity exceeded` error. Indeed 0.7.5 only partially made polexpr able to cope with the extended possibilities for xintexpr 1.4 user-declared functions. Hopefully `0.8` achieves full functionality in this context.

- New macros:

  - \polnewpolverbosefalse

  - \PolToExprCaret

  - \PolToExprInVar

  - Alongside the major new functionalities described in the next item \PolTypeset and \PolToExpr have been enhanced to accept as argument a general expression and not only a pre-declared polynomial name.

- New features:

  - The package is usable under Plain and probably most any TeX format, and not only under LaTeX.

  - The core of the package has been rewritten entirely in order to start letting `\xintexpr` recognize a polynomial type as a genuine variable. This has allowed:

    - to solve the reduced inter-operability problems between polexpr and xintexpr which arose as consequences to the deep xintexpr `1.4` evolution,

    - to make available most of the functionality associated to expandable macros directly in the `\xinteval` syntax as operators or functions,

    - to provide (expandable) functional interface in `\xinteval` to features previously available only via (for some, non-expandable) macro interface such as gcd computations.

See the updated Quick syntax overview and then the extended syntax description.

## 0.8.1 (2021/04/12)

- Breaking changes:

  - Renamed 0.8’s `icontent()` to cont().

  - Renamed 0.8’s `lcoeff()` to lc().

- Bug fixes:

  - Sadly, `diff1()`, `diff2()`, `diffn()` were broken for polynomials of degrees 8 or more, due to a typo and insufficient testing.

  - The package should have (as documented) required xintexpr 1.4d but in practice it accepted to work with xintexpr 1.4c, whose `\xinteval` does not know how to “output” a polynomial.

  - The definition of one of the two variants of \PolSturmNbOfRootsOf… was broken by an end-of-line space, left-over from mass conversion from LaTeX to TeX syntax.

- Added:

  - lpol()

  - lcoeffs()

## 0.8.2 (2021/05/05)

- Breaking change:

  - Usage of `\xintPFloat` in place of `\xintFloat` for \PolToFloatExprCmd.

- Improved:

  - Some xintexpr functions such as `rseq()` use the semi-colon, and it was mentioned in the documentation that \poldef will be confused by this and that inner semi-colons could be set within braces `{;}` as a work-around. It was not clear from this documentation that also \PolDef required this work-around. With this relase only \poldef but not \PolDef needs the work-around.

- Track xintexpr `1.4e` changes relative to powers.

## 0.8.3 (2021/05/27)

- Small internal update to track an xintexpr `1.4h` change regarding handling of exceptions. Will require this version at least on loading.

## 0.8.4 (2021/11/01)

- Bug fix: \PolSturmIsolateZeros**{<sturmname>} did not declare the `<sturmname>_norr` and `<sturmname>_sqf_norr` polynomials if original polynomial had no real root!

## 0.8.5 (2021/11/30)

- Bug fix: support for the `intfrom()` function was in the code, but the declaration to the polynomial parser had not been done.

- Track (belatedly) upstream deprecation of `\xintSignedFrac` and `\xintSignedFwOver` at xintexpr `1.4g`

## 0.8.6 (2022/01/09)

- Provide a separate `polexpr-examples.pdf` with examples formerly shown as part of the html documentation.

- Minor improvement to the computation of a priori bounds on real roots.

- Add \PolPrintIntervalsRowSeparator and allow usage of `amsmath` environments in custom \PolPrintIntervalsBeginEnv and \PolPrintIntervalsEndEnv.

## 0.8.7 (2022/05/14)

- Bug fix: catcode sanitization by \poldef was minimal ever since `0.1` and handled only the semi-colon. Thus e.g. the active `!` from babel-french caused errors and `\string!` was needed as work-around for factorials. Now the same sanitization as for `\xintdefvar` and `\xintdeffunc` is applied. This however can only work at locations where the catcodes are not yet frozen at the time `\poldef` expands.

- Split the html documentation into three files and enhance it via CSS styling.

## 0.8.7a (2022/05/19)

- Documentation updates.