diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/generic/polexpr/README.md | 13 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/polexpr/polexpr-examples.pdf | bin | 0 -> 58706 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/polexpr/polexpr.html | 1263 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/polexpr/polexpr-examples.tex | 881 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/polexpr/polexpr.sty | 8 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/polexpr/polexprcore.tex | 10 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex | 211 |
8 files changed, 1440 insertions, 952 deletions
diff --git a/Master/texmf-dist/doc/generic/polexpr/README.md b/Master/texmf-dist/doc/generic/polexpr/README.md index c52baa8b756..4a74900100a 100644 --- a/Master/texmf-dist/doc/generic/polexpr/README.md +++ b/Master/texmf-dist/doc/generic/polexpr/README.md @@ -95,12 +95,14 @@ Releases - 0.8.5 (2021/11/30) Bugfix: `intfrom()` was documented at `0.8` but not declared to parser. Track (belatedly) `xintexpr` 1.4g changes +- 0.8.6 (2022/01/09) + Separate `polexpr-examples.{tex,pdf}` from the `polexpr.html` reference -Files of 0.8.5 release: - +Files of the 0.8.6 release: - polexpr.sty, polexprcore.tex, polexprexpr.tex, polexprsturm.tex, - README.md, -- polexpr.html (documentation) +- polexpr.html (reference documentation), +- polexpr-examples.pdf, polexpr-examples.tex (pdf doc and its source). Acknowledgments --------------- @@ -113,7 +115,7 @@ Jürgen Gilg and Thomas Söll for testing it on some concrete problems. License ------- -Copyright (C) 2018-2021 Jean-François Burnol +Copyright (C) 2018-2022 Jean-François Burnol See documentation of package [xintexpr](http://www.ctan.org/pkg/xint) for contact information. @@ -132,4 +134,5 @@ This Work has the LPPL maintenance status author-maintained. The Author of this Work is Jean-François Burnol. This Work consists of the package files polexpr.sty, polexprcore.tex, -polexprexpr.tex, polexprsturm.tex, this README.md and polexpr.html. +polexprexpr.tex, polexprsturm.tex, this README.md and documentation +polexpr.html, polexpr-examples.tex, polexpr-examples.pdf diff --git a/Master/texmf-dist/doc/generic/polexpr/polexpr-examples.pdf b/Master/texmf-dist/doc/generic/polexpr/polexpr-examples.pdf Binary files differnew file mode 100644 index 00000000000..1c67b4e533e --- /dev/null +++ b/Master/texmf-dist/doc/generic/polexpr/polexpr-examples.pdf diff --git a/Master/texmf-dist/doc/generic/polexpr/polexpr.html b/Master/texmf-dist/doc/generic/polexpr/polexpr.html index 9b6f99138d3..5f695deb4b7 100644 --- a/Master/texmf-dist/doc/generic/polexpr/polexpr.html +++ b/Master/texmf-dist/doc/generic/polexpr/polexpr.html @@ -3,7 +3,7 @@ <head> <meta charset="utf-8"/> <meta name="generator" content="Docutils 0.16: http://docutils.sourceforge.net/" /> -<title>Package polexpr documentation</title> +<title>polexpr reference documentation</title> <style type="text/css"> /* Minimal style sheet for the HTML output of Docutils. */ @@ -596,16 +596,83 @@ a { text-decoration: none; } </style> </head> <body> -<div class="document" id="package-polexpr-documentation"> -<h1 class="title">Package polexpr documentation</h1> -<p class="subtitle" id="id1">0.8.5 (2021/11/30)</p> - +<div class="document" id="polexpr-reference-documentation"> +<h1 class="title">polexpr reference documentation</h1> +<p class="subtitle" id="id1">0.8.6 (2022/01/09)</p> + +<div class="section" id="introduction"> +<h1><a class="toc-backref" href="#id35">Introduction</a></h1> +<p>This is a TeX and LaTeX macro package.</p> +<p>To use it with Plain or formats other than LaTeX:</p> +<pre class="literal-block">\input polexpr.sty</pre> +<p>To use it with LaTeX:</p> +<pre class="literal-block">\usepackage{polexpr}</pre> +<p>The capabilities of the package are implemented via:</p> +<ul class="simple"> +<li><p>a parser <span class="docutils literal">\poldef</span> allowing to define polynomials via the usual +algebraic notations,</p></li> +<li><p>many functions available for use directly in the powerful <span class="docutils literal">\poldef</span> or +<span class="docutils literal"><span class="pre">\xintexpr/\xinteval</span></span> expandable functional syntax,</p></li> +<li><p>and macros acting on named polynomials which may serve either as +alternative to the functional interface or to provide further +capabilities, such as root localization to arbitrary precision.</p></li> +</ul> +</div> +<div class="section" id="examples-of-root-localization"> +<h1><a class="toc-backref" href="#id36">Examples of root localization</a></h1> +<p>This legacy section has been moved to the +<a class="reference external" href="polexpr-examples.pdf">polexpr-examples.pdf</a> document. +To access it (if previous link does not work):</p> +<pre class="literal-block">texdoc polexpr-examples</pre> +</div> +<div class="section" id="usage-via-xintsession"> +<h1>Usage via <a class="reference external" href="https://www.ctan.org/pkg/xintsession">xintsession</a></h1> +<p>The simplest manner to get a feeling for the package abilities regarding +root localization is to use it on the command line via the <a class="reference external" href="https://www.ctan.org/pkg/xintsession">xintsession</a> +interface. Here is an example:</p> +<pre class="literal-block">$ rlwrap etex xintsession +[...xintsession welcome message...] +Starting in exact mode (floating point evaluations use 16 digits) +>>> &pol +pol mode (i.e. function definitions use \poldef) +>>> f(x) := x^7 - x^6 - 2x + 1; +f = x^7-x^6-2*x+1 + --> &GenFloat(f) lets f become usable as function in fp mode + --> &ROOTS(f) (resp. &ROOTS(f,N)) finds all rational roots exactly and + all irrational roots with at least 10 (resp. N) fractional digits +>>> &ROOTS(f) +Solving for real roots of f and assigning them (please wait...) +(mult. 1) Rootf_1 = -1.0719678841... +(mult. 1) Rootf_2 = 0.4962386948... +(mult. 1) Rootf_3 = 1.3151140860... +Square-free irrational part: x^7-x^6-2*x+1 + --> &REFINEROOTS(f,N) to extend real irr. roots to N fractional digits +>>> &REFINEROOTS(f,40) +Refining real roots of f to 40 digits (please wait...) +(mult. 1) Rootf_1 = -1.0719678841080266034109100331975342338141... +(mult. 1) Rootf_2 = 0.4962386948771497344730618510143671567979... +(mult. 1) Rootf_3 = 1.3151140860165192656960005018679846354234...</pre> +<p>The <a class="reference external" href="https://www.ctan.org/pkg/xintsession">xintsession</a> interface allows to define polynomial variables via its +<span class="docutils literal">&pol</span> mode. It also exposes <a class="reference internal" href="#polexpr08">all polynomial functions added to the +xintexpr syntax</a> by <span class="docutils literal">polexpr</span>. Further, as seen in the +example above it also covers some of the <span class="docutils literal">polexpr</span> capabilities +currently implemented via user macros. This is to be considered a work +in progress, the above <span class="docutils literal">&ROOTS</span> and <span class="docutils literal">&REFINEROOTS</span> may be renamed +into something else, and may have been so already since this +documentation was written.</p> +<p>Any input on the command line at the <a class="reference external" href="https://www.ctan.org/pkg/xintsession">xintsession</a> <span class="docutils literal">>>></span> prompt which +starts with a backslash is executed as TeX macros, so all macros of +<span class="docutils literal">polexpr</span> are in fact already available, including those typesetting +material in background of the interactive session on command line. The +<span class="docutils literal">&ROOTS</span> and <span class="docutils literal">&REFINEROOTS</span> direct their outputs to the +terminal rather than to the TeX page as would the typesetting macros +defined by <span class="docutils literal">polexpr</span> itself.</p> <div class="contents topic" id="contents"> <p class="topic-title">Contents</p> <ul class="simple"> -<li><p><a class="reference internal" href="#usage" id="id35">Usage</a></p></li> -<li><p><a class="reference internal" href="#abstract" id="id36">Abstract</a></p></li> -<li><p><a class="reference internal" href="#prerequisites" id="id37">Prerequisites</a></p></li> +<li><p><a class="reference internal" href="#introduction" id="id35">Introduction</a></p></li> +<li><p><a class="reference internal" href="#examples-of-root-localization" id="id36">Examples of root localization</a></p></li> +<li><p><a class="reference internal" href="#usage-via-xintsession" id="id37">Usage via xintsession</a></p></li> <li><p><a class="reference internal" href="#quick-syntax-overview" id="id38">Quick syntax overview</a></p></li> <li><p><a class="reference internal" href="#the-polexpr-0-8-extensions-to-the-xintexpr-syntax" id="id39">The polexpr <span class="docutils literal">0.8</span> extensions to the <span class="docutils literal">\xintexpr</span> syntax</a></p> <ul> @@ -645,261 +712,182 @@ a { text-decoration: none; } <li><p><a class="reference internal" href="#integral-pol-expr-p-pol-expr-a-pol-expr-b" id="id73"><span class="docutils literal"><span class="pre">integral(<pol.</span> expr. P>, [<pol. expr. a>, <pol. expr. <span class="pre">b>])</span></span></a></p></li> </ul> </li> -<li><p><a class="reference internal" href="#examples-of-localization-of-roots" id="id74">Examples of localization of roots</a></p> -<ul> -<li><p><a class="reference internal" href="#a-typical-example" id="id75">A typical example</a></p></li> -<li><p><a class="reference internal" href="#a-degree-four-polynomial-with-nearby-roots" id="id76">A degree four polynomial with nearby roots</a></p></li> -<li><p><a class="reference internal" href="#the-degree-nine-polynomial-with-0-99-0-999-0-9999-as-triple-roots" id="id77">The degree nine polynomial with 0.99, 0.999, 0.9999 as triple roots</a></p></li> -<li><p><a class="reference internal" href="#a-degree-five-polynomial-with-three-rational-roots" id="id78">A degree five polynomial with three rational roots</a></p></li> -<li><p><a class="reference internal" href="#a-mignotte-type-polynomial" id="id79">A Mignotte type polynomial</a></p></li> -<li><p><a class="reference internal" href="#the-wilkinson-polynomial" id="id80">The Wilkinson polynomial</a></p></li> -<li><p><a class="reference internal" href="#the-second-wilkinson-polynomial" id="id81">The second Wilkinson polynomial</a></p></li> -<li><p><a class="reference internal" href="#the-degree-41-polynomial-with-2-1-9-1-8-0-0-1-1-9-2-as-roots" id="id82">The degree 41 polynomial with -2, -1.9, -1.8, ..., 0, 0.1, ..., 1.9, 2 as roots</a></p></li> -<li><p><a class="reference internal" href="#roots-of-chebyshev-polynomials" id="id83">Roots of Chebyshev polynomials</a></p></li> -</ul> -</li> -<li><p><a class="reference internal" href="#non-expandable-macros" id="id84">Non-expandable macros</a></p> +<li><p><a class="reference internal" href="#non-expandable-macros" id="id74">Non-expandable macros</a></p> <ul> -<li><p><a class="reference internal" href="#poldef-polname-letter-expression-using-the-letter-as-indeterminate" id="id85"><span class="docutils literal">\poldef <span class="pre">polname(letter):=</span> expression using the letter as indeterminate;</span></a></p></li> -<li><p><a class="reference internal" href="#poldef-letter-polname-expr-using-the-letter-as-indeterminate" id="id86"><span class="docutils literal"><span class="pre">\PolDef[<letter>]{<polname>}{<expr.</span> using the letter as indeterminate>}</span></a></p></li> -<li><p><a class="reference internal" href="#polgenfloatvariant-polname" id="id87"><span class="docutils literal"><span class="pre">\PolGenFloatVariant{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poltypeset-pol-expr" id="id88"><span class="docutils literal"><span class="pre">\PolTypeset{<pol.</span> <span class="pre">expr.>}</span></span></a></p> +<li><p><a class="reference internal" href="#poldef-polname-letter-expression-using-the-letter-as-indeterminate" id="id75"><span class="docutils literal">\poldef <span class="pre">polname(letter):=</span> expression using the letter as indeterminate;</span></a></p></li> +<li><p><a class="reference internal" href="#poldef-letter-polname-expr-using-the-letter-as-indeterminate" id="id76"><span class="docutils literal"><span class="pre">\PolDef[<letter>]{<polname>}{<expr.</span> using the letter as indeterminate>}</span></a></p></li> +<li><p><a class="reference internal" href="#polgenfloatvariant-polname" id="id77"><span class="docutils literal"><span class="pre">\PolGenFloatVariant{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poltypeset-pol-expr" id="id78"><span class="docutils literal"><span class="pre">\PolTypeset{<pol.</span> <span class="pre">expr.>}</span></span></a></p> <ul> -<li><p><a class="reference internal" href="#poltypesetcmd-raw-coeff" id="id89"><span class="docutils literal"><span class="pre">\PolTypesetCmd{<raw_coeff>}</span></span></a></p> +<li><p><a class="reference internal" href="#poltypesetcmd-raw-coeff" id="id79"><span class="docutils literal"><span class="pre">\PolTypesetCmd{<raw_coeff>}</span></span></a></p> <ul> -<li><p><a class="reference internal" href="#polifcoeffisplusorminusone-t-f" id="id90"><span class="docutils literal"><span class="pre">\PolIfCoeffIsPlusOrMinusOne{T}{F}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polifcoeffisplusorminusone-t-f" id="id80"><span class="docutils literal"><span class="pre">\PolIfCoeffIsPlusOrMinusOne{T}{F}</span></span></a></p></li> </ul> </li> -<li><p><a class="reference internal" href="#poltypesetone-raw-coeff" id="id91"><span class="docutils literal"><span class="pre">\PolTypesetOne{<raw_coeff>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#id9" id="id92"><span class="docutils literal">\PolTypesetMonomialCmd</span></a></p></li> -<li><p><a class="reference internal" href="#poltypesetcmdprefix-raw-coeff" id="id93"><span class="docutils literal"><span class="pre">\PolTypesetCmdPrefix{<raw_coeff>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poltypesetone-raw-coeff" id="id81"><span class="docutils literal"><span class="pre">\PolTypesetOne{<raw_coeff>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#id9" id="id82"><span class="docutils literal">\PolTypesetMonomialCmd</span></a></p></li> +<li><p><a class="reference internal" href="#poltypesetcmdprefix-raw-coeff" id="id83"><span class="docutils literal"><span class="pre">\PolTypesetCmdPrefix{<raw_coeff>}</span></span></a></p></li> </ul> </li> -<li><p><a class="reference internal" href="#id11" id="id94"><span class="docutils literal"><span class="pre">\PolTypeset*{<pol.</span> <span class="pre">expr.>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#non-expandable-macros-related-to-the-root-localization-routines" id="id95">Non-expandable macros related to the root localization routines</a></p> +<li><p><a class="reference internal" href="#id11" id="id84"><span class="docutils literal"><span class="pre">\PolTypeset*{<pol.</span> <span class="pre">expr.>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#non-expandable-macros-related-to-the-root-localization-routines" id="id85">Non-expandable macros related to the root localization routines</a></p> <ul> -<li><p><a class="reference internal" href="#poltosturm-polname-sturmname" id="id96"><span class="docutils literal"><span class="pre">\PolToSturm{<polname>}{<sturmname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#id13" id="id97"><span class="docutils literal"><span class="pre">\PolToSturm*{<polname>}{<sturmname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmisolatezeros-sturmname" id="id98"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros{<sturmname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#id15" id="id99"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros*{<sturmname>}</span></span></a></p> +<li><p><a class="reference internal" href="#poltosturm-polname-sturmname" id="id86"><span class="docutils literal"><span class="pre">\PolToSturm{<polname>}{<sturmname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#id13" id="id87"><span class="docutils literal"><span class="pre">\PolToSturm*{<polname>}{<sturmname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmisolatezeros-sturmname" id="id88"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros{<sturmname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#id15" id="id89"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros*{<sturmname>}</span></span></a></p> <ul> -<li><p><a class="reference internal" href="#polsturmisolatezerosandgetmultiplicities-sturmname" id="id100"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndGetMultiplicities{<sturmname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmisolatezerosandgetmultiplicities-sturmname" id="id90"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndGetMultiplicities{<sturmname>}</span></span></a></p></li> </ul> </li> -<li><p><a class="reference internal" href="#id17" id="id101"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros**{<sturmname>}</span></span></a></p> +<li><p><a class="reference internal" href="#id17" id="id91"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros**{<sturmname>}</span></span></a></p> <ul> -<li><p><a class="reference internal" href="#polsturmisolatezerosgetmultiplicitiesandrationalroots-sturmname" id="id102"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosGetMultiplicitiesAndRationalRoots{<sturmname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmisolatezerosgetmultiplicitiesandrationalroots-sturmname" id="id92"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosGetMultiplicitiesAndRationalRoots{<sturmname>}</span></span></a></p></li> </ul> </li> -<li><p><a class="reference internal" href="#polsturmisolatezerosandfindrationalroots-sturmname" id="id103"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndFindRationalRoots{<sturmname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polrefineinterval-sturmname-index" id="id104"><span class="docutils literal"><span class="pre">\PolRefineInterval*{<sturmname>}{<index>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polrefineinterval-n-sturmname-index" id="id105"><span class="docutils literal"><span class="pre">\PolRefineInterval[N]{<sturmname>}{<index>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polensureintervallength-sturmname-index-exponent" id="id106"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLength{<sturmname>}{<index>}{<exponent>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polensureintervallengths-sturmname-exponent" id="id107"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLengths{<sturmname>}{<exponent>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervals-varname-sturmname" id="id108"><span class="docutils literal"><span class="pre">\PolPrintIntervals[<varname>]{<sturmname>}</span></span></a></p> +<li><p><a class="reference internal" href="#polsturmisolatezerosandfindrationalroots-sturmname" id="id93"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndFindRationalRoots{<sturmname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polrefineinterval-sturmname-index" id="id94"><span class="docutils literal"><span class="pre">\PolRefineInterval*{<sturmname>}{<index>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polrefineinterval-n-sturmname-index" id="id95"><span class="docutils literal"><span class="pre">\PolRefineInterval[N]{<sturmname>}{<index>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polensureintervallength-sturmname-index-exponent" id="id96"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLength{<sturmname>}{<index>}{<exponent>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polensureintervallengths-sturmname-exponent" id="id97"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLengths{<sturmname>}{<exponent>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervals-varname-sturmname" id="id98"><span class="docutils literal"><span class="pre">\PolPrintIntervals[<varname>]{<sturmname>}</span></span></a></p> <ul> -<li><p><a class="reference internal" href="#polprintintervalsnorealroots" id="id109"><span class="docutils literal">\PolPrintIntervalsNoRealRoots</span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervalsbeginenv" id="id110"><span class="docutils literal">\PolPrintIntervalsBeginEnv</span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervalsendenv" id="id111"><span class="docutils literal">\PolPrintIntervalsEndEnv</span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervalsknownroot" id="id112"><span class="docutils literal">\PolPrintIntervalsKnownRoot</span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervalsunknownroot" id="id113"><span class="docutils literal">\PolPrintIntervalsUnknownRoot</span></a></p></li> -<li><p><a class="reference internal" href="#id18" id="id114"><span class="docutils literal">\PolPrintIntervalsPrintExactZero</span></a></p></li> -<li><p><a class="reference internal" href="#id19" id="id115"><span class="docutils literal">\PolPrintIntervalsPrintLeftEndPoint</span></a></p></li> -<li><p><a class="reference internal" href="#id20" id="id116"><span class="docutils literal">\PolPrintIntervalsPrintRightEndPoint</span></a></p></li> -</ul> -</li> -<li><p><a class="reference internal" href="#id22" id="id117"><span class="docutils literal"><span class="pre">\PolPrintIntervals*[<varname>]{<sturmname>}</span></span></a></p> +<li><p><a class="reference internal" href="#polprintintervalsnorealroots" id="id99"><span class="docutils literal">\PolPrintIntervalsNoRealRoots</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalsbeginenv" id="id100"><span class="docutils literal">\PolPrintIntervalsBeginEnv</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalsendenv" id="id101"><span class="docutils literal">\PolPrintIntervalsEndEnv</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalsrowseparator" id="id102"><span class="docutils literal">\PolPrintIntervalsRowSeparator</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalsknownroot" id="id103"><span class="docutils literal">\PolPrintIntervalsKnownRoot</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalsunknownroot" id="id104"><span class="docutils literal">\PolPrintIntervalsUnknownRoot</span></a></p></li> +<li><p><a class="reference internal" href="#id18" id="id105"><span class="docutils literal">\PolPrintIntervalsPrintExactZero</span></a></p></li> +<li><p><a class="reference internal" href="#id19" id="id106"><span class="docutils literal">\PolPrintIntervalsPrintLeftEndPoint</span></a></p></li> +<li><p><a class="reference internal" href="#id20" id="id107"><span class="docutils literal">\PolPrintIntervalsPrintRightEndPoint</span></a></p></li> +</ul> +</li> +<li><p><a class="reference internal" href="#id22" id="id108"><span class="docutils literal"><span class="pre">\PolPrintIntervals*[<varname>]{<sturmname>}</span></span></a></p> <ul> -<li><p><a class="reference internal" href="#polprintintervalsprintmultiplicity" id="id118"><span class="docutils literal">\PolPrintIntervalsPrintMultiplicity</span></a></p></li> -</ul> -</li> -<li><p><a class="reference internal" href="#polsettosturmchainsignchangesat-foo-sturmname-value" id="id119"><span class="docutils literal"><span class="pre">\PolSetToSturmChainSignChangesAt{\foo}{<sturmname>}{<value>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsettonbofzeroswithin-foo-sturmname-value-left-value-right" id="id120"><span class="docutils literal"><span class="pre">\PolSetToNbOfZerosWithin{\foo}{<sturmname>}{<value_left>}{<value_right>}</span></span></a></p></li> -</ul> -</li> -<li><p><a class="reference internal" href="#pollet-polname-2-polname-1" id="id121"><span class="docutils literal"><span class="pre">\PolLet{<polname_2>}={<polname_1>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polgloballet-polname-2-polname-1" id="id122"><span class="docutils literal"><span class="pre">\PolGlobalLet{<polname_2>}={<polname_1>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polassign-polname-toarray-macro" id="id123"><span class="docutils literal"><span class="pre">\PolAssign{<polname>}\toarray\macro</span></span></a></p></li> -<li><p><a class="reference internal" href="#polget-polname-fromarray-macro" id="id124"><span class="docutils literal"><span class="pre">\PolGet{<polname>}\fromarray\macro</span></span></a></p></li> -<li><p><a class="reference internal" href="#polfromcsv-polname-csv" id="id125"><span class="docutils literal"><span class="pre">\PolFromCSV{<polname>}{<csv>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polmapcoeffs-macro-polname" id="id126"><span class="docutils literal"><span class="pre">\PolMapCoeffs{\macro}{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polreducecoeffs-polname" id="id127"><span class="docutils literal"><span class="pre">\PolReduceCoeffs{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#id24" id="id128"><span class="docutils literal"><span class="pre">\PolReduceCoeffs*{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polmakemonic-polname" id="id129"><span class="docutils literal"><span class="pre">\PolMakeMonic{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polmakeprimitive-polname" id="id130"><span class="docutils literal"><span class="pre">\PolMakePrimitive{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poldiff-polname-1-polname-2" id="id131"><span class="docutils literal"><span class="pre">\PolDiff{<polname_1>}{<polname_2>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poldiff-n-polname-1-polname-2" id="id132"><span class="docutils literal"><span class="pre">\PolDiff[N]{<polname_1>}{<polname_2>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polantidiff-polname-1-polname-2" id="id133"><span class="docutils literal"><span class="pre">\PolAntiDiff{<polname_1>}{<polname_2>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polantidiff-n-polname-1-polname-2" id="id134"><span class="docutils literal"><span class="pre">\PolAntiDiff[N]{<polname_1>}{<polname_2>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poldivide-polname-1-polname-2-polname-q-polname-r" id="id135"><span class="docutils literal"><span class="pre">\PolDivide{<polname_1>}{<polname_2>}{<polname_Q>}{<polname_R>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polquo-polname-1-polname-2-polname-q" id="id136"><span class="docutils literal"><span class="pre">\PolQuo{<polname_1>}{<polname_2>}{<polname_Q>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polrem-polname-1-polname-2-polname-r" id="id137"><span class="docutils literal"><span class="pre">\PolRem{<polname_1>}{<polname_2>}{<polname_R>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polgcd-polname-1-polname-2-polname-gcd" id="id138"><span class="docutils literal"><span class="pre">\PolGCD{<polname_1>}{<polname_2>}{<polname_GCD>}</span></span></a></p></li> -</ul> -</li> -<li><p><a class="reference internal" href="#expandable-macros" id="id139">Expandable macros</a></p> +<li><p><a class="reference internal" href="#polprintintervalsprintmultiplicity" id="id109"><span class="docutils literal">\PolPrintIntervalsPrintMultiplicity</span></a></p></li> +</ul> +</li> +<li><p><a class="reference internal" href="#polsettosturmchainsignchangesat-foo-sturmname-value" id="id110"><span class="docutils literal"><span class="pre">\PolSetToSturmChainSignChangesAt{\foo}{<sturmname>}{<value>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsettonbofzeroswithin-foo-sturmname-value-left-value-right" id="id111"><span class="docutils literal"><span class="pre">\PolSetToNbOfZerosWithin{\foo}{<sturmname>}{<value_left>}{<value_right>}</span></span></a></p></li> +</ul> +</li> +<li><p><a class="reference internal" href="#pollet-polname-2-polname-1" id="id112"><span class="docutils literal"><span class="pre">\PolLet{<polname_2>}={<polname_1>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polgloballet-polname-2-polname-1" id="id113"><span class="docutils literal"><span class="pre">\PolGlobalLet{<polname_2>}={<polname_1>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polassign-polname-toarray-macro" id="id114"><span class="docutils literal"><span class="pre">\PolAssign{<polname>}\toarray\macro</span></span></a></p></li> +<li><p><a class="reference internal" href="#polget-polname-fromarray-macro" id="id115"><span class="docutils literal"><span class="pre">\PolGet{<polname>}\fromarray\macro</span></span></a></p></li> +<li><p><a class="reference internal" href="#polfromcsv-polname-csv" id="id116"><span class="docutils literal"><span class="pre">\PolFromCSV{<polname>}{<csv>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polmapcoeffs-macro-polname" id="id117"><span class="docutils literal"><span class="pre">\PolMapCoeffs{\macro}{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polreducecoeffs-polname" id="id118"><span class="docutils literal"><span class="pre">\PolReduceCoeffs{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#id24" id="id119"><span class="docutils literal"><span class="pre">\PolReduceCoeffs*{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polmakemonic-polname" id="id120"><span class="docutils literal"><span class="pre">\PolMakeMonic{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polmakeprimitive-polname" id="id121"><span class="docutils literal"><span class="pre">\PolMakePrimitive{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poldiff-polname-1-polname-2" id="id122"><span class="docutils literal"><span class="pre">\PolDiff{<polname_1>}{<polname_2>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poldiff-n-polname-1-polname-2" id="id123"><span class="docutils literal"><span class="pre">\PolDiff[N]{<polname_1>}{<polname_2>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polantidiff-polname-1-polname-2" id="id124"><span class="docutils literal"><span class="pre">\PolAntiDiff{<polname_1>}{<polname_2>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polantidiff-n-polname-1-polname-2" id="id125"><span class="docutils literal"><span class="pre">\PolAntiDiff[N]{<polname_1>}{<polname_2>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poldivide-polname-1-polname-2-polname-q-polname-r" id="id126"><span class="docutils literal"><span class="pre">\PolDivide{<polname_1>}{<polname_2>}{<polname_Q>}{<polname_R>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polquo-polname-1-polname-2-polname-q" id="id127"><span class="docutils literal"><span class="pre">\PolQuo{<polname_1>}{<polname_2>}{<polname_Q>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polrem-polname-1-polname-2-polname-r" id="id128"><span class="docutils literal"><span class="pre">\PolRem{<polname_1>}{<polname_2>}{<polname_R>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polgcd-polname-1-polname-2-polname-gcd" id="id129"><span class="docutils literal"><span class="pre">\PolGCD{<polname_1>}{<polname_2>}{<polname_GCD>}</span></span></a></p></li> +</ul> +</li> +<li><p><a class="reference internal" href="#expandable-macros" id="id130">Expandable macros</a></p> <ul> -<li><p><a class="reference internal" href="#poltoexpr-pol-expr" id="id140"><span class="docutils literal"><span class="pre">\PolToExpr{<pol.</span> <span class="pre">expr.>}</span></span></a></p> +<li><p><a class="reference internal" href="#poltoexpr-pol-expr" id="id131"><span class="docutils literal"><span class="pre">\PolToExpr{<pol.</span> <span class="pre">expr.>}</span></span></a></p> <ul> -<li><p><a class="reference internal" href="#id27" id="id141"><span class="docutils literal">\PolToExprVar</span></a></p></li> -<li><p><a class="reference internal" href="#poltoexprinvar" id="id142"><span class="docutils literal">\PolToExprInVar</span></a></p></li> -<li><p><a class="reference internal" href="#id28" id="id143"><span class="docutils literal">\PolToExprTimes</span></a></p></li> -<li><p><a class="reference internal" href="#poltoexprcaret" id="id144"><span class="docutils literal">\PolToExprCaret</span></a></p></li> -<li><p><a class="reference internal" href="#poltoexprcmd-raw-coeff" id="id145"><span class="docutils literal"><span class="pre">\PolToExprCmd{<raw_coeff>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poltoexproneterm-raw-coeff-exponent" id="id146"><span class="docutils literal"><span class="pre">\PolToExprOneTerm{<raw_coeff>}{<exponent>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poltoexpronetermstylea-raw-coeff-exponent" id="id147"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleA{<raw_coeff>}{<exponent>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poltoexpronetermstyleb-raw-coeff-exponent" id="id148"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleB{<raw_coeff>}{<exponent>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poltoexprtermprefix-raw-coeff" id="id149"><span class="docutils literal"><span class="pre">\PolToExprTermPrefix{<raw_coeff>}</span></span></a></p></li> -</ul> -</li> -<li><p><a class="reference internal" href="#poltofloatexpr-pol-expr" id="id150"><span class="docutils literal"><span class="pre">\PolToFloatExpr{<pol.</span> <span class="pre">expr.>}</span></span></a></p> +<li><p><a class="reference internal" href="#id27" id="id132"><span class="docutils literal">\PolToExprVar</span></a></p></li> +<li><p><a class="reference internal" href="#poltoexprinvar" id="id133"><span class="docutils literal">\PolToExprInVar</span></a></p></li> +<li><p><a class="reference internal" href="#id28" id="id134"><span class="docutils literal">\PolToExprTimes</span></a></p></li> +<li><p><a class="reference internal" href="#poltoexprcaret" id="id135"><span class="docutils literal">\PolToExprCaret</span></a></p></li> +<li><p><a class="reference internal" href="#poltoexprcmd-raw-coeff" id="id136"><span class="docutils literal"><span class="pre">\PolToExprCmd{<raw_coeff>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poltoexproneterm-raw-coeff-exponent" id="id137"><span class="docutils literal"><span class="pre">\PolToExprOneTerm{<raw_coeff>}{<exponent>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poltoexpronetermstylea-raw-coeff-exponent" id="id138"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleA{<raw_coeff>}{<exponent>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poltoexpronetermstyleb-raw-coeff-exponent" id="id139"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleB{<raw_coeff>}{<exponent>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poltoexprtermprefix-raw-coeff" id="id140"><span class="docutils literal"><span class="pre">\PolToExprTermPrefix{<raw_coeff>}</span></span></a></p></li> +</ul> +</li> +<li><p><a class="reference internal" href="#poltofloatexpr-pol-expr" id="id141"><span class="docutils literal"><span class="pre">\PolToFloatExpr{<pol.</span> <span class="pre">expr.>}</span></span></a></p> <ul> -<li><p><a class="reference internal" href="#poltofloatexproneterm-raw-coeff-exponent" id="id151"><span class="docutils literal"><span class="pre">\PolToFloatExprOneTerm{<raw_coeff>}{<exponent>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poltofloatexprcmd-raw-coeff" id="id152"><span class="docutils literal"><span class="pre">\PolToFloatExprCmd{<raw_coeff>}</span></span></a></p></li> -</ul> -</li> -<li><p><a class="reference internal" href="#id30" id="id153"><span class="docutils literal"><span class="pre">\PolToExpr*{<pol.</span> <span class="pre">expr.>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#id32" id="id154"><span class="docutils literal"><span class="pre">\PolToFloatExpr*{<pol.</span> <span class="pre">expr.>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polnthcoeff-polname-index" id="id155"><span class="docutils literal"><span class="pre">\PolNthCoeff{<polname>}{<index>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polleadingcoeff-polname" id="id156"><span class="docutils literal"><span class="pre">\PolLeadingCoeff{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poldegree-polname" id="id157"><span class="docutils literal"><span class="pre">\PolDegree{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#policontent-polname" id="id158"><span class="docutils literal"><span class="pre">\PolIContent{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poltolist-polname" id="id159"><span class="docutils literal"><span class="pre">\PolToList{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poltocsv-polname" id="id160"><span class="docutils literal"><span class="pre">\PolToCSV{<polname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poleval-polname-atexpr-num-expr" id="id161"><span class="docutils literal"><span class="pre">\PolEval{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#poleval-polname-at-value" id="id162"><span class="docutils literal"><span class="pre">\PolEval{<polname>}\At{<value>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polevalreduced-polname-atexpr-num-expr" id="id163"><span class="docutils literal"><span class="pre">\PolEvalReduced{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polevalreduced-polname-at-value" id="id164"><span class="docutils literal"><span class="pre">\PolEvalReduced{<polname>}\At{<value>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polfloateval-polname-atexpr-num-expr" id="id165"><span class="docutils literal"><span class="pre">\PolFloatEval{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polfloateval-polname-at-value" id="id166"><span class="docutils literal"><span class="pre">\PolFloatEval{<polname>}\At{<value>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#expandable-macros-related-to-the-root-localization-routines" id="id167">Expandable macros related to the root localization routines</a></p> +<li><p><a class="reference internal" href="#poltofloatexproneterm-raw-coeff-exponent" id="id142"><span class="docutils literal"><span class="pre">\PolToFloatExprOneTerm{<raw_coeff>}{<exponent>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poltofloatexprcmd-raw-coeff" id="id143"><span class="docutils literal"><span class="pre">\PolToFloatExprCmd{<raw_coeff>}</span></span></a></p></li> +</ul> +</li> +<li><p><a class="reference internal" href="#id30" id="id144"><span class="docutils literal"><span class="pre">\PolToExpr*{<pol.</span> <span class="pre">expr.>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#id32" id="id145"><span class="docutils literal"><span class="pre">\PolToFloatExpr*{<pol.</span> <span class="pre">expr.>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polnthcoeff-polname-index" id="id146"><span class="docutils literal"><span class="pre">\PolNthCoeff{<polname>}{<index>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polleadingcoeff-polname" id="id147"><span class="docutils literal"><span class="pre">\PolLeadingCoeff{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poldegree-polname" id="id148"><span class="docutils literal"><span class="pre">\PolDegree{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#policontent-polname" id="id149"><span class="docutils literal"><span class="pre">\PolIContent{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poltolist-polname" id="id150"><span class="docutils literal"><span class="pre">\PolToList{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poltocsv-polname" id="id151"><span class="docutils literal"><span class="pre">\PolToCSV{<polname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poleval-polname-atexpr-num-expr" id="id152"><span class="docutils literal"><span class="pre">\PolEval{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#poleval-polname-at-value" id="id153"><span class="docutils literal"><span class="pre">\PolEval{<polname>}\At{<value>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polevalreduced-polname-atexpr-num-expr" id="id154"><span class="docutils literal"><span class="pre">\PolEvalReduced{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polevalreduced-polname-at-value" id="id155"><span class="docutils literal"><span class="pre">\PolEvalReduced{<polname>}\At{<value>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polfloateval-polname-atexpr-num-expr" id="id156"><span class="docutils literal"><span class="pre">\PolFloatEval{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polfloateval-polname-at-value" id="id157"><span class="docutils literal"><span class="pre">\PolFloatEval{<polname>}\At{<value>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#expandable-macros-related-to-the-root-localization-routines" id="id158">Expandable macros related to the root localization routines</a></p> <ul> -<li><p><a class="reference internal" href="#polsturmchainlength-sturmname" id="id168"><span class="docutils literal"><span class="pre">\PolSturmChainLength{<sturmname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmifzeroexactlyknown-sturmname-index-t-f" id="id169"><span class="docutils literal"><span class="pre">\PolSturmIfZeroExactlyKnown{<sturmname>}{<index>}{T}{F}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmisolatedzeroleft-sturmname-index" id="id170"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroLeft{<sturmname>}{<index>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmisolatedzeroright-sturmname-index" id="id171"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroRight{<sturmname>}{<index>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmisolatedzeromultiplicity-sturmname-index" id="id172"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroMultiplicity{<sturmname>}{<index>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmnbofisolatedzeros-sturmname" id="id173"><span class="docutils literal"><span class="pre">\PolSturmNbOfIsolatedZeros{<sturmname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequalto-value" id="id174"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{<sturmname>}\LessThanOrEqualTo{<value>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequaltoexpr-num-expr" id="id175"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{<sturmname>}\LessThanOrEqualToExpr{<num.</span> <span class="pre">expr.>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmnbwithmultofrootsof-sturmname-lessthanorequalto-value" id="id176"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{<sturmname>}\LessThanOrEqualTo{<value>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmnbwithmultofrootsof-sturmname-lessthanorequaltoexpr-num-expr" id="id177"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{<sturmname>}\LessThanOrEqualToExpr{<num.</span> <span class="pre">expr.>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmnbofrationalroots-sturmname" id="id178"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRoots{<sturmname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmnbofrationalrootswithmultiplicities-sturmname" id="id179"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRootsWithMultiplicities{<sturmname>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmrationalroot-sturmname-k" id="id180"><span class="docutils literal"><span class="pre">\PolSturmRationalRoot{<sturmname>}{<k>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmrationalrootindex-sturmname-k" id="id181"><span class="docutils literal"><span class="pre">\PolSturmRationalRootIndex{<sturmname>}{<k>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polsturmrationalrootmultiplicity-sturmname-k" id="id182"><span class="docutils literal"><span class="pre">\PolSturmRationalRootMultiplicity{<sturmname>}{<k>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#polintervalwidth-sturmname-index" id="id183"><span class="docutils literal"><span class="pre">\PolIntervalWidth{<sturmname>}{<index>}</span></span></a></p></li> -<li><p><a class="reference internal" href="#expandable-macros-for-use-within-execution-of-polprintintervals" id="id184">Expandable macros for use within execution of <span class="docutils literal">\PolPrintIntervals</span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervalsthevar" id="id185"><span class="docutils literal">\PolPrintIntervalsTheVar</span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervalstheindex" id="id186"><span class="docutils literal">\PolPrintIntervalsTheIndex</span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervalsthesturmname" id="id187"><span class="docutils literal">\PolPrintIntervalsTheSturmName</span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervalstheleftendpoint" id="id188"><span class="docutils literal">\PolPrintIntervalsTheLeftEndPoint</span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervalstherightendpoint" id="id189"><span class="docutils literal">\PolPrintIntervalsTheRightEndPoint</span></a></p></li> -<li><p><a class="reference internal" href="#polprintintervalsthemultiplicity" id="id190"><span class="docutils literal">\PolPrintIntervalsTheMultiplicity</span></a></p></li> -</ul> -</li> -</ul> -</li> -<li><p><a class="reference internal" href="#booleans-with-default-setting-as-indicated" id="id191">Booleans (with default setting as indicated)</a></p> +<li><p><a class="reference internal" href="#polsturmchainlength-sturmname" id="id159"><span class="docutils literal"><span class="pre">\PolSturmChainLength{<sturmname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmifzeroexactlyknown-sturmname-index-t-f" id="id160"><span class="docutils literal"><span class="pre">\PolSturmIfZeroExactlyKnown{<sturmname>}{<index>}{T}{F}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmisolatedzeroleft-sturmname-index" id="id161"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroLeft{<sturmname>}{<index>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmisolatedzeroright-sturmname-index" id="id162"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroRight{<sturmname>}{<index>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmisolatedzeromultiplicity-sturmname-index" id="id163"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroMultiplicity{<sturmname>}{<index>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmnbofisolatedzeros-sturmname" id="id164"><span class="docutils literal"><span class="pre">\PolSturmNbOfIsolatedZeros{<sturmname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequalto-value" id="id165"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{<sturmname>}\LessThanOrEqualTo{<value>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequaltoexpr-num-expr" id="id166"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{<sturmname>}\LessThanOrEqualToExpr{<num.</span> <span class="pre">expr.>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmnbwithmultofrootsof-sturmname-lessthanorequalto-value" id="id167"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{<sturmname>}\LessThanOrEqualTo{<value>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmnbwithmultofrootsof-sturmname-lessthanorequaltoexpr-num-expr" id="id168"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{<sturmname>}\LessThanOrEqualToExpr{<num.</span> <span class="pre">expr.>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmnbofrationalroots-sturmname" id="id169"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRoots{<sturmname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmnbofrationalrootswithmultiplicities-sturmname" id="id170"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRootsWithMultiplicities{<sturmname>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmrationalroot-sturmname-k" id="id171"><span class="docutils literal"><span class="pre">\PolSturmRationalRoot{<sturmname>}{<k>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmrationalrootindex-sturmname-k" id="id172"><span class="docutils literal"><span class="pre">\PolSturmRationalRootIndex{<sturmname>}{<k>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polsturmrationalrootmultiplicity-sturmname-k" id="id173"><span class="docutils literal"><span class="pre">\PolSturmRationalRootMultiplicity{<sturmname>}{<k>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#polintervalwidth-sturmname-index" id="id174"><span class="docutils literal"><span class="pre">\PolIntervalWidth{<sturmname>}{<index>}</span></span></a></p></li> +<li><p><a class="reference internal" href="#expandable-macros-for-use-within-execution-of-polprintintervals" id="id175">Expandable macros for use within execution of <span class="docutils literal">\PolPrintIntervals</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalsthevar" id="id176"><span class="docutils literal">\PolPrintIntervalsTheVar</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalstheindex" id="id177"><span class="docutils literal">\PolPrintIntervalsTheIndex</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalsthesturmname" id="id178"><span class="docutils literal">\PolPrintIntervalsTheSturmName</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalstheleftendpoint" id="id179"><span class="docutils literal">\PolPrintIntervalsTheLeftEndPoint</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalstherightendpoint" id="id180"><span class="docutils literal">\PolPrintIntervalsTheRightEndPoint</span></a></p></li> +<li><p><a class="reference internal" href="#polprintintervalsthemultiplicity" id="id181"><span class="docutils literal">\PolPrintIntervalsTheMultiplicity</span></a></p></li> +</ul> +</li> +</ul> +</li> +<li><p><a class="reference internal" href="#booleans-with-default-setting-as-indicated" id="id182">Booleans (with default setting as indicated)</a></p> <ul> -<li><p><a class="reference internal" href="#xintverbosefalse" id="id192"><span class="docutils literal">\xintverbosefalse</span></a></p></li> -<li><p><a class="reference internal" href="#polnewpolverbosefalse" id="id193"><span class="docutils literal">\polnewpolverbosefalse</span></a></p></li> -<li><p><a class="reference internal" href="#poltypesetallfalse" id="id194"><span class="docutils literal">\poltypesetallfalse</span></a></p></li> -<li><p><a class="reference internal" href="#poltoexprallfalse" id="id195"><span class="docutils literal">\poltoexprallfalse</span></a></p></li> +<li><p><a class="reference internal" href="#xintverbosefalse" id="id183"><span class="docutils literal">\xintverbosefalse</span></a></p></li> +<li><p><a class="reference internal" href="#polnewpolverbosefalse" id="id184"><span class="docutils literal">\polnewpolverbosefalse</span></a></p></li> +<li><p><a class="reference internal" href="#poltypesetallfalse" id="id185"><span class="docutils literal">\poltypesetallfalse</span></a></p></li> +<li><p><a class="reference internal" href="#poltoexprallfalse" id="id186"><span class="docutils literal">\poltoexprallfalse</span></a></p></li> </ul> </li> -<li><p><a class="reference internal" href="#utilies" id="id196">Utilies</a></p> +<li><p><a class="reference internal" href="#utilies" id="id187">Utilies</a></p> <ul> -<li><p><a class="reference internal" href="#poldectostring-decimal-number" id="id197"><span class="docutils literal">\PolDecToString{decimal number}</span></a></p></li> -<li><p><a class="reference internal" href="#polexprsetup" id="id198"><span class="docutils literal">\polexprsetup</span></a></p></li> +<li><p><a class="reference internal" href="#poldectostring-decimal-number" id="id188"><span class="docutils literal">\PolDecToString{decimal number}</span></a></p></li> +<li><p><a class="reference internal" href="#polexprsetup" id="id189"><span class="docutils literal">\polexprsetup</span></a></p></li> </ul> </li> -<li><p><a class="reference internal" href="#technicalities" id="id199">Technicalities</a></p></li> -<li><p><a class="reference internal" href="#change-log" id="id200">CHANGE LOG</a></p></li> -<li><p><a class="reference internal" href="#acknowledgments" id="id201">Acknowledgments</a></p></li> +<li><p><a class="reference internal" href="#technicalities" id="id190">Technicalities</a></p></li> +<li><p><a class="reference internal" href="#change-log" id="id191">CHANGE LOG</a></p></li> +<li><p><a class="reference internal" href="#acknowledgments" id="id192">Acknowledgments</a></p></li> </ul> </div> -<div class="section" id="usage"> -<h1><a class="toc-backref" href="#id35">Usage</a></h1> -<p>The package can be used with TeX based formats incorporating the e-TeX -primitives. The <span class="docutils literal">\expanded</span> primitive available generally since -TeXLive 2019 is required.</p> -<pre class="literal-block">\input polexpr.sty</pre> -<p>with Plain or other non-LaTeX macro formats, or:</p> -<pre class="literal-block">\usepackage{polexpr}</pre> -<p>with the LaTeX macro format.</p> -<p>The package requires <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> <span class="docutils literal">1.4d</span> or later.</p> -<div class="admonition note"> -<p class="admonition-title">Note</p> -<p>Until <span class="docutils literal">0.8</span> the package only had a LaTeX interface. As a result, -parts of this documentation may still give examples using LaTeX syntax such -as <span class="docutils literal">\newcommand</span>. Please convert to the syntax appropriate to the -TeX macro format used if needed.</p> -</div> -</div> -<div class="section" id="abstract"> -<h1><a class="toc-backref" href="#id36">Abstract</a></h1> -<p>The package provides a parser <span class="docutils literal">\poldef</span> of algebraic polynomial -expressions. As it is based on <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> -the coefficients are allowed to be arbitrary rational numbers.</p> -<p>Once defined, a polynomial is usable by its name either as a numerical -function in <span class="docutils literal"><span class="pre">\xintexpr/\xinteval</span></span>, or for additional polynomial -definitions, or as argument to the package macros. The localization of -real roots to arbitrary precision as well as the determination of all -rational roots is implemented via such macros.</p> -<p>Since release <span class="docutils literal">0.8</span>, polexpr extends the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> -syntax to recognize -polynomials as a new variable type (and not only as functions). -Functionality which previously was implemented via macros such as the -computation of a greatest common divisor is now available directly in -<span class="docutils literal">\xintexpr</span>, <span class="docutils literal">\xinteval</span> or <span class="docutils literal">\poldef</span> via infix or functional -syntax.</p> -</div> -<div class="section" id="prerequisites"> -<h1><a class="toc-backref" href="#id37">Prerequisites</a></h1> -<ul> -<li><p>The user must have some understanding of TeX as a macro-expansion -based programming interface, and in particular of how <span class="docutils literal">\edef</span> -differs from <span class="docutils literal">\def</span>: functionalities of the package as described in -the <a class="reference internal" href="#expandable-macros">Expandable macros</a> section are suitable for usage in <span class="docutils literal">\edef</span>, -<span class="docutils literal">\write</span> or <span class="docutils literal">\xinteval</span> context. At <span class="docutils literal">0.8</span> some of these -macros have an even more convenient functional interface inside -<span class="docutils literal">\xinteval</span>, as is described in a <a class="reference internal" href="#polexpr08">dedicated section</a>.</p> -<p>Despite its name <span class="docutils literal">\poldef</span> is more to be seen as an <span class="docutils literal">\edef</span> -although it does not define a TeX macro (at user level); and of course -<span class="docutils literal">\edef</span> would do usually nothing on the typical input parsed by -<span class="docutils literal">\poldef</span> which generally has no backslash in it: but if this input -does contain macros, they will then be expanded fully and are supposed to -produce recognizable syntax elements in this expansion only context.</p> -<p>Note that the <span class="docutils literal">def</span> in <span class="docutils literal">\poldef</span> reminds us that the macro does -some assignments hence is not usable in expandable only context. Its -whole point is rather to define entities which, them, can then be used -in the expandable only <span class="docutils literal">\xinteval</span> (or <span class="docutils literal">\poldef</span>) context.</p> -</li> -<li><p>The user must have some familiarity with <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> and in -particular must know what <span class="docutils literal">\xintexpr</span>, <span class="docutils literal">\xinttheexpr</span>, -<span class="docutils literal">\xinteval</span> and <span class="docutils literal">\xintfloatexpr</span>, <span class="docutils literal">\xintthefloatexpr</span>, -<span class="docutils literal">\xintfloateval</span> mean and what are the good practices with them.</p></li> -<li><p>The user will become quickly aware that exact computations with -fractions easily lead to very big ones in very few steps; see -<a class="reference internal" href="#polreducecoeffs-polname">\PolReduceCoeffs{<polname>}</a> in this context.</p></li> -<li><p>Finally, it is mandatory to read the entire documentation before -starting to use the package.</p></li> -</ul> </div> <div class="section" id="quick-syntax-overview"> <h1><a class="toc-backref" href="#id38">Quick syntax overview</a></h1> <p>The syntax to define a new polynomial is:</p> <pre class="literal-block">\poldef polname(x):= expression in variable x;</pre> <p>The package is focused on exact computations, so this expression will be -parsed by the services of <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> and accept arbitrarily big integers +parsed by the services of <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> and accept arbitrarily big integers or fractions.</p> <p>If you are interested into numerical evaluations, for example for plotting, it is advisable to use the <span class="docutils literal"><span class="pre">\xintfloatexpr/\xintfloateval</span></span> context, as exact evaluations will quickly lead to manipulating numbers with dozens of digits (when the number of digits exceeds five hundreds, -computation with <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> will become noticeably too slow, if many +computation with <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> will become noticeably too slow, if many evaluations need to be done). For the polynomial to be usable as a function in floating point context, an extra step beyond <span class="docutils literal">\poldef</span> is required: see <a class="reference internal" href="#polgenfloatvariant">\PolGenFloatVariant</a>.</p> @@ -910,7 +898,7 @@ function, are only available in the <span class="docutils literal"><span class=" context. The <a class="reference internal" href="#polgenfloatvariant">\PolGenFloatVariant</a> must be used each time the polynomial gets modified or a new polynomial created out of it, if continuing computations in <span class="docutils literal">\xintfloatexpr</span> are to follow. But (see -<a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> documentation) one can always use a sub-expression such as +<a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> documentation) one can always use a sub-expression such as <span class="docutils literal">\xintexpr <span class="pre">deg(P)\relax</span></span> as sub-component inside a <span class="docutils literal"><span class="pre">\xintfloatexpr/\xintfloateval</span></span>.</p> <p>Conversely if perhaps the coefficients of your polynomial have become @@ -950,10 +938,10 @@ naturally no problem either if <span class="docutils literal">\poldef</span> is text of some other macro which is defined at a time the <span class="docutils literal">;</span> has its standard catcode, as is the case in LaTeX in the document preamble, even with babel+french loaded.</p> -<p>The semi-colon intervenes in certain <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> syntax elements, within +<p>The semi-colon intervenes in certain <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> syntax elements, within parentheses. This (except if the inner semi-colons are hidden within braces: <span class="docutils literal">{;}</span>) will break <span class="docutils literal">\poldef</span> which, contrarily to -<a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>'s <span class="docutils literal">\xintdefvar</span>, does not balance parentheses when +<a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a>'s <span class="docutils literal">\xintdefvar</span>, does not balance parentheses when fetching the semi-colon delimited polynomial expression.</p> </li> </ul> @@ -1000,7 +988,7 @@ But then it gives zero!</p> <span class="docutils literal"><span class="pre">(1/2)*x^2</span></span> for disambiguation: <span class="docutils literal">x - 1/2*x^2 + <span class="pre">1/3*x^3...</span></span>. It is simpler to move the denominator to the right: <span class="docutils literal">x - x^2/2 + x^3/3 - ...</span>.</p> <p>It is worth noting that <span class="docutils literal"><span class="pre">1/2(x-1)(x-2)</span></span> suffers the same issue: -<a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>'s tacit multiplication always "ties more", hence this +<a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a>'s tacit multiplication always "ties more", hence this gets interpreted as <span class="docutils literal"><span class="pre">1/(2*(x-1)*(x-2))</span></span> which gives zero by polynomial division. Thus, use in such cases one of <span class="docutils literal"><span class="pre">(1/2)(x-1)(x-2)</span></span>, <span class="docutils literal"><span class="pre">1/2*(x-1)(x-2)</span></span> or <span class="docutils literal"><span class="pre">(x-1)(x-2)/2</span></span>.</p> @@ -1042,10 +1030,10 @@ polynomials</em>.</p> as a <em>function</em>, but <em>only as a variable of polynomial type</em>. Even worse:</p> <pre class="literal-block">(P)(3)% <--- attention!</pre> -<p>will compute <span class="docutils literal">P*3</span>, because one can not in current <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> syntax +<p>will compute <span class="docutils literal">P*3</span>, because one can not in current <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> syntax enclose a function name in parentheses: consequently it is the variable which is used here. There is a <em>meager possibility</em> that in future -some internal changes to <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> would let <span class="docutils literal"><span class="pre">(P)(3)</span></span> actually +some internal changes to <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> would let <span class="docutils literal"><span class="pre">(P)(3)</span></span> actually compute <span class="docutils literal">P(3)</span> and <span class="docutils literal"><span class="pre">(P+Q)(3)</span></span> compute <span class="docutils literal">P(3) + Q(3)</span>, but note that <span class="docutils literal"><span class="pre">(P)(P)</span></span> will then do <span class="docutils literal">P(P)</span> and not <span class="docutils literal">P*P</span>, the latter, current interpretation, looking more @@ -1248,10 +1236,10 @@ about behaviour with <span class="docutils literal">pol2</span> a scalar.</p> <h2><a class="toc-backref" href="#id43">Comparison operators <span class="docutils literal"><, >, <=, >=, ==, !=</span></a></h2> <blockquote> <p><strong>NOT YET IMPLEMENTED</strong></p> -<p>As the internal representation by <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> and <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> of +<p>As the internal representation by <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> and <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> of fractions does not currently require them to be in reduced terms, such operations would be a bit costly as they could not benefit from -the <span class="docutils literal">\pdfstrcmp</span> engine primitive. In fact <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> does not use +the <span class="docutils literal">\pdfstrcmp</span> engine primitive. In fact <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> does not use it yet anywhere, even for normalized pure integers, although it could speed up signifcantly certain aspects of core arithmetic.</p> <p>Equality of polynomials can currently be tested by computing the @@ -1348,7 +1336,7 @@ required:</p> <p>If the first argument is an already declared polynomial <span class="docutils literal">P</span>, use rather the functional form <span class="docutils literal">P()</span> (which can accept a numerical as well as polynomial argument) as it is more efficient.</p> -<p>One can also use <span class="docutils literal">subs()</span> syntax <a class="footnote-reference brackets" href="#id5" id="id4">2</a> (see <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> documentation):</p> +<p>One can also use <span class="docutils literal">subs()</span> syntax <a class="footnote-reference brackets" href="#id5" id="id4">2</a> (see <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> documentation):</p> <pre class="literal-block">\poldef K(x):= subs(-3y^3-5y+1, y = -27x^4+5x-2);</pre> <p>but the <span class="docutils literal">evalp()</span> will use a Horner evaluation scheme which is usually more efficient.</p> @@ -1356,7 +1344,7 @@ usually more efficient.</p> <dt class="label" id="id5"><span class="brackets"><a class="fn-backref" href="#id4">2</a></span></dt> <dd><p>by the way Maple uses the opposite, hence wrong, order <span class="docutils literal"><span class="pre">subs(x=...,</span> P)</span> but was written before computer science -reached the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> heights. However it makes validating +reached the <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> heights. However it makes validating Maple results by polexpr sometimes cumbersome, but perhaps they will update it at some point.</p> </dd> @@ -1395,7 +1383,7 @@ polynomial...).</p> <p><strong>name unstable</strong></p> <p>I am considering in particular using <span class="docutils literal">polcoeffs()</span> to avoid having to overload <span class="docutils literal">coeffs()</span> in future when matrix type -will be added to <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>.</p> +will be added to <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a>.</p> </blockquote> </blockquote> </div> @@ -1416,7 +1404,7 @@ higher than the degree.</p> <p><strong>name, syntax and output unstable</strong></p> <p>I am hesitating with <span class="docutils literal">coeff(n,pol)</span> syntax and also perhaps using <span class="docutils literal">polcoeff()</span> in order to avoid having to overload <span class="docutils literal">coeff()</span> -when matrix type will be added to <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>.</p> +when matrix type will be added to <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a>.</p> <p>The current behaviour is at odds with legacy <a class="reference internal" href="#polnthcoeff-polname-index">\PolNthCoeff{<polname>}{<index>}</a> regarding negative indices. Accessing leading or sub-leading coefficients can be done with @@ -1431,7 +1419,7 @@ negative indices do vanish, so I am for time being maintaining this.</p> <blockquote> <p>The leading coefficient. The same result can be obtained from <span class="docutils literal"><span class="pre">coeffs(pol)[-1]</span></span>, which shows also how to generalize to access -sub-leading coefficients. See the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> documentation for +sub-leading coefficients. See the <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> documentation for Python-like indexing syntax.</p> </blockquote> </div> @@ -1443,7 +1431,7 @@ Python-like indexing syntax.</p> <p><strong>unstable</strong></p> <p>Currently the coefficients are reduced to lowest terms (contrarily to legacy behaviour of <a class="reference internal" href="#polmakemonic">\PolMakeMonic</a>), and -additionally the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> <span class="docutils literal">\xintREZ</span> macro is applied which +additionally the <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> <span class="docutils literal">\xintREZ</span> macro is applied which extracts powers of ten from numerator or denominator and stores them internally separately. This is generally beneficial to efficiency of multiplication.</p> @@ -1538,7 +1526,7 @@ coefficients polynomials.</p> <span class="docutils literal"><span class="pre">subs(last(x)/first(x),x=prem(P,Q))</span></span> syntax as it avoids computing <span class="docutils literal">prem(P,Q)</span> twice. This does the trick both in <span class="docutils literal">\poldef</span> or in <span class="docutils literal">\xintdefvar</span>.</p> -<p>However, as is explained in the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> documentation, using +<p>However, as is explained in the <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> documentation, using such syntax in an <span class="docutils literal">\xintdeffunc</span> is (a.t.t.o.w) illusory, due to technicalities of how <span class="docutils literal">subs()</span> gets converted into nested expandable macros. One needs an auxiliary function like this:</p> @@ -1593,7 +1581,7 @@ inputs vanish.</p> alternatively, only one argument which then must be a bracketed list or some expression or variable evaluating to such a "nutple" whose items are polynomials (see the documentation of the scalar <span class="docutils literal">gcd()</span> -in <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>).</p> +in <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a>).</p> <blockquote> <p>The two variable case could (and was, during development) have been defined at user level like this:</p> @@ -1656,7 +1644,7 @@ experimental status is as follows:</p> <blockquote> <p>This is currently implemented at high level via <span class="docutils literal">\xintdeffunc</span> and recursive definitions, which were copied over from a scalar example -in the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> manual:</p> +in the <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> manual:</p> <pre class="literal-block">\xintdeffunc polpowmod_(P, m, Q) := isone(m)? % m=1: return P modulo Q @@ -1759,10 +1747,13 @@ maintaining this feature whose interest appears dubious.</p> <h2><a class="toc-backref" href="#id73"><span class="docutils literal"><span class="pre">integral(<pol.</span> expr. P>, [<pol. expr. a>, <pol. expr. <span class="pre">b>])</span></span></a></h2> <blockquote> <p><span class="docutils literal">\int_a^b P(t)dt</span>.</p> +<div class="admonition warning"> +<p class="admonition-title">Warning</p> <p>The brackets here are not denoting an optional argument but a <em>mandatory</em> nutple argument <span class="docutils literal">[a, b]</span> with <em>two items</em>.</p> -<p><span class="docutils literal">a</span> and <span class="docutils literal">b</span> are not restricted to be scalars, they can be -polynomials.</p> +</div> +<p><span class="docutils literal">a</span> and <span class="docutils literal">b</span> are not restricted to be scalars, they are allowed to +be themselves polynomial variables or even polynomial expressions.</p> <blockquote> <p>To compute <span class="docutils literal"><span class="pre">\int_{x-1}^x</span> P(t)dt</span> it is more efficient to use <span class="docutils literal"><span class="pre">intfrom(x-1)</span></span>.</p> @@ -1774,431 +1765,16 @@ overhead to the pure scalar case ?</p> </blockquote> </div> </div> -<div class="section" id="examples-of-localization-of-roots"> -<h1><a class="toc-backref" href="#id74">Examples of localization of roots</a></h1> -<div class="admonition note"> -<p class="admonition-title">Note</p> -<p>As of <span class="docutils literal">0.8</span>, <span class="docutils literal">polexpr</span> is usable with Plain TeX and not only with -LaTeX, the examples of this section have been converted to use a -syntax which (at least at time of writing, March 2021) works in both.</p> -<p>This is done in order for the examples to be easy to copy-paste to -documents using either macro format.</p> -</div> -<p>This (slightly over-extended) section gives various examples of usage of -the package macros such as <a class="reference internal" href="#poltosturm">\PolToSturm</a>, <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a> -and <a class="reference internal" href="#polprintintervals">\PolPrintIntervals</a> for root localization, which exist since -release <span class="docutils literal">0.4</span> (2018/02/16). The capacity to find all rational roots -exactly was added at <span class="docutils literal">0.7.2</span> (2018/12/09).</p> -<p>The examples demonstrate that the package can find all real roots to -arbitrary precision, find the multiplicities of real roots, and find -exactly all rational roots.</p> -<p>Perhaps future releases will implement other approaches, which are known -to be generically computationally more efficient, at least in high -degrees, than the <a class="reference external" href="https://en.wikipedia.org/wiki/Sturm%27s_theorem">Sturm theorem</a> based approach. This is not -immediate priority though (perhaps support of multivariate polynomials -would be more important feature; or localization of complex roots).</p> -<ul> -<li><p>To make printed decimal numbers more enjoyable than via -<span class="docutils literal">\xintTeXsignedFrac</span> (or <span class="docutils literal">\xintTeXsignedOver</span> with Plain):</p> -<pre class="literal-block">\def\PolTypesetOne#1{\PolDecToString{\xintREZ{#1}}}%</pre> -<p><span class="docutils literal">\PolDecToString</span> will use decimal notation to incorporate the power -of ten part; and the <span class="docutils literal">\xintREZ</span> will have the effect to suppress -trailing zeros if present in raw numerator (if those digits end up -after decimal mark.) Notice that the above are expandable macros and -that one can also do:</p> -<pre class="literal-block">\def\PolToExprCmd#1{\PolDecToString{\xintREZ{#1}}}%</pre> -<p>to modify output of <a class="reference internal" href="#poltoexpr-pol-expr">\PolToExpr{<pol. expr.>}</a>.</p> -</li> -<li><p>For extra info in log file use <span class="docutils literal">\xintverbosetrue</span>.</p></li> -</ul> -<div class="admonition warning"> -<p class="admonition-title">Warning</p> -<p>Package macros related to root localization create (user-level) new -polynomials, or numeric variables, via a naming scheme which -postfixes a root name <span class="docutils literal"><sturmname></span> in various ways (see -<a class="reference internal" href="#poltosturm-polname-sturmname">\PolToSturm{<polname>}{<sturmname>}</a> and -<a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{<sturmname>}</a>). It is thus advisable to -keep the <span class="docutils literal"><sturmname></span> name-space separate from the one used to -name polynomial or scalar variables.</p> -<p>Regrettably all examples here use the condemnable -<span class="docutils literal"><span class="pre">\PolToSturm{f}{f}</span></span> practice which fuses the name-spaces. This can -lead to problems if one is not aware of the consequances.</p> -</div> -<div class="section" id="a-typical-example"> -<h2><a class="toc-backref" href="#id75">A typical example</a></h2> -<p>In this example the polynomial is square-free.</p> -<pre class="literal-block">\poldef f(x) := x^7 - x^6 - 2x + 1; - -\PolToSturm{f}{f} -\PolSturmIsolateZeros{f} -The \PolTypeset{f} polynomial has \PolSturmNbOfIsolatedZeros{f} distinct real -roots which are located in the following intervals: -\PolPrintIntervals{f} -Here is the second root with ten more decimal digits: -\PolRefineInterval[10]{f}{2} -$$\PolSturmIsolatedZeroLeft{f}{2}<Z_2<\PolSturmIsolatedZeroRight{f}{2}$$ -And here is the first root with twenty digits after decimal mark: -\PolEnsureIntervalLength{f}{1}{-20} -$$\PolSturmIsolatedZeroLeft{f}{1}<Z_1<\PolSturmIsolatedZeroRight{f}{1}$$ -The first element of the Sturm chain has degree $\PolDegree{f_0}$. As -this is the original degreee $\PolDegree{f}$ we know that $f$ is square free. -Its derivative is up to a constant \PolTypeset{f_1} (in this example -it is identical with it). -\PolToSturm{f_1}{f_1}\PolSturmIsolateZeros{f_1}% -The derivative has \PolSturmNbOfIsolatedZeros{f_1} distinct real -roots: -\PolPrintIntervals[W]{f_1} -\PolEnsureIntervalLengths{f_1}{-10}% -Here they are with ten digits after decimal mark: -\PolPrintIntervals[W]{f_1} -\PolDiff{f_1}{f''} -\PolToSturm{f''}{f''} -\PolSturmIsolateZeros{f''} -The second derivative is \PolTypeset{f''}. -It has \PolSturmNbOfIsolatedZeros{f''} distinct real -roots: -\PolPrintIntervals[X]{f''} -Here is the positive one with 20 digits after decimal mark: -\PolEnsureIntervalLength{f''}{2}{-20}% -$$X_2 = \PolSturmIsolatedZeroLeft{f''}{2}\dots$$ -The more mathematically advanced among our dear readers will be able -to give the exact value for $X_2$!</pre> -</div> -<div class="section" id="a-degree-four-polynomial-with-nearby-roots"> -<h2><a class="toc-backref" href="#id76">A degree four polynomial with nearby roots</a></h2> -<p>Notice that this example is a bit outdated as <span class="docutils literal">0.7</span> release has -added <span class="docutils literal"><span class="pre">\PolSturmIsolateZeros**{<sturmname>}</span></span> which would find exactly -the roots. The steps here retain their interest when one is interested -in finding isolating intervals for example to prepare some demonstration -of dichotomy method.</p> -<pre class="literal-block">\PolDef{Q}{(x-1.050001)(x-1.105001)(x-1.110501)(x-1.111051)} -\PolTypeset{Q} -\PolToSturm{Q}{Q} % it is allowed to use same prefix for Sturm chain -\PolSturmIsolateZeros{Q} -\PolPrintIntervals{Q} -% reports 1.0 < Z_1 < 1.1, 1.10 < Z_2 < 1.11, 1.110 < Z_3 < 1.111, and 1.111 < Z_4 < 1.112 -% but the above bounds do not allow minimizing separation between roots -% so we refine: -\PolRefineInterval*{Q}{1} -\PolRefineInterval*{Q}{2} -\PolRefineInterval*{Q}{3} -\PolRefineInterval*{Q}{4} -\PolPrintIntervals{Q} -% reports 1.05 < Z_1 < 1.06, 1.105 < Z_2 < 1.106, 1.1105 < Z_3 < 1.1106, -% and 1.11105 < Z_4 < 1.11106. -\PolEnsureIntervalLengths{Q}{-6} -\PolPrintIntervals{Q} -% of course finds here all roots exactly</pre> -</div> -<div class="section" id="the-degree-nine-polynomial-with-0-99-0-999-0-9999-as-triple-roots"> -<h2><a class="toc-backref" href="#id77">The degree nine polynomial with 0.99, 0.999, 0.9999 as triple roots</a></h2> -<pre class="literal-block">% define a user command (xinttools is loaded automatically by polexpr) -\def\showmultiplicities#1{% #1 = "sturmname" -\xintFor* ##1 in {\xintSeq{1}{\PolSturmNbOfIsolatedZeros{#1}}}\do{% - The multiplicity is \PolSturmIsolatedZeroMultiplicity{#1}{##1} - \PolSturmIfZeroExactlyKnown{#1}{##1}% - {at the root $x=\PolSturmIsolatedZeroLeft{#1}{##1}$} - {for the root such that - $\PolSturmIsolatedZeroLeft{#1}{##1}<x<\PolSturmIsolatedZeroRight{#1}{##1}$} - \par -}}% -\PolDef{f}{(x-0.99)^3(x-0.999)^3(x-0.9999)^3} -\def\PolTypesetOne#1{\PolDecToString{\xintREZ{#1}}} -\PolTypeset{f}\par -\PolToSturm{f}{f}% it is allowed to use "polname" as "sturmname" too -\PolSturmIsolateZerosAndGetMultiplicities{f}% use the "sturmname" here -% or \PolSturmIsolateZeros*{f} which is exactly the same, but shorter.. - -\showmultiplicities{f}</pre> -<p>In this example, the output will look like this (but using math mode):</p> -<pre class="literal-block">x^9 - 8.9667x^8 + 35.73400293x^7 - 83.070418400109x^6 + 124.143648875193123x^5 -- 123.683070924326075877x^4 + 82.149260397553075617891x^3 -- 35.07602992699900159127007x^2 + 8.7364078733314648368671733x -- 0.967100824643585986488103299 - -The multiplicity is 3 at the root x = 0.99 -The multiplicity is 3 at the root x = 0.999 -The multiplicity is 3 at the root x = 0.9999</pre> -<p>On first pass, these rational roots were found (due to their relative -magnitudes, using <span class="docutils literal">\PolSturmIsolateZeros**</span> was not needed here). But -multiplicity computation works also with (decimal) roots not yet -identified or with non-decimal or irrational roots.</p> -<p>It is fun to modify only a tiny bit the polynomial and see if polexpr -survives:</p> -<pre class="literal-block">\PolDef{g}{f(x)+1e-27} -\PolTypeset{g}\par -\PolToSturm{g}{g} -\PolSturmIsolateZeros*{g} - -\showmultiplicities{g}</pre> -<p>This produces:</p> -<pre class="literal-block">x^9 - 8.9667x^8 + 35.73400293x^7 - 83.070418400109x^6 + 124.143648875193123x^5 -- 123.683070924326075877x^4 + 82.149260397553075617891x^3 -- 35.07602992699900159127007x^2 + 8.7364078733314648368671733x -- 0.967100824643585986488103298 - -The multiplicity is 1 for the root such that 0.98 < x < 0.99 -The multiplicity is 1 for the root such that 0.9991 < x < 0.9992 -The multiplicity is 1 for the root such that 0.9997 < x < 0.9998</pre> -<p>Which means that the multiplicity-3 roots each became a real and a pair of -complex ones. Let's see them better:</p> -<pre class="literal-block">\PolEnsureIntervalLengths{g}{-10} - -\showmultiplicities{g}</pre> -<p>which produces:</p> -<pre class="literal-block">The multiplicity is 1 for the root such that 0.9899888032 < x < 0.9899888033 -The multiplicity is 1 for the root such that 0.9991447980 < x < 0.9991447981 -The multiplicity is 1 for the root such that 0.9997663986 < x < 0.9997663987</pre> -</div> -<div class="section" id="a-degree-five-polynomial-with-three-rational-roots"> -<h2><a class="toc-backref" href="#id78">A degree five polynomial with three rational roots</a></h2> -<pre class="literal-block">\poldef Q(x) := 1581755751184441 x^5 - -14907697165025339 x^4 - +48415668972339336 x^3 - -63952057791306264 x^2 - +46833913221154895 x - -49044360626280925; - -\PolToSturm{Q}{Q} - \def\PolTypesetCmdPrefix#1{\allowbreak\xintiiifSgn{#1}{}{+}{+}}% - $Q_0(x) = \PolTypeset{Q_0}$ -\PolSturmIsolateZeros**{Q} -\PolPrintIntervals{Q} - -$Q_{norr}(x) = \PolTypeset{Q_norr}$</pre> -<p>Here, all real roots are rational:</p> -<pre class="literal-block">Z_1 = 833719/265381 -Z_2 = 165707065/52746197 -Z_3 = 355/113 - -Q_norr(x) = x^2 + 1</pre> -<p>And let's get their decimal expansion too:</p> -<pre class="literal-block">% print decimal expansion of the found roots -\def\PolPrintIntervalsPrintExactZero - {\xintTrunc{20}{\PolPrintIntervalsTheLeftEndPoint}\dots} -\PolPrintIntervals{Q} - -Z_1 = 3.14159265358107777120... -Z_2 = 3.14159265358979340254... -Z_3 = 3.14159292035398230088...</pre> -</div> -<div class="section" id="a-mignotte-type-polynomial"> -<h2><a class="toc-backref" href="#id79">A Mignotte type polynomial</a></h2> -<pre class="literal-block">\PolDef{P}{x^10 - (10x-1)^2}% -\PolTypeset{P} % prints it in expanded form -\PolToSturm{P}{P} % we can use same prefix for Sturm chain -\PolSturmIsolateZeros{P} % finds 4 real roots -This polynomial has \PolSturmNbOfIsolatedZeros{P} distinct real roots: -\PolPrintIntervals{P}% -% reports -2 < Z_1 < -1, 0.09 < Z_2 < 0.10, 0.1 < Z_3 < 0.2, 1 < Z_4 < 2 -Let us refine the second and third intervals to separate the corresponding -roots: -\PolRefineInterval*{P}{2}% will refine to 0.0999990 < Z_2 < 0.0999991 -\PolRefineInterval*{P}{3}% will refine to 0.100001 < Z_3 < 0.100002 -\PolPrintIntervals{P}% -Let us now get to know all roots with 10 digits after decimal mark: -\PolEnsureIntervalLengths{P}{-10}% -\PolPrintIntervals{P}% now all roots are known 10 decimal digits after mark -Finally, we display 20 digits of the second root: -\PolEnsureIntervalLength{P}{2}{-20}% makes Z_2 known with 20 digits after mark -$$\PolSturmIsolatedZeroLeft{P}{2}<Z_2<\PolSturmIsolatedZeroRight{P}{2}$$</pre> -<p>The last line produces:</p> -<pre class="literal-block">0.09999900004999650028 < Z_2 < 0.09999900004999650029</pre> -</div> -<div class="section" id="the-wilkinson-polynomial"> -<h2><a class="toc-backref" href="#id80">The Wilkinson polynomial</a></h2> -<p>See <a class="reference external" href="https://en.wikipedia.org/wiki/Wilkinson%27s_polynomial">Wilkinson polynomial</a>.</p> -<pre class="literal-block">%\xintverbosetrue % for the curious... - -\poldef f(x) := mul((x - i), i = 1..20); - -\def\PolTypesetCmdPrefix#1{\allowbreak\xintiiifSgn{#1}{}{+}{+}}% -\def\PolTypesetOne#1{\xintDecToString{#1}}% - -\noindent\PolTypeset{f} - -\PolToSturm{f}{f} -\PolSturmIsolateZeros{f} -\PolPrintIntervals{f} - -% \vfill\eject - -% This page is commented out because it takes about 30s on a 2GHz CPU -% \poldef g(x) := f(x) - 2**{-23} x**19; - -% \PolToSturm{g}{g} -% \noindent\PolTypeset{g_0}% integer coefficient primitive polynomial - -% \PolSturmIsolateZeros{g} -% \PolEnsureIntervalLengths{g}{-10} - -% \let\PolPrintIntervalsPrintMultiplicity\empty -% \PolPrintIntervals*{g}</pre> -<p>The first polynomial:</p> -<pre class="literal-block">f(x) = x**20 -- 210 x**19 -+ 20615 x**18 -- 1256850 x**17 -+ 53327946 x**16 -- 1672280820 x**15 -+ 40171771630 x**14 -- 756111184500 x**13 -+ 11310276995381 x**12 -- 135585182899530 x**11 -+ 1307535010540395 x**10 -- 10142299865511450 x**9 -+ 63030812099294896 x**8 -- 311333643161390640 x**7 -+ 1206647803780373360 x**6 -- 3599979517947607200 x**5 -+ 8037811822645051776 x**4 -- 12870931245150988800 x**3 -+ 13803759753640704000 x**2 -- 8752948036761600000 x -+ 2432902008176640000</pre> -<p>is handled fast enough, but the modified one <span class="docutils literal">f(x) - <span class="pre">2**-23</span> <span class="pre">x**19</span></span> takes about 20x longer.</p> -<p>The Sturm chain polynomials -have integer coefficients with up to 321 digits, whereas (surprisingly -perhaps) those of the Sturm chain polynomials derived from <span class="docutils literal">f</span> never -have more than 21 digits ...</p> -<p>Once the Sturm chain is computed and the zeros isolated, obtaining their -decimal digits is relatively faster. Here is for the ten real roots of -<span class="docutils literal">f(x) - <span class="pre">2**-23</span> <span class="pre">x**19</span></span> as computed by the code above:</p> -<pre class="literal-block">Z_1 = 0.9999999999... -Z_2 = 2.0000000000... -Z_3 = 2.9999999999... -Z_4 = 4.0000000002... -Z_5 = 4.9999999275... -Z_6 = 6.0000069439... -Z_7 = 6.9996972339... -Z_8 = 8.0072676034... -Z_9 = 8.9172502485... -Z_10 = 20.8469081014...</pre> -</div> -<div class="section" id="the-second-wilkinson-polynomial"> -<h2><a class="toc-backref" href="#id81">The second Wilkinson polynomial</a></h2> -<pre class="literal-block">\poldef f(x) := mul(x - 2^-i, i = 1..20); - -%\PolTypeset{f} - -\PolToSturm{f}{f} -\PolSturmIsolateZeros**{f} -\PolPrintIntervals{f}</pre> -<p>This takes more time than the polynomial with 1, 2, .., 20 as roots but -less than the latter modified by the <span class="docutils literal"><span class="pre">2**-23</span></span> tiny change to one of its -coefficient.</p> -<p>Here is the output (with release 0.7.2):</p> -<pre class="literal-block">Z_1 = 0.00000095367431640625 -Z_2 = 0.0000019073486328125 -Z_3 = 0.000003814697265625 -Z_4 = 0.00000762939453125 -Z_5 = 0.0000152587890625 -Z_6 = 0.000030517578125 -Z_7 = 0.00006103515625 -Z_8 = 0.0001220703125 -Z_9 = 1/4096 -Z_10 = 1/2048 -Z_11 = 1/1024 -Z_12 = 1/512 -Z_13 = 1/256 -Z_14 = 1/128 -Z_15 = 0.015625 -Z_16 = 0.03125 -Z_17 = 0.0625 -Z_18 = 0.125 -Z_19 = 0.25 -Z_20 = 0.5</pre> -<p>There is some incoherence in output format which has its source in the -fact that some roots are found in branches which can only find decimal -roots, whereas some are found in branches which could find general -fractions and they use <span class="docutils literal">\xintIrr</span> before storage of the found root. -This may evolve in future.</p> -</div> -<div class="section" id="the-degree-41-polynomial-with-2-1-9-1-8-0-0-1-1-9-2-as-roots"> -<h2><a class="toc-backref" href="#id82">The degree 41 polynomial with -2, -1.9, -1.8, ..., 0, 0.1, ..., 1.9, 2 as roots</a></h2> -<pre class="literal-block">\PolDef{P}{mul((x-i*1e-1), i=-20..20)}% i/10 is same but less efficient</pre> -<p>In the defining expression we could have used <span class="docutils literal">i/10</span> but this gives -less efficient internal form for the coefficients (the <span class="docutils literal">10</span>'s end up -in denominators).</p> -<p>Using <span class="docutils literal">\PolToExpr{P}</span> after having done</p> -<pre class="literal-block">\def\PolToExprCmd#1{\PolDecToString{\xintREZ{#1}}}</pre> -<p>we get this expanded form:</p> -<pre class="literal-block">x^41 --28.7*x^39 -+375.7117*x^37 --2975.11006*x^35 -+15935.28150578*x^33 --61167.527674162*x^31 -+173944.259366417394*x^29 --373686.963560544648*x^27 -+613012.0665016658846445*x^25 --771182.31133138163125495*x^23 -+743263.86672885754888959569*x^21 --545609.076599482896371978698*x^19 -+301748.325708943677229642930528*x^17 --123655.8987669450434698869844544*x^15 -+36666.1782054884005855608205864192*x^13 --7607.85821367459445649518380016128*x^11 -+1053.15135918687298508885950223794176*x^9 --90.6380005918141132650786081964032*x^7 -+4.33701563847327366842552218288128*x^5 --0.0944770968420804735498178265088*x^3 -+0.00059190121813899276854174416896*x</pre> -<p>which shows coefficients with up to 36 significant digits...</p> -<p>Stress test: not a hard challenge to <span class="docutils literal">xint + polexpr</span>, but be a bit -patient!</p> -<pre class="literal-block">\PolDef{P}{mul((x-i*1e-1), i=-20..20)}% -\PolToSturm{P}{S} % dutifully computes S_0, ..., S_{41} -% the [1] optional argument limits the search to interval (-10,10) -\PolSturmIsolateZeros[1]{S} % finds *exactly* (but a bit slowly) all 41 roots! -\PolPrintIntervals{S} % nice, isn't it?</pre> -<div class="admonition note"> -<p class="admonition-title">Note</p> -<p>Release <span class="docutils literal">0.5</span> has <em>experimental</em> addition of optional argument -<span class="docutils literal">E</span> to <span class="docutils literal">\PolSturmIsolateZeros</span>. It instructs to search roots only -in interval <span class="docutils literal"><span class="pre">(-10^E,</span> 10^E)</span>. Important: the extremities are -<em>assumed to not be roots</em>. In this example, the <span class="docutils literal">[1]</span> in -<span class="docutils literal"><span class="pre">\PolSturmIsolateZeros[1]{S}</span></span> gives some speed gain; without it, it -turns out in this case that <span class="docutils literal">polexpr</span> would have started with -<span class="docutils literal"><span class="pre">(-10^6,</span> 10^6)</span> interval.</p> -<p>Please note that this will probably get replaced in future by the -specification of a general interval. Do not rely on meaning of this -optional argument keeping the same.</p> -</div> -</div> -<div class="section" id="roots-of-chebyshev-polynomials"> -<h2><a class="toc-backref" href="#id83">Roots of Chebyshev polynomials</a></h2> -<pre class="literal-block">\poldef T_0(x) := 1; -\poldef T_1(x) := x; -\catcode`@ 11 -\count@ 2 -\xintloop - \poldef T_\the\count@(x) := - 2x*T_\the\numexpr\count@-1\relax - - T_\the\numexpr\count@-2\relax; -\ifnum\count@<15 -\advance\count@ 1 -\repeat -\catcode`@ 12 - -$$T_{15} = \PolTypeset[X]{T_15}$$ -\PolToSturm{T_15}{T_15} -\PolSturmIsolateZeros{T_15} -\PolEnsureIntervalLengths{T_15}{-10} -\PolPrintIntervals{T_15}</pre> -</div> -</div> <div class="section" id="non-expandable-macros"> -<h1><a class="toc-backref" href="#id84">Non-expandable macros</a></h1> +<h1><a class="toc-backref" href="#id74">Non-expandable macros</a></h1> <div class="admonition note"> <p class="admonition-title">Note</p> <p>At <span class="docutils literal">0.8</span> <span class="docutils literal">polexpr</span> is usable with Plain TeX and not only with LaTeX. Some examples given in this section may be using LaTeX syntax -such as <span class="docutils literal">\renewcommand</span>. Convert to TeX primitives as appropriate -if testing with a non LaTeX macro format.</p> +such as <span class="docutils literal">\renewcommand</span>.</p> </div> <div class="section" id="poldef-polname-letter-expression-using-the-letter-as-indeterminate"> -<span id="poldef"></span><h2><a class="toc-backref" href="#id85"><span class="docutils literal">\poldef <span class="pre">polname(letter):=</span> expression using the letter as indeterminate;</span></a></h2> +<span id="poldef"></span><h2><a class="toc-backref" href="#id75"><span class="docutils literal">\poldef <span class="pre">polname(letter):=</span> expression using the letter as indeterminate;</span></a></h2> <blockquote> <p>This evaluates the <em>polynomial expression</em> and stores the coefficients in a private structure accessible later via other @@ -2206,7 +1782,7 @@ package macros, used with argument <span class="docutils literal">polname</span> <em>expression</em> can make use of previously defined polynomials.</p> <p>Polynomial names must start with a letter and are constituted of letters, digits, underscores and the right tick <span class="docutils literal">'</span>.</p> -<p>The whole <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> syntax is authorized, as long as the final +<p>The whole <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> syntax is authorized, as long as the final result is of polynomial type:</p> <pre class="literal-block">\poldef polname(z) := add((-1)^i z^(2i+1)/(2i+1)!, i = 0..10);</pre> <p>With fractional coefficients, beware the <a class="reference internal" href="#warningtacit">tacit multiplication issue</a>.</p> @@ -2224,7 +1800,7 @@ item).</p></li> only algebraic operations (and ople indexing or slicing operations) should work fine in <span class="docutils literal"><span class="pre">\xintexpr/\xinteval</span></span> with such polynomial names as argument.</p> -<p>In the case of a constant polynomial, the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> variable (not the +<p>In the case of a constant polynomial, the <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> variable (not the internal data structure on which the package macros operate) associated to it is indistinguishable from a scalar, it is actually a scalar and has lost all traces from its origins as a polynomial @@ -2267,7 +1843,7 @@ the original expression has to be done manually, if needed.</p> </blockquote> </div> <div class="section" id="poldef-letter-polname-expr-using-the-letter-as-indeterminate"> -<span id="id8"></span><h2><a class="toc-backref" href="#id86"><span class="docutils literal"><span class="pre">\PolDef[<letter>]{<polname>}{<expr.</span> using the letter as indeterminate>}</span></a></h2> +<span id="id8"></span><h2><a class="toc-backref" href="#id76"><span class="docutils literal"><span class="pre">\PolDef[<letter>]{<polname>}{<expr.</span> using the letter as indeterminate>}</span></a></h2> <blockquote> <p>Does the same as <a class="reference internal" href="#poldef">\poldef</a> in an undelimited macro format, the main interest is to avoid potential problems with the @@ -2277,7 +1853,7 @@ of a <span class="docutils literal">[<letter>]</span> optional argument, t </blockquote> </div> <div class="section" id="polgenfloatvariant-polname"> -<span id="polgenfloatvariant"></span><h2><a class="toc-backref" href="#id87"><span class="docutils literal"><span class="pre">\PolGenFloatVariant{<polname>}</span></span></a></h2> +<span id="polgenfloatvariant"></span><h2><a class="toc-backref" href="#id77"><span class="docutils literal"><span class="pre">\PolGenFloatVariant{<polname>}</span></span></a></h2> <blockquote> <p>Makes the polynomial also usable in the <span class="docutils literal"><span class="pre">\xintfloatexpr/\xintfloateval</span></span> parser. It will therein evaluates @@ -2294,7 +1870,7 @@ the new polynomial is to be used in <span class="docutils literal">\xintfloateva </blockquote> </div> <div class="section" id="poltypeset-pol-expr"> -<span id="poltypeset"></span><h2><a class="toc-backref" href="#id88"><span class="docutils literal"><span class="pre">\PolTypeset{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> +<span id="poltypeset"></span><h2><a class="toc-backref" href="#id78"><span class="docutils literal"><span class="pre">\PolTypeset{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> <blockquote> <p>Typesets in descending powers, switching to math mode if in text mode, after evaluating the polynomial expression:</p> @@ -2311,7 +1887,7 @@ can be re-defined for customization. Their default definitions are expandable, but this is not a requirement.</p> </blockquote> <div class="section" id="poltypesetcmd-raw-coeff"> -<span id="poltypesetcmd"></span><h3><a class="toc-backref" href="#id89"><span class="docutils literal"><span class="pre">\PolTypesetCmd{<raw_coeff>}</span></span></a></h3> +<span id="poltypesetcmd"></span><h3><a class="toc-backref" href="#id79"><span class="docutils literal"><span class="pre">\PolTypesetCmd{<raw_coeff>}</span></span></a></h3> <blockquote> <p>Its package definition checks if the coefficient is <span class="docutils literal">1</span> or <span class="docutils literal"><span class="pre">-1</span></span> and then skips printing the <span class="docutils literal">1</span>, except for the coefficient of @@ -2321,7 +1897,7 @@ degree zero. Also it sets the conditional deciding behaviour of minus one, is handled by <a class="reference internal" href="#poltypesetone-raw-coeff">\PolTypesetOne{<raw_coeff>}</a>.</p> </blockquote> <div class="section" id="polifcoeffisplusorminusone-t-f"> -<span id="polifcoeffisplusorminusone"></span><h4><a class="toc-backref" href="#id90"><span class="docutils literal"><span class="pre">\PolIfCoeffIsPlusOrMinusOne{T}{F}</span></span></a></h4> +<span id="polifcoeffisplusorminusone"></span><h4><a class="toc-backref" href="#id80"><span class="docutils literal"><span class="pre">\PolIfCoeffIsPlusOrMinusOne{T}{F}</span></span></a></h4> <blockquote> <p>This macro is a priori undefined.</p> <p>It is defined via the default <a class="reference internal" href="#poltypesetcmd-raw-coeff">\PolTypesetCmd{<raw_coeff>}</a> to be @@ -2335,10 +1911,10 @@ plus or minus one, and <span class="docutils literal">F</span> if not. It choos </div> </div> <div class="section" id="poltypesetone-raw-coeff"> -<span id="poltypesetone"></span><h3><a class="toc-backref" href="#id91"><span class="docutils literal"><span class="pre">\PolTypesetOne{<raw_coeff>}</span></span></a></h3> +<span id="poltypesetone"></span><h3><a class="toc-backref" href="#id81"><span class="docutils literal"><span class="pre">\PolTypesetOne{<raw_coeff>}</span></span></a></h3> <blockquote> <p>Defaults to <span class="docutils literal">\xintTeXsignedFrac</span> (LaTeX) or <span class="docutils literal">\xintTeXsignedOver</span> -(else). But these <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> old legacy macros are a bit +(else). But these <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> old legacy macros are a bit annoying as they insist in exhibiting a power of ten rather than using simpler decimal notation.</p> <p>As alternative, one can do definitions such as:</p> @@ -2350,7 +1926,7 @@ using simpler decimal notation.</p> </blockquote> </div> <div class="section" id="id9"> -<span id="poltypesetmonomialcmd"></span><h3><a class="toc-backref" href="#id92"><span class="docutils literal">\PolTypesetMonomialCmd</span></a></h3> +<span id="poltypesetmonomialcmd"></span><h3><a class="toc-backref" href="#id82"><span class="docutils literal">\PolTypesetMonomialCmd</span></a></h3> <blockquote> <p>This decides how a monomial (in variable <span class="docutils literal">\PolVar</span> and with exponent <span class="docutils literal">\PolIndex</span>) is to be printed. The default does nothing @@ -2361,7 +1937,7 @@ for the constant term, <span class="docutils literal">\PolVar</span> for the fir </blockquote> </div> <div class="section" id="poltypesetcmdprefix-raw-coeff"> -<span id="poltypesetcmdprefix"></span><h3><a class="toc-backref" href="#id93"><span class="docutils literal"><span class="pre">\PolTypesetCmdPrefix{<raw_coeff>}</span></span></a></h3> +<span id="poltypesetcmdprefix"></span><h3><a class="toc-backref" href="#id83"><span class="docutils literal"><span class="pre">\PolTypesetCmdPrefix{<raw_coeff>}</span></span></a></h3> <blockquote> <p>Expands to a <span class="docutils literal">+</span> if the <span class="docutils literal">raw_coeff</span> is zero or positive, and to nothing if <span class="docutils literal">raw_coeff</span> is negative, as in latter case the @@ -2373,7 +1949,7 @@ separator in the typeset formula. Not used for the first term.</p> </div> </div> <div class="section" id="id11"> -<span id="id10"></span><h2><a class="toc-backref" href="#id94"><span class="docutils literal"><span class="pre">\PolTypeset*{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> +<span id="id10"></span><h2><a class="toc-backref" href="#id84"><span class="docutils literal"><span class="pre">\PolTypeset*{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> <blockquote> <p>Typesets in ascending powers. Use <span class="docutils literal">[<letter>]</span> optional argument (after the <span class="docutils literal">*</span>) to use another letter than <span class="docutils literal">x</span>.</p> @@ -2383,14 +1959,14 @@ expression another letter than default <span class="docutils literal">x</span>.< </blockquote> </div> <div class="section" id="non-expandable-macros-related-to-the-root-localization-routines"> -<h2><a class="toc-backref" href="#id95">Non-expandable macros related to the root localization routines</a></h2> +<h2><a class="toc-backref" href="#id85">Non-expandable macros related to the root localization routines</a></h2> <p>As <a class="reference internal" href="#poltosturm-polname-sturmname">\PolToSturm{<polname>}{<sturmname>}</a> and <a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{<sturmname>}</a> and variants declare additional polynomial or scalar variables with names based on <span class="docutils literal"><sturmname></span> as prefix, it is advisable to keep the <span class="docutils literal"><sturmname></span> namespace separate from the one applying to <span class="docutils literal">\xintexpr</span> variables generally, or to polynomials.</p> <div class="section" id="poltosturm-polname-sturmname"> -<span id="poltosturm"></span><h3><a class="toc-backref" href="#id96"><span class="docutils literal"><span class="pre">\PolToSturm{<polname>}{<sturmname>}</span></span></a></h3> +<span id="poltosturm"></span><h3><a class="toc-backref" href="#id86"><span class="docutils literal"><span class="pre">\PolToSturm{<polname>}{<sturmname>}</span></span></a></h3> <blockquote> <p>With <span class="docutils literal"><polname></span> being for example <span class="docutils literal">P</span>, and <span class="docutils literal"><sturmname></span> being for example <span class="docutils literal">S</span>, the macro starts by computing the derivative @@ -2475,7 +2051,7 @@ most the degree of <span class="docutils literal">S_0</span>.</p> </blockquote> </div> <div class="section" id="id13"> -<span id="id12"></span><h3><a class="toc-backref" href="#id97"><span class="docutils literal"><span class="pre">\PolToSturm*{<polname>}{<sturmname>}</span></span></a></h3> +<span id="id12"></span><h3><a class="toc-backref" href="#id87"><span class="docutils literal"><span class="pre">\PolToSturm*{<polname>}{<sturmname>}</span></span></a></h3> <blockquote> <p>Does the same as <a class="reference internal" href="#poltosturm">un-starred version</a> and additionally it keeps for user usage the memory of the <em>un-normalized</em> (but still @@ -2485,7 +2061,7 @@ polynomials <span class="docutils literal">sturmname_k_</span>, <span class="doc </blockquote> </div> <div class="section" id="polsturmisolatezeros-sturmname"> -<span id="polsturmisolatezeros"></span><h3><a class="toc-backref" href="#id98"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros{<sturmname>}</span></span></a></h3> +<span id="polsturmisolatezeros"></span><h3><a class="toc-backref" href="#id88"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros{<sturmname>}</span></span></a></h3> <blockquote> <p>The macro locates, using the <a class="reference external" href="https://en.wikipedia.org/wiki/Sturm%27s_theorem">Sturm Theorem</a>, as many disjoint intervals as there are distinct real roots.</p> @@ -2495,7 +2071,7 @@ intervals as there are distinct real roots.</p> <a class="reference internal" href="#poltosturm-polname-sturmname">\PolToSturm{<polname>}{<sturmname>}</a>.</p> </div> <p>After its execution they are two types of such intervals (stored in -memory and accessible via macros or <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> variables, see below):</p> +memory and accessible via macros or <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> variables, see below):</p> <ul class="simple"> <li><p>singleton <span class="docutils literal">{a}</span>: then <span class="docutils literal">a</span> is a root, (necessarily a decimal number, but not all such decimal numbers are exactly identified yet).</p></li> @@ -2528,7 +2104,7 @@ this issue.</p> for future computations in <span class="docutils literal">\xintexpr/xinteval</span> or <span class="docutils literal">\poldef</span> as variables <span class="docutils literal">SL_1</span>, <span class="docutils literal">SL_2</span>, etc..., for the left end-points and <span class="docutils literal">SR_1</span>, <span class="docutils literal">SR_2</span>, ..., for the right end-points.</p> -<p>Additionally, <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> variable <span class="docutils literal">SZ_1_isknown</span> will have value +<p>Additionally, <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> variable <span class="docutils literal">SZ_1_isknown</span> will have value <span class="docutils literal">1</span> if the root in the first interval is known, and <span class="docutils literal">0</span> otherwise. And similarly for the other intervals.</p> <div class="admonition important"> @@ -2566,8 +2142,8 @@ subsequent usage of <a class="reference internal" href="#polrefineinterval-sturm other localization improving macros.</p> <div class="admonition note"> <p class="admonition-title">Note</p> -<p>The current polexpr implementation defines the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> variables -and <a class="reference external" href="http://www.ctan.org/pkg/xint">xinttools</a> arrays as described above with global scope. On the +<p>The current polexpr implementation defines the <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> variables +and <a class="reference external" href="https://www.ctan.org/pkg/xint">xinttools</a> arrays as described above with global scope. On the other hand the Sturm sequence polynomials obey the current scope.</p> <p>This is perhaps a bit inconsistent and may change in future.</p> </div> @@ -2585,7 +2161,7 @@ are studied in numerical mathematics.</p> </blockquote> </div> <div class="section" id="id15"> -<span id="id14"></span><h3><a class="toc-backref" href="#id99"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros*{<sturmname>}</span></span></a></h3> +<span id="id14"></span><h3><a class="toc-backref" href="#id89"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros*{<sturmname>}</span></span></a></h3> <blockquote> <p>The macro does the same as <a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{<sturmname>}</a> and then in addition it does the extra work to determine all @@ -2595,7 +2171,7 @@ multiplicities of the real roots.</p> to the multiplicity of the root located in the <span class="docutils literal">index</span>-th interval (intervals are enumerated from left to right, with index starting at <span class="docutils literal">1</span>).</p> -<p>Furthermore, if for example the <span class="docutils literal"><sturmname></span> is <span class="docutils literal">S</span>, <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> +<p>Furthermore, if for example the <span class="docutils literal"><sturmname></span> is <span class="docutils literal">S</span>, <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> variables <span class="docutils literal">SM_1</span>, <span class="docutils literal">SM_2</span>... hold the multiplicities thus computed.</p> <div class="admonition note"> @@ -2606,18 +2182,17 @@ execution, <a class="reference internal" href="#poltosturm">\PolToSturm</a>, eve non-square-free Sturm chain polynomials as user-level genuine polynomials, stores their data in private macros.</p> </div> -<p>See <a class="reference internal" href="#the-degree-nine-polynomial-with-0-99-0-999-0-9999-as-triple-roots">The degree nine polynomial with 0.99, 0.999, 0.9999 as triple -roots</a> for an example.</p> +<p>See <span class="docutils literal">The degree nine polynomial with 0.99, 0.999, 0.9999 as triple roots</span> example in <span class="docutils literal"><span class="pre">polexpr-examples.pdf</span></span>.</p> </blockquote> <div class="section" id="polsturmisolatezerosandgetmultiplicities-sturmname"> -<span id="polsturmisolatezerosandgetmultiplicities"></span><h4><a class="toc-backref" href="#id100"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndGetMultiplicities{<sturmname>}</span></span></a></h4> +<span id="polsturmisolatezerosandgetmultiplicities"></span><h4><a class="toc-backref" href="#id90"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndGetMultiplicities{<sturmname>}</span></span></a></h4> <blockquote> <p>This is another name for <a class="reference internal" href="#id15">\PolSturmIsolateZeros*{<sturmname>}</a>.</p> </blockquote> </div> </div> <div class="section" id="id17"> -<span id="id16"></span><h3><a class="toc-backref" href="#id101"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros**{<sturmname>}</span></span></a></h3> +<span id="id16"></span><h3><a class="toc-backref" href="#id91"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros**{<sturmname>}</span></span></a></h3> <blockquote> <p>The macro does the same as <a class="reference internal" href="#id15">\PolSturmIsolateZeros*{<sturmname>}</a> and in addition it does the extra work to determine all the <em>rational</em> @@ -2637,18 +2212,17 @@ between the degrees of these two polynomials (see also roots have been removed (see <a class="reference internal" href="#polexprsetup">\polexprsetup</a>), i.e. it contains the irrational roots of the original polynomial, with the same multiplicities.</p> -<p>See <a class="reference internal" href="#a-degree-five-polynomial-with-three-rational-roots">A degree five polynomial with three rational -roots</a> for an example.</p> +<p>See <span class="docutils literal">A degree five polynomial with three rational roots</span> in <span class="docutils literal"><span class="pre">polexpr-examples.pdf</span></span>.</p> </blockquote> <div class="section" id="polsturmisolatezerosgetmultiplicitiesandrationalroots-sturmname"> -<span id="polsturmisolatezerosgetmultiplicitiesandrationalroots"></span><h4><a class="toc-backref" href="#id102"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosGetMultiplicitiesAndRationalRoots{<sturmname>}</span></span></a></h4> +<span id="polsturmisolatezerosgetmultiplicitiesandrationalroots"></span><h4><a class="toc-backref" href="#id92"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosGetMultiplicitiesAndRationalRoots{<sturmname>}</span></span></a></h4> <blockquote> <p>This is another name for <a class="reference internal" href="#id17">\PolSturmIsolateZeros**{<sturmname>}</a>.</p> </blockquote> </div> </div> <div class="section" id="polsturmisolatezerosandfindrationalroots-sturmname"> -<h3><a class="toc-backref" href="#id103"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndFindRationalRoots{<sturmname>}</span></span></a></h3> +<h3><a class="toc-backref" href="#id93"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndFindRationalRoots{<sturmname>}</span></span></a></h3> <blockquote> <p>This works exactly like <a class="reference internal" href="#id17">\PolSturmIsolateZeros**{<sturmname>}</a> (inclusive of declaring the polynomials <span class="docutils literal">sturmname_sqf_norr</span> and @@ -2661,7 +2235,7 @@ their multiplicities at the same time.</p> </div> <div class="admonition attention"> <p class="admonition-title">Attention!</p> -<p>This macro does <em>not</em> define <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> variables +<p>This macro does <em>not</em> define <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> variables <span class="docutils literal">sturmnameM_1</span>, <span class="docutils literal">sturmnameM_2</span>, ... holding the multiplicities and it leaves the multiplicity array (whose accessor is <a class="reference internal" href="#polsturmisolatedzeromultiplicity-sturmname-index">\PolSturmIsolatedZeroMultiplicity{<sturmname>}{<index>}</a>) into @@ -2678,7 +2252,7 @@ rational root anyhow).</p> </blockquote> </div> <div class="section" id="polrefineinterval-sturmname-index"> -<span id="polrefineinterval"></span><h3><a class="toc-backref" href="#id104"><span class="docutils literal"><span class="pre">\PolRefineInterval*{<sturmname>}{<index>}</span></span></a></h3> +<span id="polrefineinterval"></span><h3><a class="toc-backref" href="#id94"><span class="docutils literal"><span class="pre">\PolRefineInterval*{<sturmname>}{<index>}</span></span></a></h3> <blockquote> <p>The <span class="docutils literal">index</span>-th interval (starting indexing at one) is further subdivided as many times as is necessary in order for the newer @@ -2688,7 +2262,7 @@ strictly separated from the other roots.</p> </blockquote> </div> <div class="section" id="polrefineinterval-n-sturmname-index"> -<span id="polrefineinterval-n"></span><h3><a class="toc-backref" href="#id105"><span class="docutils literal"><span class="pre">\PolRefineInterval[N]{<sturmname>}{<index>}</span></span></a></h3> +<span id="polrefineinterval-n"></span><h3><a class="toc-backref" href="#id95"><span class="docutils literal"><span class="pre">\PolRefineInterval[N]{<sturmname>}{<index>}</span></span></a></h3> <blockquote> <p>The <span class="docutils literal">index</span>-th interval (starting count at one) is further subdivided once, reducing its length by a factor of 10. This is done @@ -2696,7 +2270,7 @@ subdivided once, reducing its length by a factor of 10. This is done </blockquote> </div> <div class="section" id="polensureintervallength-sturmname-index-exponent"> -<span id="polensureintervallength"></span><h3><a class="toc-backref" href="#id106"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLength{<sturmname>}{<index>}{<exponent>}</span></span></a></h3> +<span id="polensureintervallength"></span><h3><a class="toc-backref" href="#id96"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLength{<sturmname>}{<index>}{<exponent>}</span></span></a></h3> <blockquote> <p>The <span class="docutils literal">index</span>-th interval is subdivided until its length becomes at most <span class="docutils literal">10^E</span>. This means (for <span class="docutils literal">E<0</span>) that the first <span class="docutils literal"><span class="pre">-E</span></span> digits @@ -2704,7 +2278,7 @@ after decimal mark of the <span class="docutils literal">k</span>th root will th </blockquote> </div> <div class="section" id="polensureintervallengths-sturmname-exponent"> -<span id="polensureintervallengths"></span><h3><a class="toc-backref" href="#id107"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLengths{<sturmname>}{<exponent>}</span></span></a></h3> +<span id="polensureintervallengths"></span><h3><a class="toc-backref" href="#id97"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLengths{<sturmname>}{<exponent>}</span></span></a></h3> <blockquote> <p>The intervals as obtained from <span class="docutils literal">\PolSturmIsolateZeros</span> are (if necessary) subdivided further by (base 10) dichotomy in order for @@ -2714,7 +2288,7 @@ each of them to have length at most <span class="docutils literal">10^E</span>.< </blockquote> </div> <div class="section" id="polprintintervals-varname-sturmname"> -<span id="polprintintervals"></span><h3><a class="toc-backref" href="#id108"><span class="docutils literal"><span class="pre">\PolPrintIntervals[<varname>]{<sturmname>}</span></span></a></h3> +<span id="polprintintervals"></span><h3><a class="toc-backref" href="#id98"><span class="docutils literal"><span class="pre">\PolPrintIntervals[<varname>]{<sturmname>}</span></span></a></h3> <blockquote> <p>This is a convenience macro which prints the bounds for the roots <span class="docutils literal">Z_1</span>, <span class="docutils literal">Z_2</span>, ... (the optional argument <span class="docutils literal">varname</span> allows to @@ -2735,7 +2309,7 @@ primitives.</p> <p>See next macros which govern its output.</p> </blockquote> <div class="section" id="polprintintervalsnorealroots"> -<h4><a class="toc-backref" href="#id109"><span class="docutils literal">\PolPrintIntervalsNoRealRoots</span></a></h4> +<h4><a class="toc-backref" href="#id99"><span class="docutils literal">\PolPrintIntervalsNoRealRoots</span></a></h4> <blockquote> <p>Executed in place of an <span class="docutils literal">array</span> environment, when there are no real roots. Default definition:</p> @@ -2743,21 +2317,34 @@ real roots. Default definition:</p> </blockquote> </div> <div class="section" id="polprintintervalsbeginenv"> -<h4><a class="toc-backref" href="#id110"><span class="docutils literal">\PolPrintIntervalsBeginEnv</span></a></h4> +<h4><a class="toc-backref" href="#id100"><span class="docutils literal">\PolPrintIntervalsBeginEnv</span></a></h4> <blockquote> -<p>Default definition:</p> +<p>Default definition (given here for LaTeX, Plain has a variant):</p> <pre class="literal-block">\newcommand\PolPrintIntervalsBeginEnv{\[\begin{array}{rcccl}}</pre> +<p>A simpler <span class="docutils literal">center</span> environment provides a straightforward way to +obtain a display allowing pagebreaks. Of course redefinitions must +at any rate be kept in sync with <a class="reference internal" href="#polprintintervalsknownroot">\PolPrintIntervalsKnownRoot</a> and +<a class="reference internal" href="#polprintintervalsunknownroot">\PolPrintIntervalsUnknownRoot</a>.</p> +<p>Prior to <span class="docutils literal">0.8.6</span> it was not possible to use here for example +<span class="docutils literal">\begin{align}</span> due to the latter executing twice in contents.</p> </blockquote> </div> <div class="section" id="polprintintervalsendenv"> -<h4><a class="toc-backref" href="#id111"><span class="docutils literal">\PolPrintIntervalsEndEnv</span></a></h4> +<h4><a class="toc-backref" href="#id101"><span class="docutils literal">\PolPrintIntervalsEndEnv</span></a></h4> <blockquote> <p>Default definition:</p> <pre class="literal-block">\newcommand\PolPrintIntervalsEndEnv{\end{array}\]}</pre> </blockquote> </div> +<div class="section" id="polprintintervalsrowseparator"> +<h4><a class="toc-backref" href="#id102"><span class="docutils literal">\PolPrintIntervalsRowSeparator</span></a></h4> +<blockquote> +<p>Expands by default to <span class="docutils literal">\\</span> with LaTeX and to <span class="docutils literal">\cr</span> with Plain</p> +<p>Added at <span class="docutils literal">0.8.6</span>.</p> +</blockquote> +</div> <div class="section" id="polprintintervalsknownroot"> -<h4><a class="toc-backref" href="#id112"><span class="docutils literal">\PolPrintIntervalsKnownRoot</span></a></h4> +<h4><a class="toc-backref" href="#id103"><span class="docutils literal">\PolPrintIntervalsKnownRoot</span></a></h4> <blockquote> <p>Default definition:</p> <pre class="literal-block">\newcommand\PolPrintIntervalsKnownRoot{% @@ -2767,7 +2354,7 @@ real roots. Default definition:</p> </blockquote> </div> <div class="section" id="polprintintervalsunknownroot"> -<h4><a class="toc-backref" href="#id113"><span class="docutils literal">\PolPrintIntervalsUnknownRoot</span></a></h4> +<h4><a class="toc-backref" href="#id104"><span class="docutils literal">\PolPrintIntervalsUnknownRoot</span></a></h4> <blockquote> <p>Default definition:</p> <pre class="literal-block">\newcommand\PolPrintIntervalsUnknownRoot{% @@ -2778,21 +2365,21 @@ real roots. Default definition:</p> </blockquote> </div> <div class="section" id="id18"> -<span id="polprintintervalsprintexactzero"></span><h4><a class="toc-backref" href="#id114"><span class="docutils literal">\PolPrintIntervalsPrintExactZero</span></a></h4> +<span id="polprintintervalsprintexactzero"></span><h4><a class="toc-backref" href="#id105"><span class="docutils literal">\PolPrintIntervalsPrintExactZero</span></a></h4> <blockquote> <p>Default definition:</p> <pre class="literal-block">\newcommand\PolPrintIntervalsPrintExactZero{\PolPrintIntervalsTheLeftEndPoint}</pre> </blockquote> </div> <div class="section" id="id19"> -<span id="polprintintervalsprintleftendpoint"></span><h4><a class="toc-backref" href="#id115"><span class="docutils literal">\PolPrintIntervalsPrintLeftEndPoint</span></a></h4> +<span id="polprintintervalsprintleftendpoint"></span><h4><a class="toc-backref" href="#id106"><span class="docutils literal">\PolPrintIntervalsPrintLeftEndPoint</span></a></h4> <blockquote> <p>Default definition:</p> <pre class="literal-block">\newcommand\PolPrintIntervalsPrintLeftEndPoint{\PolPrintIntervalsTheLeftEndPoint}</pre> </blockquote> </div> <div class="section" id="id20"> -<span id="polprintintervalsprintrightendpoint"></span><h4><a class="toc-backref" href="#id116"><span class="docutils literal">\PolPrintIntervalsPrintRightEndPoint</span></a></h4> +<span id="polprintintervalsprintrightendpoint"></span><h4><a class="toc-backref" href="#id107"><span class="docutils literal">\PolPrintIntervalsPrintRightEndPoint</span></a></h4> <blockquote> <p>Default definition is:</p> <pre class="literal-block">\newcommand\PolPrintIntervalsPrintRightEndPoint{\PolPrintIntervalsTheRightEndPoint}</pre> @@ -2800,7 +2387,7 @@ real roots. Default definition:</p> </div> </div> <div class="section" id="id22"> -<span id="id21"></span><h3><a class="toc-backref" href="#id117"><span class="docutils literal"><span class="pre">\PolPrintIntervals*[<varname>]{<sturmname>}</span></span></a></h3> +<span id="id21"></span><h3><a class="toc-backref" href="#id108"><span class="docutils literal"><span class="pre">\PolPrintIntervals*[<varname>]{<sturmname>}</span></span></a></h3> <blockquote> <p>This starred variant produces an alternative output (which displays the root multiplicity), and is provided as an @@ -2817,7 +2404,7 @@ definition:</p> <p>Multiplicities are printed using this auxiliary macro:</p> </blockquote> <div class="section" id="polprintintervalsprintmultiplicity"> -<h4><a class="toc-backref" href="#id118"><span class="docutils literal">\PolPrintIntervalsPrintMultiplicity</span></a></h4> +<h4><a class="toc-backref" href="#id109"><span class="docutils literal">\PolPrintIntervalsPrintMultiplicity</span></a></h4> <blockquote> <p>whose default definition is:</p> <pre class="literal-block">\newcommand\PolPrintIntervalsPrintMultiplicity{(\mbox{mult. }\PolPrintIntervalsTheMultiplicity)}</pre> @@ -2825,19 +2412,19 @@ definition:</p> </div> </div> <div class="section" id="polsettosturmchainsignchangesat-foo-sturmname-value"> -<span id="polsettosturmchainsignchangesat"></span><h3><a class="toc-backref" href="#id119"><span class="docutils literal"><span class="pre">\PolSetToSturmChainSignChangesAt{\foo}{<sturmname>}{<value>}</span></span></a></h3> +<span id="polsettosturmchainsignchangesat"></span><h3><a class="toc-backref" href="#id110"><span class="docutils literal"><span class="pre">\PolSetToSturmChainSignChangesAt{\foo}{<sturmname>}{<value>}</span></span></a></h3> <blockquote> <p>Sets macro <span class="docutils literal">\foo</span> to store the number of sign changes in the already computed normalized Sturm chain with name prefix <span class="docutils literal"><sturmname></span>, at location <span class="docutils literal"><value></span> (which must be in format as -acceptable by the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macros.)</p> +acceptable by the <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> macros.)</p> <p>The definition is made with global scope. For local scope, use <span class="docutils literal">[\empty]</span> as extra optional argument.</p> <p>One can use this immediately after creation of the Sturm chain.</p> </blockquote> </div> <div class="section" id="polsettonbofzeroswithin-foo-sturmname-value-left-value-right"> -<span id="polsettonbofzeroswithin"></span><h3><a class="toc-backref" href="#id120"><span class="docutils literal"><span class="pre">\PolSetToNbOfZerosWithin{\foo}{<sturmname>}{<value_left>}{<value_right>}</span></span></a></h3> +<span id="polsettonbofzeroswithin"></span><h3><a class="toc-backref" href="#id111"><span class="docutils literal"><span class="pre">\PolSetToNbOfZerosWithin{\foo}{<sturmname>}{<value_left>}{<value_right>}</span></span></a></h3> <blockquote> <p>Sets, assuming the normalized Sturm chain has been already computed, macro <span class="docutils literal">\foo</span> to store the number of roots of <span class="docutils literal">sturmname_0</span> in @@ -2861,7 +2448,7 @@ which requires prior execution of </div> </div> <div class="section" id="pollet-polname-2-polname-1"> -<span id="pollet"></span><h2><a class="toc-backref" href="#id121"><span class="docutils literal"><span class="pre">\PolLet{<polname_2>}={<polname_1>}</span></span></a></h2> +<span id="pollet"></span><h2><a class="toc-backref" href="#id112"><span class="docutils literal"><span class="pre">\PolLet{<polname_2>}={<polname_1>}</span></span></a></h2> <blockquote> <p>Makes a copy of the already defined polynomial <span class="docutils literal">polname_1</span> to a new one <span class="docutils literal">polname_2</span>. This has the same effect as @@ -2871,20 +2458,20 @@ new one <span class="docutils literal">polname_2</span>. This has the same effec </blockquote> </div> <div class="section" id="polgloballet-polname-2-polname-1"> -<span id="polgloballet"></span><h2><a class="toc-backref" href="#id122"><span class="docutils literal"><span class="pre">\PolGlobalLet{<polname_2>}={<polname_1>}</span></span></a></h2> +<span id="polgloballet"></span><h2><a class="toc-backref" href="#id113"><span class="docutils literal"><span class="pre">\PolGlobalLet{<polname_2>}={<polname_1>}</span></span></a></h2> <blockquote> <p>Acts globally.</p> </blockquote> </div> <div class="section" id="polassign-polname-toarray-macro"> -<span id="polassign"></span><h2><a class="toc-backref" href="#id123"><span class="docutils literal"><span class="pre">\PolAssign{<polname>}\toarray\macro</span></span></a></h2> +<span id="polassign"></span><h2><a class="toc-backref" href="#id114"><span class="docutils literal"><span class="pre">\PolAssign{<polname>}\toarray\macro</span></span></a></h2> <blockquote> <p>Defines a one-argument expandable macro <span class="docutils literal"><span class="pre">\macro{#1}</span></span> which expands to the (raw) #1th polynomial coefficient.</p> <ul class="simple"> <li><p>Attention, coefficients here are indexed starting at 1. This is an unfortunate legacy situation related to the original indexing -convention in <a class="reference external" href="http://www.ctan.org/pkg/xint">xinttools</a> arrays.</p></li> +convention in <a class="reference external" href="https://www.ctan.org/pkg/xint">xinttools</a> arrays.</p></li> <li><p>With #1=-1, -2, ..., <span class="docutils literal"><span class="pre">\macro{#1}</span></span> returns leading coefficients.</p></li> <li><p>With #1=0, returns the number of coefficients, i.e. <span class="docutils literal">1 + deg f</span> for non-zero polynomials.</p></li> @@ -2894,12 +2481,12 @@ for non-zero polynomials.</p></li> </blockquote> </div> <div class="section" id="polget-polname-fromarray-macro"> -<span id="polget"></span><h2><a class="toc-backref" href="#id124"><span class="docutils literal"><span class="pre">\PolGet{<polname>}\fromarray\macro</span></span></a></h2> +<span id="polget"></span><h2><a class="toc-backref" href="#id115"><span class="docutils literal"><span class="pre">\PolGet{<polname>}\fromarray\macro</span></span></a></h2> <blockquote> <p>Does the converse operation to <span class="docutils literal"><span class="pre">\PolAssign{<polname>}\toarray\macro</span></span>. Each individual <span class="docutils literal"><span class="pre">\macro{<value>}</span></span> gets expanded in an <span class="docutils literal">\edef</span> and then normalized -via <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>'s macro <span class="docutils literal">\xintRaw</span>.</p> +via <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a>'s macro <span class="docutils literal">\xintRaw</span>.</p> <p>The leading zeros are removed from the polynomial.</p> <p>(contrived) Example:</p> <pre class="literal-block">\xintAssignArray{1}{-2}{5}{-3}\to\foo @@ -2908,14 +2495,14 @@ via <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</ </blockquote> </div> <div class="section" id="polfromcsv-polname-csv"> -<span id="polfromcsv"></span><h2><a class="toc-backref" href="#id125"><span class="docutils literal"><span class="pre">\PolFromCSV{<polname>}{<csv>}</span></span></a></h2> +<span id="polfromcsv"></span><h2><a class="toc-backref" href="#id116"><span class="docutils literal"><span class="pre">\PolFromCSV{<polname>}{<csv>}</span></span></a></h2> <blockquote> <p>Defines a polynomial directly from the comma separated list of values (or a macro expanding to such a list) of its coefficients, the <em>first item</em> gives the constant term, the <em>last item</em> gives the leading coefficient, except if zero, then it is dropped (iteratively). List items are each expanded in an <span class="docutils literal">\edef</span> and then put into normalized -form via <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>'s macro <span class="docutils literal">\xintRaw</span>.</p> +form via <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a>'s macro <span class="docutils literal">\xintRaw</span>.</p> <p>As leading zero coefficients are removed:</p> <pre class="literal-block">\PolFromCSV{f}{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}</pre> <p>defines the zero polynomial, which holds only one coefficient.</p> @@ -2923,7 +2510,7 @@ form via <a class="reference external" href="http://www.ctan.org/pkg/xint">xintf </blockquote> </div> <div class="section" id="polmapcoeffs-macro-polname"> -<span id="polmapcoeffs"></span><h2><a class="toc-backref" href="#id126"><span class="docutils literal"><span class="pre">\PolMapCoeffs{\macro}{<polname>}</span></span></a></h2> +<span id="polmapcoeffs"></span><h2><a class="toc-backref" href="#id117"><span class="docutils literal"><span class="pre">\PolMapCoeffs{\macro}{<polname>}</span></span></a></h2> <blockquote> <p>It modifies ('in-place': original coefficients get lost) each coefficient of the defined polynomial via the <em>expandable</em> macro @@ -2931,9 +2518,9 @@ coefficient of the defined polynomial via the <em>expandable</em> macro coefficients vanish after the operation.</p> <p>In the replacement text of <span class="docutils literal">\macro</span>, <span class="docutils literal">\index</span> expands to the coefficient index (starting at zero for the constant term).</p> -<p>Notice that <span class="docutils literal">\macro</span> will have to handle inputs in the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> +<p>Notice that <span class="docutils literal">\macro</span> will have to handle inputs in the <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> internal format. This means that it probably will have to be -expressed in terms of macros from the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> package.</p> +expressed in terms of macros from the <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> package.</p> <p>Example:</p> <pre class="literal-block">\def\foo#1{\xintMul{#1}{\the\numexpr\index*\index\relax}}</pre> <p>(or with <span class="docutils literal"><span class="pre">\xintSqr{\index}</span></span>) to replace <span class="docutils literal">n</span>-th coefficient @@ -2941,20 +2528,20 @@ expressed in terms of macros from the <a class="reference external" href="http:/ </blockquote> </div> <div class="section" id="polreducecoeffs-polname"> -<span id="polreducecoeffs"></span><h2><a class="toc-backref" href="#id127"><span class="docutils literal"><span class="pre">\PolReduceCoeffs{<polname>}</span></span></a></h2> +<span id="polreducecoeffs"></span><h2><a class="toc-backref" href="#id118"><span class="docutils literal"><span class="pre">\PolReduceCoeffs{<polname>}</span></span></a></h2> <blockquote> <p>Reduces the internal representations of the coefficients to their lowest terms.</p> </blockquote> </div> <div class="section" id="id24"> -<span id="id23"></span><h2><a class="toc-backref" href="#id128"><span class="docutils literal"><span class="pre">\PolReduceCoeffs*{<polname>}</span></span></a></h2> +<span id="id23"></span><h2><a class="toc-backref" href="#id119"><span class="docutils literal"><span class="pre">\PolReduceCoeffs*{<polname>}</span></span></a></h2> <blockquote> <p>Reduces the internal representations of the coefficients to their lowest terms, but ignoring a possible separated "power of ten part".</p> -<p>For example, <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> stores an <span class="docutils literal">30e2/50</span> input as <span class="docutils literal">30/50</span> with +<p>For example, <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> stores an <span class="docutils literal">30e2/50</span> input as <span class="docutils literal">30/50</span> with a separate <span class="docutils literal">10^2</span> part. This will thus get replaced by <span class="docutils literal">3e^2/5</span> -(or rather whatever <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> uses for internal representation), and +(or rather whatever <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> uses for internal representation), and not by <span class="docutils literal">60</span> as would result from complete reduction.</p> <p>Evaluations with polynomials treated by this can be much faster than with those handled by the non-starred variant @@ -2963,7 +2550,7 @@ remain generally smaller.</p> </blockquote> </div> <div class="section" id="polmakemonic-polname"> -<span id="polmakemonic"></span><h2><a class="toc-backref" href="#id129"><span class="docutils literal"><span class="pre">\PolMakeMonic{<polname>}</span></span></a></h2> +<span id="polmakemonic"></span><h2><a class="toc-backref" href="#id120"><span class="docutils literal"><span class="pre">\PolMakeMonic{<polname>}</span></span></a></h2> <blockquote> <p>Divides by the leading coefficient. It is recommended to execute <a class="reference internal" href="#id24">\PolReduceCoeffs*{<polname>}</a> immediately afterwards. This is not @@ -2973,7 +2560,7 @@ denominator for typesetting purposes.</p> </blockquote> </div> <div class="section" id="polmakeprimitive-polname"> -<span id="polmakeprimitive"></span><h2><a class="toc-backref" href="#id130"><span class="docutils literal"><span class="pre">\PolMakePrimitive{<polname>}</span></span></a></h2> +<span id="polmakeprimitive"></span><h2><a class="toc-backref" href="#id121"><span class="docutils literal"><span class="pre">\PolMakePrimitive{<polname>}</span></span></a></h2> <blockquote> <p>Divides by the integer content see (<a class="reference internal" href="#policontent">\PolIContent</a>). This thus produces a polynomial with integer @@ -2982,7 +2569,7 @@ coefficient is not modified.</p> </blockquote> </div> <div class="section" id="poldiff-polname-1-polname-2"> -<span id="poldiff"></span><h2><a class="toc-backref" href="#id131"><span class="docutils literal"><span class="pre">\PolDiff{<polname_1>}{<polname_2>}</span></span></a></h2> +<span id="poldiff"></span><h2><a class="toc-backref" href="#id122"><span class="docutils literal"><span class="pre">\PolDiff{<polname_1>}{<polname_2>}</span></span></a></h2> <blockquote> <p>This sets <span class="docutils literal">polname_2</span> to the first derivative of <span class="docutils literal">polname_1</span>. It is allowed to issue <span class="docutils literal"><span class="pre">\PolDiff{f}{f}</span></span>, effectively replacing <span class="docutils literal">f</span> @@ -2992,7 +2579,7 @@ by <span class="docutils literal">f'</span>.</p> </blockquote> </div> <div class="section" id="poldiff-n-polname-1-polname-2"> -<span id="poldiff-n"></span><h2><a class="toc-backref" href="#id132"><span class="docutils literal"><span class="pre">\PolDiff[N]{<polname_1>}{<polname_2>}</span></span></a></h2> +<span id="poldiff-n"></span><h2><a class="toc-backref" href="#id123"><span class="docutils literal"><span class="pre">\PolDiff[N]{<polname_1>}{<polname_2>}</span></span></a></h2> <blockquote> <p>This sets <span class="docutils literal">polname_2</span> to the <span class="docutils literal">N</span>-th derivative of <span class="docutils literal">polname_1</span>. Identical arguments is allowed. With <span class="docutils literal">N=0</span>, same effect as @@ -3001,7 +2588,7 @@ using <span class="docutils literal">\PolAntiDiff</span>.</p> </blockquote> </div> <div class="section" id="polantidiff-polname-1-polname-2"> -<span id="polantidiff"></span><h2><a class="toc-backref" href="#id133"><span class="docutils literal"><span class="pre">\PolAntiDiff{<polname_1>}{<polname_2>}</span></span></a></h2> +<span id="polantidiff"></span><h2><a class="toc-backref" href="#id124"><span class="docutils literal"><span class="pre">\PolAntiDiff{<polname_1>}{<polname_2>}</span></span></a></h2> <blockquote> <p>This sets <span class="docutils literal">polname_2</span> to the primitive of <span class="docutils literal">polname_1</span> vanishing at zero.</p> @@ -3010,14 +2597,14 @@ at zero.</p> </blockquote> </div> <div class="section" id="polantidiff-n-polname-1-polname-2"> -<span id="polantidiff-n"></span><h2><a class="toc-backref" href="#id134"><span class="docutils literal"><span class="pre">\PolAntiDiff[N]{<polname_1>}{<polname_2>}</span></span></a></h2> +<span id="polantidiff-n"></span><h2><a class="toc-backref" href="#id125"><span class="docutils literal"><span class="pre">\PolAntiDiff[N]{<polname_1>}{<polname_2>}</span></span></a></h2> <blockquote> <p>This sets <span class="docutils literal">polname_2</span> to the result of <span class="docutils literal">N</span> successive integrations on <span class="docutils literal">polname_1</span>. With negative <span class="docutils literal">N</span>, it switches to using <span class="docutils literal">\PolDiff</span>.</p> </blockquote> </div> <div class="section" id="poldivide-polname-1-polname-2-polname-q-polname-r"> -<span id="poldivide"></span><h2><a class="toc-backref" href="#id135"><span class="docutils literal"><span class="pre">\PolDivide{<polname_1>}{<polname_2>}{<polname_Q>}{<polname_R>}</span></span></a></h2> +<span id="poldivide"></span><h2><a class="toc-backref" href="#id126"><span class="docutils literal"><span class="pre">\PolDivide{<polname_1>}{<polname_2>}{<polname_Q>}{<polname_R>}</span></span></a></h2> <blockquote> <p>This sets <span class="docutils literal">polname_Q</span> and <span class="docutils literal">polname_R</span> to be the quotient and remainder in the Euclidean division of <span class="docutils literal">polname_1</span> by @@ -3025,21 +2612,21 @@ remainder in the Euclidean division of <span class="docutils literal">polname_1< </blockquote> </div> <div class="section" id="polquo-polname-1-polname-2-polname-q"> -<span id="polquo"></span><h2><a class="toc-backref" href="#id136"><span class="docutils literal"><span class="pre">\PolQuo{<polname_1>}{<polname_2>}{<polname_Q>}</span></span></a></h2> +<span id="polquo"></span><h2><a class="toc-backref" href="#id127"><span class="docutils literal"><span class="pre">\PolQuo{<polname_1>}{<polname_2>}{<polname_Q>}</span></span></a></h2> <blockquote> <p>This sets <span class="docutils literal">polname_Q</span> to be the quotient in the Euclidean division of <span class="docutils literal">polname_1</span> by <span class="docutils literal">polname_2</span>.</p> </blockquote> </div> <div class="section" id="polrem-polname-1-polname-2-polname-r"> -<span id="polrem"></span><h2><a class="toc-backref" href="#id137"><span class="docutils literal"><span class="pre">\PolRem{<polname_1>}{<polname_2>}{<polname_R>}</span></span></a></h2> +<span id="polrem"></span><h2><a class="toc-backref" href="#id128"><span class="docutils literal"><span class="pre">\PolRem{<polname_1>}{<polname_2>}{<polname_R>}</span></span></a></h2> <blockquote> <p>This sets <span class="docutils literal">polname_R</span> to be the remainder in the Euclidean division of <span class="docutils literal">polname_1</span> by <span class="docutils literal">polname_2</span>.</p> </blockquote> </div> <div class="section" id="polgcd-polname-1-polname-2-polname-gcd"> -<span id="polgcd"></span><h2><a class="toc-backref" href="#id138"><span class="docutils literal"><span class="pre">\PolGCD{<polname_1>}{<polname_2>}{<polname_GCD>}</span></span></a></h2> +<span id="polgcd"></span><h2><a class="toc-backref" href="#id129"><span class="docutils literal"><span class="pre">\PolGCD{<polname_1>}{<polname_2>}{<polname_GCD>}</span></span></a></h2> <blockquote> <p>This sets <span class="docutils literal">polname_GCD</span> to be the (monic) GCD of <span class="docutils literal">polname_1</span> and <span class="docutils literal">polname_2</span>. It is a unitary polynomial except if both @@ -3049,7 +2636,7 @@ zero polynomial.</p> </div> </div> <div class="section" id="expandable-macros"> -<h1><a class="toc-backref" href="#id139">Expandable macros</a></h1> +<h1><a class="toc-backref" href="#id130">Expandable macros</a></h1> <div class="admonition note"> <p class="admonition-title">Note</p> <p>At <span class="docutils literal">0.8</span> <span class="docutils literal">polexpr</span> is usable with Plain TeX and not only with @@ -3061,7 +2648,7 @@ if testing with a non LaTeX macro format.</p> <span class="docutils literal">\PolToFloatExpr</span> which need a <span class="docutils literal">\write</span>, <span class="docutils literal">\edef</span> or a <span class="docutils literal"><span class="pre">\csname...\endcsname</span></span> context.</p> <div class="section" id="poltoexpr-pol-expr"> -<span id="poltoexpr"></span><h2><a class="toc-backref" href="#id140"><span class="docutils literal"><span class="pre">\PolToExpr{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> +<span id="poltoexpr"></span><h2><a class="toc-backref" href="#id131"><span class="docutils literal"><span class="pre">\PolToExpr{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> <blockquote> <p>Produces expandably <a class="footnote-reference brackets" href="#id26" id="id25">4</a> the string <span class="docutils literal"><span class="pre">coeff_N*x^N+...</span></span>, i.e. the polynomial is using descending powers.</p> @@ -3072,19 +2659,17 @@ polynomial is using descending powers.</p> </dd> </dl> <p>Since <span class="docutils literal">0.8</span> the input is not restricted to be a polynomial name but -is allowed to be an arbitrary expression (where by default the -letter <span class="docutils literal">x</span> is recognized as the indeterminate; see -<a class="reference internal" href="#poltoexprinvar">\PolToExprInVar</a>).</p> -<p>The default output (which also by default uses the letter <span class="docutils literal">x</span> and is -completely configurable, see in particular <a class="reference internal" href="#poltoexprvar">\PolToExprVar</a>) is -compatible with both</p> +is allowed to be an arbitrary expression. Then <span class="docutils literal">x</span> is expected as +indeterminate but this can be customized via <a class="reference internal" href="#poltoexprinvar">\PolToExprInVar</a>.</p> +<p>The output uses the letter <span class="docutils literal">x</span> by default, this is customizable +via <a class="reference internal" href="#poltoexprvar">\PolToExprVar</a>. The default output is compatible both with</p> <ul class="simple"> <li><p>the Maple's input format,</p></li> <li><p>and the PSTricks <span class="docutils literal">\psplot[algebraic]</span> input format.</p></li> </ul> -<p>Attention that it is not compatible with Python, but see -<a class="reference internal" href="#poltoexprcaret">\PolToExprCaret</a> in this regard.</p> -<p>It has the following characteristics:</p> +<p>Attention that it is not compatible with Python, see further +<a class="reference internal" href="#poltoexprcaret">\PolToExprCaret</a> in this context.</p> +<p>The following applies:</p> <ul class="simple"> <li><p>vanishing coefficients are skipped (issue <span class="docutils literal">\poltoexpralltrue</span> to override this and produce output such as <span class="docutils literal">x^3+0*x^2+0*x^1+0</span>),</p></li> @@ -3106,15 +2691,16 @@ is not supposed to be a typesetting macro.</p></li> redefinition must maintain the expandability property.</p> </blockquote> <div class="section" id="id27"> -<span id="poltoexprvar"></span><h3><a class="toc-backref" href="#id141"><span class="docutils literal">\PolToExprVar</span></a></h3> +<span id="poltoexprvar"></span><h3><a class="toc-backref" href="#id132"><span class="docutils literal">\PolToExprVar</span></a></h3> <blockquote> -<p>Defaults to <span class="docutils literal">x</span>. The letter used in input.</p> +<p>Defaults to <span class="docutils literal">x</span>. The letter used in the macro output.</p> </blockquote> </div> <div class="section" id="poltoexprinvar"> -<h3><a class="toc-backref" href="#id142"><span class="docutils literal">\PolToExprInVar</span></a></h3> +<h3><a class="toc-backref" href="#id133"><span class="docutils literal">\PolToExprInVar</span></a></h3> <blockquote> -<p>Defaults to <span class="docutils literal">x</span>: the letter used as the polynomial indeterminate.</p> +<p>Defaults to <span class="docutils literal">x</span>: the letter used as the polynomial indeterminate +in the macro input.</p> <p>Recall that declared polynomials are more efficiently used in algebraic expressions without the <span class="docutils literal">(x)</span>, i.e. <span class="docutils literal">P*Q</span> is better than <span class="docutils literal"><span class="pre">P(x)*Q(x)</span></span>. Thus the input, even if an expression, does not @@ -3123,13 +2709,13 @@ have to contain any <span class="docutils literal">x</span>.</p> </blockquote> </div> <div class="section" id="id28"> -<span id="poltoexprtimes"></span><h3><a class="toc-backref" href="#id143"><span class="docutils literal">\PolToExprTimes</span></a></h3> +<span id="poltoexprtimes"></span><h3><a class="toc-backref" href="#id134"><span class="docutils literal">\PolToExprTimes</span></a></h3> <blockquote> <p>Defaults to <span class="docutils literal">*</span>.</p> </blockquote> </div> <div class="section" id="poltoexprcaret"> -<h3><a class="toc-backref" href="#id144"><span class="docutils literal">\PolToExprCaret</span></a></h3> +<h3><a class="toc-backref" href="#id135"><span class="docutils literal">\PolToExprCaret</span></a></h3> <blockquote> <p>Defaults to <span class="docutils literal">^</span> of catcode 12. Set it to expand to <span class="docutils literal">**</span> for Python compatible output.</p> @@ -3137,7 +2723,7 @@ expand to <span class="docutils literal">**</span> for Python compatible output </blockquote> </div> <div class="section" id="poltoexprcmd-raw-coeff"> -<span id="poltoexprcmd"></span><h3><a class="toc-backref" href="#id145"><span class="docutils literal"><span class="pre">\PolToExprCmd{<raw_coeff>}</span></span></a></h3> +<span id="poltoexprcmd"></span><h3><a class="toc-backref" href="#id136"><span class="docutils literal"><span class="pre">\PolToExprCmd{<raw_coeff>}</span></span></a></h3> <blockquote> <p>Defaults to <span class="docutils literal"><span class="pre">\xintPRaw{\xintRawWithZeros{#1}}</span></span>.</p> <p>This means that the coefficient value is printed-out as a fraction @@ -3156,7 +2742,7 @@ and not their finite decimal expansion with no denominator.</p> </blockquote> </div> <div class="section" id="poltoexproneterm-raw-coeff-exponent"> -<span id="poltoexproneterm"></span><h3><a class="toc-backref" href="#id146"><span class="docutils literal"><span class="pre">\PolToExprOneTerm{<raw_coeff>}{<exponent>}</span></span></a></h3> +<span id="poltoexproneterm"></span><h3><a class="toc-backref" href="#id137"><span class="docutils literal"><span class="pre">\PolToExprOneTerm{<raw_coeff>}{<exponent>}</span></span></a></h3> <blockquote> <p>This is the macro which from the coefficient and the exponent produces the corresponding term in output, such as <span class="docutils literal">2/3*x^7</span>.</p> @@ -3166,13 +2752,13 @@ produces the corresponding term in output, such as <span class="docutils literal </blockquote> </div> <div class="section" id="poltoexpronetermstylea-raw-coeff-exponent"> -<span id="poltoexpronetermstylea"></span><h3><a class="toc-backref" href="#id147"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleA{<raw_coeff>}{<exponent>}</span></span></a></h3> +<span id="poltoexpronetermstylea"></span><h3><a class="toc-backref" href="#id138"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleA{<raw_coeff>}{<exponent>}</span></span></a></h3> <blockquote> <p>This holds the default package meaning of <span class="docutils literal">\PolToExprOneTerm</span>.</p> </blockquote> </div> <div class="section" id="poltoexpronetermstyleb-raw-coeff-exponent"> -<span id="poltoexpronetermstyleb"></span><h3><a class="toc-backref" href="#id148"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleB{<raw_coeff>}{<exponent>}</span></span></a></h3> +<span id="poltoexpronetermstyleb"></span><h3><a class="toc-backref" href="#id139"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleB{<raw_coeff>}{<exponent>}</span></span></a></h3> <blockquote> <p>This holds an alternative meaning, which puts the fractional part of a coefficient after the monomial, i.e. like this:</p> @@ -3185,7 +2771,7 @@ To revert to the package default behaviour, issue </blockquote> </div> <div class="section" id="poltoexprtermprefix-raw-coeff"> -<span id="poltoexprtermprefix"></span><h3><a class="toc-backref" href="#id149"><span class="docutils literal"><span class="pre">\PolToExprTermPrefix{<raw_coeff>}</span></span></a></h3> +<span id="poltoexprtermprefix"></span><h3><a class="toc-backref" href="#id140"><span class="docutils literal"><span class="pre">\PolToExprTermPrefix{<raw_coeff>}</span></span></a></h3> <blockquote> <p>It receives as argument the coefficient. Its default behaviour is to produce a <span class="docutils literal">+</span> if the coefficient is positive, which will thus @@ -3196,7 +2782,7 @@ positive coefficient does not output an explicit <span class="docutils literal"> </div> </div> <div class="section" id="poltofloatexpr-pol-expr"> -<span id="poltofloatexpr"></span><h2><a class="toc-backref" href="#id150"><span class="docutils literal"><span class="pre">\PolToFloatExpr{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> +<span id="poltofloatexpr"></span><h2><a class="toc-backref" href="#id141"><span class="docutils literal"><span class="pre">\PolToFloatExpr{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> <blockquote> <p>Similar to <a class="reference internal" href="#poltoexpr-pol-expr">\PolToExpr{<pol. expr.>}</a> but using <a class="reference internal" href="#poltofloatexprcmd-raw-coeff">\PolToFloatExprCmd{<raw_coeff>}</a> which by default rounds and @@ -3213,14 +2799,14 @@ in between).</p> <p>Extended at <span class="docutils literal">0.8</span> to accept general expressions as input.</p> </blockquote> <div class="section" id="poltofloatexproneterm-raw-coeff-exponent"> -<span id="poltofloatexproneterm"></span><h3><a class="toc-backref" href="#id151"><span class="docutils literal"><span class="pre">\PolToFloatExprOneTerm{<raw_coeff>}{<exponent>}</span></span></a></h3> +<span id="poltofloatexproneterm"></span><h3><a class="toc-backref" href="#id142"><span class="docutils literal"><span class="pre">\PolToFloatExprOneTerm{<raw_coeff>}{<exponent>}</span></span></a></h3> <blockquote> <p>Similar to <a class="reference internal" href="#poltoexproneterm-raw-coeff-exponent">\PolToExprOneTerm{<raw_coeff>}{<exponent>}</a>. But does not treat especially coefficients equal to plus or minus one.</p> </blockquote> </div> <div class="section" id="poltofloatexprcmd-raw-coeff"> -<span id="poltofloatexprcmd"></span><h3><a class="toc-backref" href="#id152"><span class="docutils literal"><span class="pre">\PolToFloatExprCmd{<raw_coeff>}</span></span></a></h3> +<span id="poltofloatexprcmd"></span><h3><a class="toc-backref" href="#id143"><span class="docutils literal"><span class="pre">\PolToFloatExprCmd{<raw_coeff>}</span></span></a></h3> <blockquote> <p>The one-argument macro used by <span class="docutils literal">\PolToFloatExprOneTerm</span>. It defaults to <span class="docutils literal"><span class="pre">\xintPFloat{#1}</span></span>, which trims trailing @@ -3230,7 +2816,7 @@ zeroes.</p> </div> </div> <div class="section" id="id30"> -<span id="id29"></span><h2><a class="toc-backref" href="#id153"><span class="docutils literal"><span class="pre">\PolToExpr*{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> +<span id="id29"></span><h2><a class="toc-backref" href="#id144"><span class="docutils literal"><span class="pre">\PolToExpr*{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> <blockquote> <p>Ascending powers: <span class="docutils literal"><span class="pre">coeff_0+coeff_1*x+coeff_2*x^2+...</span></span>.</p> <p>Extended at <span class="docutils literal">0.8</span> to accept general expressions as input.</p> @@ -3239,38 +2825,38 @@ zeroes.</p> </blockquote> </div> <div class="section" id="id32"> -<span id="id31"></span><h2><a class="toc-backref" href="#id154"><span class="docutils literal"><span class="pre">\PolToFloatExpr*{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> +<span id="id31"></span><h2><a class="toc-backref" href="#id145"><span class="docutils literal"><span class="pre">\PolToFloatExpr*{<pol.</span> <span class="pre">expr.>}</span></span></a></h2> <blockquote> <p>Ascending powers.</p> <p>Extended at <span class="docutils literal">0.8</span> to accept general expressions as input.</p> </blockquote> </div> <div class="section" id="polnthcoeff-polname-index"> -<span id="polnthcoeff"></span><h2><a class="toc-backref" href="#id155"><span class="docutils literal"><span class="pre">\PolNthCoeff{<polname>}{<index>}</span></span></a></h2> +<span id="polnthcoeff"></span><h2><a class="toc-backref" href="#id146"><span class="docutils literal"><span class="pre">\PolNthCoeff{<polname>}{<index>}</span></span></a></h2> <blockquote> <p>It expands to the raw <span class="docutils literal">N</span>-th coefficient (<span class="docutils literal">N=0</span> corresponds to the constant coefficient). If <span class="docutils literal">N</span> is out of range, zero (in its -default <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> format <span class="docutils literal">0/1[0]</span>) is returned.</p> +default <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> format <span class="docutils literal">0/1[0]</span>) is returned.</p> <p>Negative indices <span class="docutils literal"><span class="pre">N=-1</span></span>, <span class="docutils literal"><span class="pre">-2</span></span>, ... return the leading coefficient, sub-leading coefficient, ..., and finally <span class="docutils literal">0/1[0]</span> for <span class="docutils literal"><span class="pre">N<-1-degree</span></span>.</p> </blockquote> </div> <div class="section" id="polleadingcoeff-polname"> -<span id="polleadingcoeff"></span><h2><a class="toc-backref" href="#id156"><span class="docutils literal"><span class="pre">\PolLeadingCoeff{<polname>}</span></span></a></h2> +<span id="polleadingcoeff"></span><h2><a class="toc-backref" href="#id147"><span class="docutils literal"><span class="pre">\PolLeadingCoeff{<polname>}</span></span></a></h2> <blockquote> <p>Expands to the leading coefficient.</p> </blockquote> </div> <div class="section" id="poldegree-polname"> -<span id="poldegree"></span><h2><a class="toc-backref" href="#id157"><span class="docutils literal"><span class="pre">\PolDegree{<polname>}</span></span></a></h2> +<span id="poldegree"></span><h2><a class="toc-backref" href="#id148"><span class="docutils literal"><span class="pre">\PolDegree{<polname>}</span></span></a></h2> <blockquote> <p>It expands to the degree. This is <span class="docutils literal"><span class="pre">-1</span></span> if zero polynomial but this may change in future. Should it then expand to <span class="docutils literal"><span class="pre">-\infty</span></span> ?</p> </blockquote> </div> <div class="section" id="policontent-polname"> -<span id="policontent"></span><h2><a class="toc-backref" href="#id158"><span class="docutils literal"><span class="pre">\PolIContent{<polname>}</span></span></a></h2> +<span id="policontent"></span><h2><a class="toc-backref" href="#id149"><span class="docutils literal"><span class="pre">\PolIContent{<polname>}</span></span></a></h2> <blockquote> <p>It expands to the contents of the polynomial, i.e. to the positive fraction such that dividing by this fraction produces a polynomial @@ -3279,7 +2865,7 @@ with integer coefficients having no common prime divisor.</p> </blockquote> </div> <div class="section" id="poltolist-polname"> -<span id="poltolist"></span><h2><a class="toc-backref" href="#id159"><span class="docutils literal"><span class="pre">\PolToList{<polname>}</span></span></a></h2> +<span id="poltolist"></span><h2><a class="toc-backref" href="#id150"><span class="docutils literal"><span class="pre">\PolToList{<polname>}</span></span></a></h2> <blockquote> <p>Expands to <span class="docutils literal"><span class="pre">{coeff_0}{coeff_1}...{coeff_N}</span></span> with <span class="docutils literal">N</span> = degree, and <span class="docutils literal">coeff_N</span> the leading coefficient @@ -3288,7 +2874,7 @@ empty output.)</p> </blockquote> </div> <div class="section" id="poltocsv-polname"> -<span id="poltocsv"></span><h2><a class="toc-backref" href="#id160"><span class="docutils literal"><span class="pre">\PolToCSV{<polname>}</span></span></a></h2> +<span id="poltocsv"></span><h2><a class="toc-backref" href="#id151"><span class="docutils literal"><span class="pre">\PolToCSV{<polname>}</span></span></a></h2> <blockquote> <p>Expands to <span class="docutils literal">coeff_0, coeff_1, coeff_2, <span class="pre">.....,</span> coeff_N</span>, starting with constant term and ending with leading coefficient. Converse @@ -3296,35 +2882,35 @@ to <a class="reference internal" href="#polfromcsv-polname-csv">\PolFromCSV{< </blockquote> </div> <div class="section" id="poleval-polname-atexpr-num-expr"> -<span id="polevalatexpr"></span><h2><a class="toc-backref" href="#id161"><span class="docutils literal"><span class="pre">\PolEval{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></h2> +<span id="polevalatexpr"></span><h2><a class="toc-backref" href="#id152"><span class="docutils literal"><span class="pre">\PolEval{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></h2> <blockquote> <p>Same output as <span class="docutils literal">\xinteval{polname(numerical expression)}</span>.</p> </blockquote> </div> <div class="section" id="poleval-polname-at-value"> -<span id="polevalat"></span><h2><a class="toc-backref" href="#id162"><span class="docutils literal"><span class="pre">\PolEval{<polname>}\At{<value>}</span></span></a></h2> +<span id="polevalat"></span><h2><a class="toc-backref" href="#id153"><span class="docutils literal"><span class="pre">\PolEval{<polname>}\At{<value>}</span></span></a></h2> <blockquote> <p>Evaluates the polynomial at the given value which must be in (or -expand to) a format acceptable to the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macros.</p> +expand to) a format acceptable to the <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> macros.</p> </blockquote> </div> <div class="section" id="polevalreduced-polname-atexpr-num-expr"> -<span id="polevalreducedatexpr"></span><h2><a class="toc-backref" href="#id163"><span class="docutils literal"><span class="pre">\PolEvalReduced{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></h2> +<span id="polevalreducedatexpr"></span><h2><a class="toc-backref" href="#id154"><span class="docutils literal"><span class="pre">\PolEvalReduced{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></h2> <blockquote> <p>Same output as <span class="docutils literal">\xinteval{reduce(polname(numerical <span class="pre">expression))}</span></span>.</p> </blockquote> </div> <div class="section" id="polevalreduced-polname-at-value"> -<span id="polevalreducedat"></span><h2><a class="toc-backref" href="#id164"><span class="docutils literal"><span class="pre">\PolEvalReduced{<polname>}\At{<value>}</span></span></a></h2> +<span id="polevalreducedat"></span><h2><a class="toc-backref" href="#id155"><span class="docutils literal"><span class="pre">\PolEvalReduced{<polname>}\At{<value>}</span></span></a></h2> <blockquote> <p>Evaluates the polynomial at the value which must be in (or expand -to) a format acceptable to the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macros, and outputs an +to) a format acceptable to the <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> macros, and outputs an irreducible fraction.</p> </blockquote> </div> <div class="section" id="polfloateval-polname-atexpr-num-expr"> -<span id="polfloatevalatexpr"></span><h2><a class="toc-backref" href="#id165"><span class="docutils literal"><span class="pre">\PolFloatEval{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></h2> +<span id="polfloatevalatexpr"></span><h2><a class="toc-backref" href="#id156"><span class="docutils literal"><span class="pre">\PolFloatEval{<polname>}\AtExpr{<num.</span> <span class="pre">expr.>}</span></span></a></h2> <blockquote> <p>Same output as <span class="docutils literal">\xintfloateval{polname(numerical expression)}</span>.</p> <div class="admonition attention"> @@ -3338,22 +2924,22 @@ the following syntax can be used: <a class="footnote-reference brackets" href="# <pre class="literal-block">\xintfloateval{3.27*\xintexpr f(2.53)\relax^2}</pre> <dl class="footnote brackets"> <dt class="label" id="id34"><span class="brackets"><a class="fn-backref" href="#id33">5</a></span></dt> -<dd><p>Cf. <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> documentation about nested expressions.</p> +<dd><p>Cf. <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> documentation about nested expressions.</p> </dd> </dl> </blockquote> </div> <div class="section" id="polfloateval-polname-at-value"> -<span id="polfloatevalat"></span><h2><a class="toc-backref" href="#id166"><span class="docutils literal"><span class="pre">\PolFloatEval{<polname>}\At{<value>}</span></span></a></h2> +<span id="polfloatevalat"></span><h2><a class="toc-backref" href="#id157"><span class="docutils literal"><span class="pre">\PolFloatEval{<polname>}\At{<value>}</span></span></a></h2> <blockquote> <p>Evaluates the polynomial at the value which must be in (or expand -to) a format acceptable to the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macros.</p> +to) a format acceptable to the <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> macros.</p> </blockquote> </div> <div class="section" id="expandable-macros-related-to-the-root-localization-routines"> -<h2><a class="toc-backref" href="#id167">Expandable macros related to the root localization routines</a></h2> +<h2><a class="toc-backref" href="#id158">Expandable macros related to the root localization routines</a></h2> <div class="section" id="polsturmchainlength-sturmname"> -<span id="polsturmchainlength"></span><h3><a class="toc-backref" href="#id168"><span class="docutils literal"><span class="pre">\PolSturmChainLength{<sturmname>}</span></span></a></h3> +<span id="polsturmchainlength"></span><h3><a class="toc-backref" href="#id159"><span class="docutils literal"><span class="pre">\PolSturmChainLength{<sturmname>}</span></span></a></h3> <blockquote> <p>Returns the integer <span class="docutils literal">N</span> such that <span class="docutils literal">sturmname_N</span> is the last one in the Sturm chain <span class="docutils literal">sturmname_0</span>, <span class="docutils literal">sturmname_1</span>, ...</p> @@ -3361,14 +2947,14 @@ in the Sturm chain <span class="docutils literal">sturmname_0</span>, <span clas </blockquote> </div> <div class="section" id="polsturmifzeroexactlyknown-sturmname-index-t-f"> -<span id="polsturmifzeroexactlyknown"></span><h3><a class="toc-backref" href="#id169"><span class="docutils literal"><span class="pre">\PolSturmIfZeroExactlyKnown{<sturmname>}{<index>}{T}{F}</span></span></a></h3> +<span id="polsturmifzeroexactlyknown"></span><h3><a class="toc-backref" href="#id160"><span class="docutils literal"><span class="pre">\PolSturmIfZeroExactlyKnown{<sturmname>}{<index>}{T}{F}</span></span></a></h3> <blockquote> <p>Executes <span class="docutils literal">T</span> if the <span class="docutils literal">index</span>-th interval reduces to a singleton, i.e. the root is known exactly, else <span class="docutils literal">F</span>.</p> </blockquote> </div> <div class="section" id="polsturmisolatedzeroleft-sturmname-index"> -<span id="polsturmisolatedzeroleft"></span><h3><a class="toc-backref" href="#id170"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroLeft{<sturmname>}{<index>}</span></span></a></h3> +<span id="polsturmisolatedzeroleft"></span><h3><a class="toc-backref" href="#id161"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroLeft{<sturmname>}{<index>}</span></span></a></h3> <blockquote> <p>Expands to the left end-point for the <span class="docutils literal">index</span>-th interval, as computed by some earlier <a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{<sturmname>}</a>.</p> @@ -3382,7 +2968,7 @@ will take into account the now known tighter bounds.</p> </blockquote> </div> <div class="section" id="polsturmisolatedzeroright-sturmname-index"> -<span id="polsturmisolatedzeroright"></span><h3><a class="toc-backref" href="#id171"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroRight{<sturmname>}{<index>}</span></span></a></h3> +<span id="polsturmisolatedzeroright"></span><h3><a class="toc-backref" href="#id162"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroRight{<sturmname>}{<index>}</span></span></a></h3> <blockquote> <p>Expands to the right end-point for the <span class="docutils literal">index</span>-th interval as computed by some earlier <a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{<sturmname>}</a> and @@ -3391,7 +2977,7 @@ possibly refined afterwards.</p> </blockquote> </div> <div class="section" id="polsturmisolatedzeromultiplicity-sturmname-index"> -<span id="polsturmisolatedzeromultiplicity"></span><h3><a class="toc-backref" href="#id172"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroMultiplicity{<sturmname>}{<index>}</span></span></a></h3> +<span id="polsturmisolatedzeromultiplicity"></span><h3><a class="toc-backref" href="#id163"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroMultiplicity{<sturmname>}{<index>}</span></span></a></h3> <blockquote> <p>Expands to the multiplicity of the unique root contained in the <span class="docutils literal">index</span>-th interval.</p> @@ -3399,12 +2985,11 @@ possibly refined afterwards.</p> <p class="admonition-title">Attention!</p> <p>A prior execution of <a class="reference internal" href="#id15">\PolSturmIsolateZeros*{<sturmname>}</a> is mandatory.</p> </div> -<p>See <a class="reference internal" href="#the-degree-nine-polynomial-with-0-99-0-999-0-9999-as-triple-roots">The degree nine polynomial with 0.99, 0.999, 0.9999 as triple -roots</a> for an example of use.</p> +<p>See <span class="docutils literal">The degree nine polynomial with 0.99, 0.999, 0.9999 as triple roots</span> in <span class="docutils literal"><span class="pre">polexpr-examples.pdf</span></span>.</p> </blockquote> </div> <div class="section" id="polsturmnbofisolatedzeros-sturmname"> -<span id="polsturmnbofisolatedzeros"></span><h3><a class="toc-backref" href="#id173"><span class="docutils literal"><span class="pre">\PolSturmNbOfIsolatedZeros{<sturmname>}</span></span></a></h3> +<span id="polsturmnbofisolatedzeros"></span><h3><a class="toc-backref" href="#id164"><span class="docutils literal"><span class="pre">\PolSturmNbOfIsolatedZeros{<sturmname>}</span></span></a></h3> <blockquote> <p>Expands to the number of real roots of the polynomial <span class="docutils literal"><sturmname>_0</span>, i.e. the number of distinct real roots of the @@ -3421,11 +3006,11 @@ documented package macros anyway.</p> </div> </div> <div class="section" id="polsturmnbofrootsof-sturmname-lessthanorequalto-value"> -<h3><a class="toc-backref" href="#id174"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{<sturmname>}\LessThanOrEqualTo{<value>}</span></span></a></h3> +<h3><a class="toc-backref" href="#id165"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{<sturmname>}\LessThanOrEqualTo{<value>}</span></span></a></h3> <blockquote> <p>Expands to the number of distinct roots (of the polynomial used to create the Sturm chain) less than or equal to the <span class="docutils literal">value</span> (i.e. a -number of fraction recognizable by the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macros).</p> +number of fraction recognizable by the <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> macros).</p> <div class="admonition attention"> <p class="admonition-title">Attention!</p> <p><a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{<sturmname>}</a> must have been executed @@ -3437,7 +3022,7 @@ of the above constraint.</p> </blockquote> </div> <div class="section" id="polsturmnbofrootsof-sturmname-lessthanorequaltoexpr-num-expr"> -<span id="polsturmnbofrootsof"></span><h3><a class="toc-backref" href="#id175"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{<sturmname>}\LessThanOrEqualToExpr{<num.</span> <span class="pre">expr.>}</span></span></a></h3> +<span id="polsturmnbofrootsof"></span><h3><a class="toc-backref" href="#id166"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{<sturmname>}\LessThanOrEqualToExpr{<num.</span> <span class="pre">expr.>}</span></span></a></h3> <blockquote> <p>Expands to the number of distinct roots (of the polynomial used to create the Sturm chain) which are less than or equal to the @@ -3450,7 +3035,7 @@ beforehand.</p> </blockquote> </div> <div class="section" id="polsturmnbwithmultofrootsof-sturmname-lessthanorequalto-value"> -<h3><a class="toc-backref" href="#id176"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{<sturmname>}\LessThanOrEqualTo{<value>}</span></span></a></h3> +<h3><a class="toc-backref" href="#id167"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{<sturmname>}\LessThanOrEqualTo{<value>}</span></span></a></h3> <blockquote> <p>Expands to the number counted with multiplicities of the roots (of the polynomial used to create the Sturm chain) which are less than @@ -3463,7 +3048,7 @@ variant) must have been executed beforehand.</p> </blockquote> </div> <div class="section" id="polsturmnbwithmultofrootsof-sturmname-lessthanorequaltoexpr-num-expr"> -<h3><a class="toc-backref" href="#id177"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{<sturmname>}\LessThanOrEqualToExpr{<num.</span> <span class="pre">expr.>}</span></span></a></h3> +<h3><a class="toc-backref" href="#id168"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{<sturmname>}\LessThanOrEqualToExpr{<num.</span> <span class="pre">expr.>}</span></span></a></h3> <blockquote> <p>Expands to the total number of roots (counted with multiplicities) which are less than or equal to the given <span class="docutils literal">expression</span>.</p> @@ -3475,7 +3060,7 @@ variant) must have been executed beforehand.</p> </blockquote> </div> <div class="section" id="polsturmnbofrationalroots-sturmname"> -<h3><a class="toc-backref" href="#id178"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRoots{<sturmname>}</span></span></a></h3> +<h3><a class="toc-backref" href="#id169"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRoots{<sturmname>}</span></span></a></h3> <blockquote> <p>Expands to the number of rational roots (without multiplicities).</p> <div class="admonition attention"> @@ -3486,7 +3071,7 @@ beforehand.</p> </blockquote> </div> <div class="section" id="polsturmnbofrationalrootswithmultiplicities-sturmname"> -<h3><a class="toc-backref" href="#id179"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRootsWithMultiplicities{<sturmname>}</span></span></a></h3> +<h3><a class="toc-backref" href="#id170"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRootsWithMultiplicities{<sturmname>}</span></span></a></h3> <blockquote> <p>Expands to the number of rational roots (counted with multiplicities).</p> <div class="admonition attention"> @@ -3497,7 +3082,7 @@ beforehand.</p> </blockquote> </div> <div class="section" id="polsturmrationalroot-sturmname-k"> -<h3><a class="toc-backref" href="#id180"><span class="docutils literal"><span class="pre">\PolSturmRationalRoot{<sturmname>}{<k>}</span></span></a></h3> +<h3><a class="toc-backref" href="#id171"><span class="docutils literal"><span class="pre">\PolSturmRationalRoot{<sturmname>}{<k>}</span></span></a></h3> <blockquote> <p>Expands to the k-th rational root. They are enumerated from left to right starting at index value <span class="docutils literal">1</span>.</p> @@ -3509,7 +3094,7 @@ beforehand.</p> </blockquote> </div> <div class="section" id="polsturmrationalrootindex-sturmname-k"> -<h3><a class="toc-backref" href="#id181"><span class="docutils literal"><span class="pre">\PolSturmRationalRootIndex{<sturmname>}{<k>}</span></span></a></h3> +<h3><a class="toc-backref" href="#id172"><span class="docutils literal"><span class="pre">\PolSturmRationalRootIndex{<sturmname>}{<k>}</span></span></a></h3> <blockquote> <p>Expands to the index of the <span class="docutils literal">k</span>th rational root as part of the ordered real roots (counted without multiplicities). So @@ -3524,7 +3109,7 @@ beforehand.</p> </blockquote> </div> <div class="section" id="polsturmrationalrootmultiplicity-sturmname-k"> -<h3><a class="toc-backref" href="#id182"><span class="docutils literal"><span class="pre">\PolSturmRationalRootMultiplicity{<sturmname>}{<k>}</span></span></a></h3> +<h3><a class="toc-backref" href="#id173"><span class="docutils literal"><span class="pre">\PolSturmRationalRootMultiplicity{<sturmname>}{<k>}</span></span></a></h3> <blockquote> <p>Expands to the multiplicity of the <span class="docutils literal">k</span>th rational root.</p> <div class="admonition attention"> @@ -3535,14 +3120,14 @@ beforehand.</p> </blockquote> </div> <div class="section" id="polintervalwidth-sturmname-index"> -<span id="polintervalwidth"></span><h3><a class="toc-backref" href="#id183"><span class="docutils literal"><span class="pre">\PolIntervalWidth{<sturmname>}{<index>}</span></span></a></h3> +<span id="polintervalwidth"></span><h3><a class="toc-backref" href="#id174"><span class="docutils literal"><span class="pre">\PolIntervalWidth{<sturmname>}{<index>}</span></span></a></h3> <blockquote> <p>The <span class="docutils literal">10^E</span> width of the current <span class="docutils literal">index</span>-th root localization -interval. Output is in <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> raw <span class="docutils literal">1/1[E]</span> format (if not zero).</p> +interval. Output is in <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> raw <span class="docutils literal">1/1[E]</span> format (if not zero).</p> </blockquote> </div> <div class="section" id="expandable-macros-for-use-within-execution-of-polprintintervals"> -<h3><a class="toc-backref" href="#id184">Expandable macros for use within execution of <span class="docutils literal">\PolPrintIntervals</span></a></h3> +<h3><a class="toc-backref" href="#id175">Expandable macros for use within execution of <span class="docutils literal">\PolPrintIntervals</span></a></h3> <p>These macros are for usage within custom user redefinitions of <a class="reference internal" href="#polprintintervalsknownroot">\PolPrintIntervalsKnownRoot</a>, <a class="reference internal" href="#polprintintervalsunknownroot">\PolPrintIntervalsUnknownRoot</a>, or in redefinitions of <a class="reference internal" href="#polprintintervalsprintexactzero">PolPrintIntervalsPrintExactZero</a> (used in the @@ -3551,7 +3136,7 @@ default for the former) and of <a class="reference internal" href="#polprintinte latter).</p> </div> <div class="section" id="polprintintervalsthevar"> -<h3><a class="toc-backref" href="#id185"><span class="docutils literal">\PolPrintIntervalsTheVar</span></a></h3> +<h3><a class="toc-backref" href="#id176"><span class="docutils literal">\PolPrintIntervalsTheVar</span></a></h3> <blockquote> <p>Expands to the name (default <span class="docutils literal">Z</span>) used for representing the roots, which was passed as optional argument <span class="docutils literal">varname</span> to @@ -3559,21 +3144,21 @@ which was passed as optional argument <span class="docutils literal">varname</sp </blockquote> </div> <div class="section" id="polprintintervalstheindex"> -<h3><a class="toc-backref" href="#id186"><span class="docutils literal">\PolPrintIntervalsTheIndex</span></a></h3> +<h3><a class="toc-backref" href="#id177"><span class="docutils literal">\PolPrintIntervalsTheIndex</span></a></h3> <blockquote> <p>Expands to the index of the considered interval (indexing starting at 1 for the leftmost interval).</p> </blockquote> </div> <div class="section" id="polprintintervalsthesturmname"> -<h3><a class="toc-backref" href="#id187"><span class="docutils literal">\PolPrintIntervalsTheSturmName</span></a></h3> +<h3><a class="toc-backref" href="#id178"><span class="docutils literal">\PolPrintIntervalsTheSturmName</span></a></h3> <blockquote> <p>Expands to the argument which was passed as <span class="docutils literal"><sturmname></span> to <a class="reference internal" href="#polprintintervals-varname-sturmname">\PolPrintIntervals[<varname>]{<sturmname>}</a>.</p> </blockquote> </div> <div class="section" id="polprintintervalstheleftendpoint"> -<h3><a class="toc-backref" href="#id188"><span class="docutils literal">\PolPrintIntervalsTheLeftEndPoint</span></a></h3> +<h3><a class="toc-backref" href="#id179"><span class="docutils literal">\PolPrintIntervalsTheLeftEndPoint</span></a></h3> <blockquote> <p>The left end point of the interval, as would be produced by <a class="reference internal" href="#polsturmisolatedzeroleft">\PolSturmIsolatedZeroLeft</a> if it was @@ -3583,7 +3168,7 @@ by <a class="reference internal" href="#polprintintervalsthesturmname">\PolPrint </blockquote> </div> <div class="section" id="polprintintervalstherightendpoint"> -<h3><a class="toc-backref" href="#id189"><span class="docutils literal">\PolPrintIntervalsTheRightEndPoint</span></a></h3> +<h3><a class="toc-backref" href="#id180"><span class="docutils literal">\PolPrintIntervalsTheRightEndPoint</span></a></h3> <blockquote> <p>The right end point of the interval, as would be produced by <a class="reference internal" href="#polsturmisolatedzeroright">\PolSturmIsolatedZeroRight</a> for @@ -3591,7 +3176,7 @@ this Sturm chain name and index.</p> </blockquote> </div> <div class="section" id="polprintintervalsthemultiplicity"> -<h3><a class="toc-backref" href="#id190"><span class="docutils literal">\PolPrintIntervalsTheMultiplicity</span></a></h3> +<h3><a class="toc-backref" href="#id181"><span class="docutils literal">\PolPrintIntervalsTheMultiplicity</span></a></h3> <blockquote> <p>The multiplicity of the unique root within the interval of index <a class="reference internal" href="#polprintintervalstheindex">\PolPrintIntervalsTheIndex</a>. Makes sense only if the starred (or @@ -3601,11 +3186,11 @@ double-starred) variant of <a class="reference internal" href="#polsturmisolatez </div> </div> <div class="section" id="booleans-with-default-setting-as-indicated"> -<h1><a class="toc-backref" href="#id191">Booleans (with default setting as indicated)</a></h1> +<h1><a class="toc-backref" href="#id182">Booleans (with default setting as indicated)</a></h1> <div class="section" id="xintverbosefalse"> -<h2><a class="toc-backref" href="#id192"><span class="docutils literal">\xintverbosefalse</span></a></h2> +<h2><a class="toc-backref" href="#id183"><span class="docutils literal">\xintverbosefalse</span></a></h2> <blockquote> -<p>This is actually an <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> configuration. Setting it to +<p>This is actually an <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> configuration. Setting it to <span class="docutils literal">true</span> triggers the writing of information to the log when new polynomial or scalar variables are defined.</p> <div class="admonition caution"> @@ -3616,7 +3201,7 @@ considered unstable and undocumented internal structures.</p> </blockquote> </div> <div class="section" id="polnewpolverbosefalse"> -<h2><a class="toc-backref" href="#id193"><span class="docutils literal">\polnewpolverbosefalse</span></a></h2> +<h2><a class="toc-backref" href="#id184"><span class="docutils literal">\polnewpolverbosefalse</span></a></h2> <blockquote> <p>When <span class="docutils literal">\poldef</span> is used, both a variable and a function are defined. The default <span class="docutils literal">\polnewpolverbosefalse</span> setting suppresses @@ -3636,14 +3221,14 @@ roots obey only the <span class="docutils literal"><span class="pre">\xintverbos </blockquote> </div> <div class="section" id="poltypesetallfalse"> -<h2><a class="toc-backref" href="#id194"><span class="docutils literal">\poltypesetallfalse</span></a></h2> +<h2><a class="toc-backref" href="#id185"><span class="docutils literal">\poltypesetallfalse</span></a></h2> <blockquote> <p>If <span class="docutils literal">true</span>, <a class="reference internal" href="#poltypeset">\PolTypeset</a> will also typeset the vanishing coefficients.</p> </blockquote> </div> <div class="section" id="poltoexprallfalse"> -<h2><a class="toc-backref" href="#id195"><span class="docutils literal">\poltoexprallfalse</span></a></h2> +<h2><a class="toc-backref" href="#id186"><span class="docutils literal">\poltoexprallfalse</span></a></h2> <blockquote> <p>If <span class="docutils literal">true</span>, <a class="reference internal" href="#poltoexpr-pol-expr">\PolToExpr{<pol. expr.>}</a> and <a class="reference internal" href="#poltofloatexpr-pol-expr">\PolToFloatExpr{<pol. expr.>}</a> will also include the vanishing coefficients in their outputs.</p> @@ -3651,9 +3236,9 @@ also include the vanishing coefficients in their outputs.</p> </div> </div> <div class="section" id="utilies"> -<h1><a class="toc-backref" href="#id196">Utilies</a></h1> +<h1><a class="toc-backref" href="#id187">Utilies</a></h1> <div class="section" id="poldectostring-decimal-number"> -<span id="poldectostring"></span><h2><a class="toc-backref" href="#id197"><span class="docutils literal">\PolDecToString{decimal number}</span></a></h2> +<span id="poldectostring"></span><h2><a class="toc-backref" href="#id188"><span class="docutils literal">\PolDecToString{decimal number}</span></a></h2> <blockquote> <p>This is a utility macro to print decimal numbers. It is an alias for <span class="docutils literal">\xintDecToString</span>.</p> @@ -3667,12 +3252,12 @@ illustrates that trailing zeros are not trimmed.</p> <span class="docutils literal"><span class="pre">\PolDecToString{\xintREZ{#1}}</span></span>.</p> <p>Attention that a.t.t.o.w. if the argument is for example <span class="docutils literal">1/5</span>, the macro does not identify that this is in fact a number with a finite -decimal expansion and it outputs <span class="docutils literal">1/5</span>. See current <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> +decimal expansion and it outputs <span class="docutils literal">1/5</span>. See current <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> documentation.</p> </blockquote> </div> <div class="section" id="polexprsetup"> -<h2><a class="toc-backref" href="#id198"><span class="docutils literal">\polexprsetup</span></a></h2> +<h2><a class="toc-backref" href="#id189"><span class="docutils literal">\polexprsetup</span></a></h2> <blockquote> <p>Serves to customize the package. Currently only two keys are recognized:</p> @@ -3693,14 +3278,14 @@ no rational roots”).</p></li> </div> </div> <div class="section" id="technicalities"> -<h1><a class="toc-backref" href="#id199">Technicalities</a></h1> +<h1><a class="toc-backref" href="#id190">Technicalities</a></h1> <ul> <li><p>The catcode of the semi-colon is reset temporarily by <a class="reference internal" href="#poldef">\poldef</a> macro in case some other package (for example the French babel module) may have made it active. This will fail though if the whole thing was already part of a macro argument, in such cases one can use <a class="reference internal" href="#id8">\PolDef</a> rather. The colon in <span class="docutils literal">:=</span> may be active with no consequences.</p></li> -<li><p>As a consequence of <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> addition and subtraction always using +<li><p>As a consequence of <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a> addition and subtraction always using least common multiples for the denominators, user-chosen common denominators survive additions and multiplications. For example, this:</p> <pre class="literal-block">\poldef P(x):= 1/2 + 2/2*x + 3/2*x^3 + 4/2*x^4; @@ -3731,7 +3316,7 @@ documented and unstable. Don't use them.</p></li> </ul> </div> <div class="section" id="change-log"> -<h1><a class="toc-backref" href="#id200">CHANGE LOG</a></h1> +<h1><a class="toc-backref" href="#id191">CHANGE LOG</a></h1> <ul> <li><p>v0.1 (2018/01/11): initial release. Features:</p> <ul class="simple"> @@ -3910,7 +3495,7 @@ for localization of the real roots of polynomials.</p> <li><p>bug fixes:</p> <ul> <li><p><a class="reference internal" href="#polget-polname-fromarray-macro">\PolGet{<polname>}\fromarray\macro</a> crashed when <span class="docutils literal">\macro</span> was -an <a class="reference external" href="http://www.ctan.org/pkg/xint">xinttools</a> array macro with no items. It now produces the zero +an <a class="reference external" href="https://www.ctan.org/pkg/xint">xinttools</a> array macro with no items. It now produces the zero polynomial.</p></li> </ul> </li> @@ -3922,14 +3507,13 @@ This speeds up localization of roots via will make available again the code producing the bona fide Sturm polynomials as used formerly.</p></li> <li><p>polynomials created from <a class="reference internal" href="#polfromcsv">\PolFromCSV</a> or <a class="reference internal" href="#polget">\PolGet</a> -get their coefficients normalized via <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>'s <span class="docutils literal">\xintRaw</span>.</p></li> +get their coefficients normalized via <a class="reference external" href="https://www.ctan.org/pkg/xint">xintfrac</a>'s <span class="docutils literal">\xintRaw</span>.</p></li> </ul> </li> <li><p>experimental change:</p> <ul> -<li><p>optional argument to <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a> (see <a class="reference internal" href="#the-degree-41-polynomial-with-2-1-9-1-8-0-0-1-1-9-2-as-roots">The -degree 41 polynomial with -2, -1.9, -1.8, ..., 0, 0.1, ..., 1.9, 2 -as roots</a> for usage). It will presumably be replaced in future by +<li><p>optional argument to <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a> (see <span class="docutils literal">The degree 41 polynomial with <span class="pre">-2,</span> <span class="pre">-1.9,</span> <span class="pre">-1.8,</span> <span class="pre">...,</span> 0, 0.1, <span class="pre">...,</span> 1.9, 2 as roots</span> in <span class="docutils literal"><span class="pre">polexpr-examples.pdf</span></span>). +It will presumably be replaced in future by an interval specification.</p></li> </ul> </li> @@ -4124,7 +3708,7 @@ start letting <span class="docutils literal">\xintexpr</span> recognize a polyno variable. This has allowed:</p> <ul> <li><p>to solve the reduced inter-operability problems between polexpr -and <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> which arose as consequences to the deep <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> <span class="docutils literal">1.4</span> +and <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> which arose as consequences to the deep <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> <span class="docutils literal">1.4</span> evolution,</p></li> <li><p>to make available most of the functionality associated to expandable macros directly in the <span class="docutils literal">\xinteval</span> syntax as @@ -4153,8 +3737,8 @@ description</a>.</p> <li><p>Sadly, <span class="docutils literal">diff1()</span>, <span class="docutils literal">diff2()</span>, <span class="docutils literal">diffn()</span> were broken for polynomials of degrees 8 or more, due to a typo and insufficient testing.</p></li> -<li><p>The package should have (as documented) required <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> 1.4d -but in practice it accepted to work with <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> 1.4c, whose +<li><p>The package should have (as documented) required <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> 1.4d +but in practice it accepted to work with <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> 1.4c, whose <span class="docutils literal">\xinteval</span> does not know how to "output" a polynomial.</p></li> <li><p>The definition of one of the two variants of <a class="reference internal" href="#polsturmnbofrootsof">\PolSturmNbOfRootsOf</a> was broken by an end-of-line space, left-over from mass conversion from LaTeX to TeX syntax.</p></li> @@ -4178,7 +3762,7 @@ from mass conversion from LaTeX to TeX syntax.</p></li> </li> <li><p>improved:</p> <ul> -<li><p>Some <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> functions such as <span class="docutils literal">rseq()</span> use the semi-colon, +<li><p>Some <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> functions such as <span class="docutils literal">rseq()</span> use the semi-colon, and it was mentioned in the documentation that <a class="reference internal" href="#poldef">\poldef</a> will be confused by this and that inner semi-colons could be set within braces <span class="docutils literal">{;}</span> as a work-around. It was not clear from @@ -4187,12 +3771,12 @@ this work-around. With this relase only <a class="reference internal" href="#po not <a class="reference internal" href="#id8">\PolDef</a> needs the work-around.</p></li> </ul> </li> -<li><p>track <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> <span class="docutils literal">1.4e</span> changes relative to powers.</p></li> +<li><p>track <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> <span class="docutils literal">1.4e</span> changes relative to powers.</p></li> </ul> </li> <li><p>v0.8.3 (2021/05/27)</p> <ul class="simple"> -<li><p>small internal update to track an <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> <span class="docutils literal">1.4h</span> change +<li><p>small internal update to track an <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> <span class="docutils literal">1.4h</span> change regarding handling of exceptions. Will require this version at least on loading.</p></li> </ul> @@ -4209,14 +3793,23 @@ polynomials if original polynomial had no real root!</p></li> <li><p>bugfix: support for the <span class="docutils literal">intfrom()</span> function was in the code, but the declaration to the polynomial parser had not been done.</p></li> <li><p>track (belatedly) upstream deprecation of <span class="docutils literal">\xintSignedFrac</span> and -<span class="docutils literal">\xintSignedFwOver</span> at <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> <span class="docutils literal">1.4g</span></p></li> +<span class="docutils literal">\xintSignedFwOver</span> at <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> <span class="docutils literal">1.4g</span></p></li> +</ul> +</li> +<li><p>v0.8.6 (2022/01/09)</p> +<ul class="simple"> +<li><p>separate <span class="docutils literal"><span class="pre">polexpr-examples.pdf</span></span> from this reference documentation.</p></li> +<li><p>minor improvement to the computation of a priori bounds on real roots.</p></li> +<li><p>add <a class="reference internal" href="#polprintintervalsrowseparator">\PolPrintIntervalsRowSeparator</a> and allow usage of +<span class="docutils literal">amsmath</span> environments in custom <a class="reference internal" href="#polprintintervalsbeginenv">\PolPrintIntervalsBeginEnv</a> +and <a class="reference internal" href="#polprintintervalsendenv">\PolPrintIntervalsEndEnv</a>.</p></li> </ul> </li> </ul> </div> <div class="section" id="acknowledgments"> -<h1><a class="toc-backref" href="#id201">Acknowledgments</a></h1> -<p>Thanks to Jürgen Gilg whose question about <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> usage for +<h1><a class="toc-backref" href="#id192">Acknowledgments</a></h1> +<p>Thanks to Jürgen Gilg whose question about <a class="reference external" href="https://www.ctan.org/pkg/xintexpr">xintexpr</a> usage for differentiating polynomials was the initial trigger leading to this package, and to Jürgen Gilg and Thomas Söll for testing it on some concrete problems.</p> diff --git a/Master/texmf-dist/tex/generic/polexpr/polexpr-examples.tex b/Master/texmf-dist/tex/generic/polexpr/polexpr-examples.tex new file mode 100644 index 00000000000..fa2f330513b --- /dev/null +++ b/Master/texmf-dist/tex/generic/polexpr/polexpr-examples.tex @@ -0,0 +1,881 @@ +% -*- sentence-end-double-space: t -*- +\documentclass[a4paper,svgnames,dvipsnames,dvipdfmx]{article} +\usepackage{geometry} +\usepackage{shortvrb} +\usepackage{xcolor} +\usepackage{graphicx} +\usepackage{polexpr} +\usepackage{hyperref} +\usepackage{bookmark} +% \usepackage{amsmath} +\usepackage{framed} +\usepackage{newtxtext,newtxmath} +\title{\pkg{polexpr} root localization examples} +\author{Jean-François Burnol} +\date{To access the reference documentation:\\ +% faut-il vraiment le ./ ? + \texttt{texdoc} \href{run:./polexpr.html}{polexpr.html}} +%\usepackage{parskip} +\MakeShortVerb{\|} + +% Note 25 juin 2021 et 8 janvier 2022 pour polexpr-examples.tex +% +% Ceci est extrait quasi verbatim de xint.dtx +% +% Le code est pour LaTeX, pas pour Plain TeX. +% Prévu pour latex+dvipdfmx, et j'ai supprimé ajouts spécifiques pour +% pdflatex/xetex/lualatex en ce qui concerne les couleurs et polices. +% +% Regarding latex+dvipdfmx, a document with many more usage +% of everbatim* could run into color stack overflow problems +% Refer to xint.dtx for how this problem is avoided there +% via direct usage of \special rather than \color in the +% \everbatimxprehook + +% verbatim macros and environments +% ================================ +% +% June 2013, then October 2014. +% ----------------------------- +% +\makeatletter +\catcode`_ 11 +% some of my verbatim environments do not make the space active (\lverb e.g.). Then +% \do@noligs must be modified, \char`#1 must be followed by a space token, else, +% the `#1 expansion will swallow one space. +\def\do@noligs #1{% + \catcode`#1\active + \begingroup + \lccode`~`#1\relax + \lowercase{% + \endgroup\def~{\leavevmode\kern\z@\char`#1 }}% +} +% \lowast +% Pas forcément adapté à toutes les polices +\def\lowast{\raisebox{-.25\height}{*}} +\catcode`* 13 +\def\makestarlowast {\let*\lowast\catcode`\*\active}% +\catcode`* 12 + + +%--- straight quotes, added (finally...) Nov 2, 2014 +%--- obsolete with use of newtxtt 1.05, late 2014 +\begingroup\makeatletter + \catcode`\'\active + \catcode`\`\active +\@firstofone {\endgroup + \def\makequotesstraight{% assumes textcomp package +% à propos textcomp est automatique avec pdflatex depuis Février 2020 + \let`\textasciigrave + \let'\textquotesingle + \catcode39\active + \catcode96\active }% +} + +% \verb +% ===== +% Initially, June 2013, then Sep 9, 2014, and Oct 9-12 2014 +% +% pour les short verb |...| + +\def\MicroFont{\ttfamily\makestarlowast\makequotesstraight}% default +\def\verb +{% + \relax \ifmmode\else\leavevmode\null\fi + \bgroup + \let\do\@makeother \dospecials + \@ifstar{\@sverb}% unused + {\MicroFont + \catcode 32 10 \endlinechar 32 % allows to fetch across line breaks + \frenchspacing + \@@jfverb}% +}% +% Note (Oct 12, 2014): in the improbable situation a newlinechar is +% found in the ##1, \scantokens will convert this to an end of line in +% its "write" phase, which will be then ignored in its "read" phase due +% to \endlinechar-1. This also avoids possible creation of \par which +% would defeat \@@jfverb@@. Thus it is good. +\def\@@jfverb #1{% + \ifcat\noexpand#1\noexpand~\catcode`#1\active\fi +% No problem with the EOL for the line where the short verb delimiter stands. + \def\next ##1#1{% + \@vobeyspaces\everyeof{\relax}\endlinechar\m@ne + \expandafter\@@jfverb_a\scantokens\expandafter{##1}}% +% hack with \@empty to prevent brace stripping if catcodes have been +% frozen earlier, like in footnotes. + \next \@empty +} +% We don't want a \discretionary at the very start. +% But then an empty argument is forbidden! +\def\@@jfverb_a #1{#1\@@jfverb_b } + +\def\@@jfverb_b #1{\ifx\relax #1% + \egroup + \else +% \penalty\z@, or rather (Oct 11, 2014) but I then adjust the textwidth +% precisely: + \discretionary{\copy\SoftWrapIcon}{}{}% + #1\expandafter\@@jfverb_b\fi +} +% \SoftWrapIcon box for line-breaking using discretionaries +% ========================================================= +\DeclareFontFamily{U}{MdSymbolC}{} +\DeclareFontShape {U}{MdSymbolC}{m}{n}{<-> MdSymbolC-Regular}{} +\newbox\SoftWrapIcon +% Emacs/AUCTeX uses very strange comment-like highlighting for \usefont{U}... +\def\SetSoftWrapIcon{% + \global\setbox\SoftWrapIcon\hb@xt@\z@ + {\hb@xt@\fontdimen2\font + {\hss{\color{verbsoftwrapiconcolor}% + \usefont{U}{MdSymbolC}{m}{n}\char"97}\hss}% + \hss}% + } +\AtBeginDocument {{\ttfamily\SetSoftWrapIcon}}% + +\catcode`_ 8 +\makeatother + +% everbatim environment +% ===================== + +% October 13-14, 2014 +% Verbatim with an \everypar hook, mainly to have background color, followed by +% execution of the contents (not limited by a group-scope) + +\makeatletter +\catcode`_ 11 + +\def\everbatimtop {\MacroFont\small}% default +\let\everbatimbottom\empty +\let\everbatimhook\empty + +\def\everbatim {\s@everbatim\@everbatim } +\@namedef{everbatim*}{\s@everbatim\expandafter\@everbatimx\expandafter + {\the\newlinechar}} +\let\everbatimbgcolorcmd\empty +\def\everbatimeverypar{\strut + {\everbatimbgcolorcmd\vrule\@width\linewidth }% + \kern-\linewidth + \kern\everbatimindent } +\def\everbatimindent {\z@} +% voir plus loin atbegindocument + +\def\endeverbatim {\if@newlist \leavevmode\fi\endtrivlist } + +\@namedef{endeverbatim*}{\endeverbatim\aftergroup\everbatimundoparskip} +\def\everbatimundoparskip{\vbox{}\kern-\baselineskip\kern-\parskip} +% Note 25 juin 2021 +% On ne peut pas emboîter un everbatim à l'intérieur d'un everbatim +% ou un everbatim* à l'intérieur d'un everbatim*... +\def\s@everbatim {% +% \ineverbtrue + \everbatimtop % put there size changes + \topsep \z@skip + \partopsep \z@skip + \itemsep \z@skip + \parsep \z@skip + \parskip \z@skip + \lineskip \z@skip + \let\do\@makeother \dospecials + \let\do\do@noligs \verbatim@nolig@list + \makestarlowast + \makequotesstraight + \everbatimhook + \trivlist + \@topsepadd \z@skip + \item\relax + \leftskip \@totalleftmargin + \rightskip \z@skip + \parindent \z@ + \parfillskip\@flushglue + \parskip \z@skip + \@@par + \def\par{\leavevmode\null\@@par\pagebreak[1]}% + \everypar\expandafter{\the\everypar \unpenalty + \everbatimeverypar + \everypar \expandafter{\the\everypar\everbatimeverypar}% + }% + \obeylines \@vobeyspaces +} + +\begingroup +\lccode`X 13 +\catcode`X \active +\lccode`Y `* % this is because of \makestarlowast. +% I have to think whether this is useful: obviously if I were to provide +% everbatim and everbatim* in a package I wouldn't do that. +\catcode`Y \active +\catcode`| 0 \catcode`[ 1 \catcode`] 2 \catcode`* 12 +\catcode`{ 12 \catcode`} 12 |catcode`\\ 12 +|lowercase[|endgroup% both freezes catcodes and converts X to active ^^M +|def|@everbatim #1X#2\end{everbatim}% + [#2|end[everbatim]|everbatimbottom ] +|def|@everbatimx #1#2X#3\end{everbatimY}]% + {#3\end{everbatim*}% + \everbatimbottom + \newlinechar 13 +% execution as LaTeX code of contents + \everbatimxprehook + \scantokens {#3}% + \newlinechar #1\relax + \everbatimxposthook +}% + +% L'espace venant du endofline final mis par \scantokens sera inhibé si #3 se +% termine par un % ou un \x, etc... + +\let\everbatimxfgcolorcmd\empty +\def\everbatimxprehook {\colorlet{everbsavedcolor}{.}% + \everbatimxfgcolorcmd + \smallskip % pour polexpr-examples.tex + % à cause de problèmes avec les + % output en "display" + }% + +\def\everbatimxposthook {\color{everbsavedcolor}} + + +\catcode`_ 8 +\makeatother + +\newcommand\pkg[2][]{\if\relax\detokenize{#1}\relax + \href{https://www.ctan.org/pkg/#2}{#2}% + \else + \href{https://www.ctan.org/pkg/#1}{#2}% + \fi + } + +% Colors for \verb and everbatim +% \MacroFont and \MicroFont +% font size in verbatim blocks + +% \verb +%\colorlet{verbcolor}{DarkCyan} +\colorlet{verbcolor}{black} +\colorlet{verbsoftwrapiconcolor}{DarkBlue} +\def\MicroFont{\ttfamily%\color{verbcolor} + \makestarlowast\makequotesstraight}% + +% everbatim/everbatim* +\def\everbatimtop{\MacroFont\small} +% the \small is not in \MacroFont in case of a document with macrocode (doc.sty) +% and some customization is desired +%\colorlet{everbatimfgcolor}{Olive} +\colorlet{everbatimfgcolor}{DarkBlue} +\def\MacroFont{\ttfamily\color{everbatimfgcolor}} + +%\colorlet{everbatimbgcolor}{WhiteSmoke} +\colorlet{everbatimbgcolor}{Ivory} +\def\everbatimbgcolorcmd{\color{everbatimbgcolor}} + +%\colorlet{everbatimxfgcolor}{MidnightBlue} +\colorlet{everbatimxfgcolor}{OliveDrab} +\def\everbatimxfgcolorcmd{\color{everbatimxfgcolor}} + +% Notice that \macrocode uses \macro@font which stores the \MacroFont meaning +% in force at \begin{document}. But doc.sty's verbatim uses current \MacroFont +% not the meaning at \begin{document}. Comprenne qui pourra... + +\begin{document} +\maketitle + + +The package provides a parser |\poldef| of algebraic polynomial +expressions. + +Once defined, a polynomial is usable by its name either as a numerical +function in |\xintexpr/\xinteval|, or for additional polynomial +definitions, or as argument to the package macros. + +% The localization of +% real roots to arbitrary precision as well as the determination of all +% rational roots is implemented via such macros. + +% Since release |0.8|, polexpr extends the \pkg{xintexpr} +% syntax to recognize +% polynomials as a new variable type (and not only as functions). +% Functionality which previously was implemented via macros such as the +% computation of a greatest common divisor is now available directly in +% |\xintexpr|, |\xinteval| or |\poldef| via infix or functional +% syntax. + +This document illustrates root localization via usage of macros such as +|\PolToSturm| and |\PolSturmIsolateZeros| which implement the +\href{https://en.wikipedia.org/wiki/Sturm%27s_theorem}{Sturm theorem}: +\begin{itemize} +\item Root localization based on + \href{https://en.wikipedia.org/wiki/Sturm%27s_theorem}{Sturm theorem} was + added at release |0.4| (2018/02/16). +\item Ability to find all rational roots was added at release |0.7.2| + (2018/12/09). +\end{itemize} +As of |0.8| (2021/03/29), \pkg{polexpr} is usable with Plain \TeX\ and not +only with \LaTeX. The examples here use most of the time a syntax which works +with both. + +Copying-pasting from |pdf| the example source may lose formatting. +Formerly, they were included verbatim in the |html| documentation. Here +they are both rendered verbatim and got executed during the \LaTeX\ run +which created this |pdf| file, with the output shown after the source code. + +% Perhaps future releases will implement other approaches, which are known +% to be generically computationally more efficient, at least in high +% degrees, than the \href{https://en.wikipedia.org/wiki/Sturm%27s_theorem}{Sturm theorem} based approach. This is not +% immediate priority though (perhaps support of multivariate polynomials +% would be more important feature; or localization of complex roots). + +Regarding how polynomial coefficients are printed on the typeset page by +|\PolTypeset|: +\begin{itemize}\def\everbatimtop {\MacroFont}% sans le \small +\item The default for |\PolTypesetOne| is to use |\xintTeXsignedFrac| with + \LaTeX, |\xintTeXsignedOver| with Plain. See the \pkg{xintexpr} + documentation for a description of what these macros do. A sensible + definition is: +\begin{everbatim} + \def\PolTypesetOne#1{\PolDecToString{\xintREZ{#1}}}% +\end{everbatim} +% le \smallskip est ennuyeux ici + It means to use decimal notation, with perhaps a trailing denominator if the + argument is a fraction, and will suppress trailing zeros after the decimal + mark. + +\item + As these are expandable macros, they are usable to redefine + |\PolToExprCmd| as well: +\begin{everbatim} + \def\PolToExprCmd#1{\PolDecToString{\xintREZ{#1}}}% +\end{everbatim} +% le \smallskip est ennuyeux ici + This will customize the output of |\PolToExpr| (which a priori is + destined for writes to external files but may also be used on the typeset + page). +\end{itemize} + +With |\xintverbosetrue| in the \TeX\ source extra information relative +to the internal data manipulated by the macros will be written to the |.log| +file. + +\begin{framed} + Package macros related to root localization create (user-level) new + polynomials, or numeric variables, via a naming scheme using the given + |<sturmname>| as prefix. It is thus advisable to keep this + |<sturmname>| name-space separate from the one used to name polynomial or + scalar variables. +\end{framed} + +\begin{framed} + Regrettably all examples here use the condemnable |\PolToSturm{f}{f}| + practice which means that internally defined polynomials will use as prefix + the original polynomial name. This merge of namespaces may cause + overwriting previously defined data and may lead to hard-to-debug problems. +\end{framed} + + +\section{A first example} + + +In this example the polynomial is square-free. +\begin{everbatim*} + \poldef f(x) := x^7 - x^6 - 2x + 1; + + \PolToSturm{f}{f} + \PolSturmIsolateZeros{f} + The \PolTypeset{f} polynomial has \PolSturmNbOfIsolatedZeros{f} distinct real + roots which are located in the following intervals: + \PolPrintIntervals{f} +\end{everbatim*} + +\begin{everbatim*} + Here is the second root with ten more decimal digits: + \PolRefineInterval[10]{f}{2} + $$\PolSturmIsolatedZeroLeft{f}{2}<Z_2<\PolSturmIsolatedZeroRight{f}{2}$$ +\end{everbatim*} + +\begin{everbatim*} + And here is the first root with twenty digits after decimal mark: + \PolEnsureIntervalLength{f}{1}{-20} + $$\PolSturmIsolatedZeroLeft{f}{1}<Z_1<\PolSturmIsolatedZeroRight{f}{1}$$ +\end{everbatim*} + +\begin{everbatim*} + The first element of the Sturm chain has degree $\PolDegree{f_0}$. As + this is the original degreee $\PolDegree{f}$ we know that $f$ is square free. + Its derivative is up to a constant \PolTypeset{f_1} (in this example + it is identical with it). + \PolToSturm{f_1}{f_1}\PolSturmIsolateZeros{f_1}% + The derivative has \PolSturmNbOfIsolatedZeros{f_1} distinct real + roots: + \PolPrintIntervals[W]{f_1}% + \PolEnsureIntervalLengths{f_1}{-10}% + Here they are with ten digits after decimal mark: + \PolPrintIntervals[W]{f_1} +\end{everbatim*} + +\begin{everbatim*} + \PolDiff{f_1}{f''} + \PolToSturm{f''}{f''} + \PolSturmIsolateZeros{f''} + The second derivative is \PolTypeset{f''}. + It has \PolSturmNbOfIsolatedZeros{f''} distinct real + roots: + \PolPrintIntervals[X]{f''}% + Here is the positive one with 20 digits after decimal mark: + \PolEnsureIntervalLength{f''}{2}{-20}% + $$X_2 = \PolSturmIsolatedZeroLeft{f''}{2}\dots$$ +\end{everbatim*} +%The more mathematically advanced among our dear readers will be able +% to give the exact value for $X_2$! + +\section{A degree four polynomial with nearby roots} + + +Notice that this example is a bit outdated as |0.7| release has +added |\PolSturmIsolateZeros**{<sturmname>}| which would find exactly +the roots. The steps here retain their interest when one is interested +in finding isolating intervals for example to prepare some demonstration +of dichotomy method. + + +\begin{everbatim*} + \PolDef{Q}{(x-1.050001)(x-1.105001)(x-1.110501)(x-1.111051)} + \PolTypeset{Q} + \PolToSturm{Q}{Q} % it is allowed to use same prefix for Sturm chain + \PolSturmIsolateZeros{Q} + \PolPrintIntervals{Q} +\end{everbatim*} + +\begin{everbatim*} + \PolRefineInterval*{Q}{1} + \PolRefineInterval*{Q}{2} + \PolRefineInterval*{Q}{3} + \PolRefineInterval*{Q}{4} + \PolPrintIntervals{Q} +\end{everbatim*} + +\begin{everbatim*} + \PolEnsureIntervalLengths{Q}{-6} + \PolPrintIntervals{Q} + % finds here all roots exactly +\end{everbatim*} + +\section{The degree nine polynomial with 0.99, 0.999, 0.9999 as triple roots} + +Define a user command (\pkg[xint]{xinttools} is loaded automatically by +\pkg{polexpr}): + +\begin{everbatim*} + \def\showmultiplicities#1{% #1 = "sturmname" + \xintFor* ##1 in {\xintSeq{1}{\PolSturmNbOfIsolatedZeros{#1}}}\do{% + The multiplicity is \PolSturmIsolatedZeroMultiplicity{#1}{##1} + \PolSturmIfZeroExactlyKnown{#1}{##1}% + {at the root $x=\PolSturmIsolatedZeroLeft{#1}{##1}$} + {for the root such that + $\PolSturmIsolatedZeroLeft{#1}{##1}<x<\PolSturmIsolatedZeroRight{#1}{##1}$} + \par + }}% +\end{everbatim*} + +\begin{everbatim*} + \PolDef{f}{(x-0.99)^3(x-0.999)^3(x-0.9999)^3} + \def\PolTypesetOne#1{\PolDecToString{\xintREZ{#1}}} + \PolTypeset{f}\par +\end{everbatim*} + +\begin{everbatim*} + \PolToSturm{f}{f}% it is allowed to use "polname" as "sturmname" too + \PolSturmIsolateZerosAndGetMultiplicities{f}% use the "sturmname" here + % or \PolSturmIsolateZeros*{f} which is exactly the same, but shorter.. + + \showmultiplicities{f} +\end{everbatim*} +% In this example, the output will look like this (but using math mode):: + +% x^9 - 8.9667x^8 + 35.73400293x^7 - 83.070418400109x^6 + 124.143648875193123x^5 +% - 123.683070924326075877x^4 + 82.149260397553075617891x^3 +% - 35.07602992699900159127007x^2 + 8.7364078733314648368671733x +% - 0.967100824643585986488103299 + +% The multiplicity is 3 at the root x = 0.99 +% The multiplicity is 3 at the root x = 0.999 +% The multiplicity is 3 at the root x = 0.9999 + +% On first pass, these rational roots were found (due to their relative +% magnitudes, using |\PolSturmIsolateZeros**| was not needed here). But +% multiplicity computation works also with (decimal) roots not yet +% identified or with non-decimal or irrational roots. + +It is fun to modify only a tiny bit the polynomial and see if polexpr +survives: + +\begin{everbatim*} + \PolDef{g}{f(x)+1e-27} + \PolTypeset{g}\par + \PolToSturm{g}{g} + \PolSturmIsolateZeros*{g} + + \showmultiplicities{g} +\end{everbatim*} +% This produces:: + +% x^9 - 8.9667x^8 + 35.73400293x^7 - 83.070418400109x^6 + 124.143648875193123x^5 +% - 123.683070924326075877x^4 + 82.149260397553075617891x^3 +% - 35.07602992699900159127007x^2 + 8.7364078733314648368671733x +% - 0.967100824643585986488103298 + +% The multiplicity is 1 for the root such that 0.98 < x < 0.99 +% The multiplicity is 1 for the root such that 0.9991 < x < 0.9992 +% The multiplicity is 1 for the root such that 0.9997 < x < 0.9998 + +This means that the multiplicity-3 roots each became a real and a pair of +complex ones. Let's see them better: + +\begin{everbatim*} + \PolEnsureIntervalLengths{g}{-10} + + \showmultiplicities{g} +\end{everbatim*} +% which produces:: + +% The multiplicity is 1 for the root such that 0.9899888032 < x < 0.9899888033 +% The multiplicity is 1 for the root such that 0.9991447980 < x < 0.9991447981 +% The multiplicity is 1 for the root such that 0.9997663986 < x < 0.9997663987 + +\section{A degree five polynomial with three rational roots} + +\begin{everbatim*} + \poldef Q(x) := 1581755751184441 x^5 + -14907697165025339 x^4 + +48415668972339336 x^3 + -63952057791306264 x^2 + +46833913221154895 x + -49044360626280925; + + \PolToSturm{Q}{Q} + \def\PolTypesetCmdPrefix#1{\allowbreak\xintiiifSgn{#1}{}{+}{+}}% + $Q_0(x) = \PolTypeset{Q_0}$ + \PolSturmIsolateZeros**{Q} + \PolPrintIntervals{Q} + + $Q_{norr}(x) = \PolTypeset{Q_norr}$ +\end{everbatim*} + +Here, all real roots are rational. Let's get their decimal expansion too: +\begin{everbatim*} +\begingroup + % print decimal expansion of the found roots + \def\PolPrintIntervalsPrintExactZero + {\xintTrunc{20}{\PolPrintIntervalsTheLeftEndPoint}\dots} + \PolPrintIntervals{Q} +\endgroup % we localized the modified \PolPrintIntervalsPrintExactZero +\end{everbatim*} + + + % Z_1 = 3.14159265358107777120... + % Z_2 = 3.14159265358979340254... + % Z_3 = 3.14159292035398230088... + +\section{A Mignotte type polynomial} + + +\begin{everbatim*} + \PolDef{P}{x^10 - (10x-1)^2}% + \PolTypeset{P} % prints it in expanded form + \PolToSturm{P}{P} % we can use same prefix for Sturm chain + \PolSturmIsolateZeros{P} % finds 4 real roots + This polynomial has \PolSturmNbOfIsolatedZeros{P} distinct real roots: + \PolPrintIntervals{P}% +\end{everbatim*} +Let us refine the second and third intervals to separate the corresponding +roots: +\begin{everbatim*} + \PolRefineInterval*{P}{2}% will refine to 0.0999990 < Z_2 < 0.0999991 + \PolRefineInterval*{P}{3}% will refine to 0.100001 < Z_3 < 0.100002 + \PolPrintIntervals{P}% +\end{everbatim*} +Let us now get to know all roots with 10 digits after decimal mark: +\begin{everbatim*} + \PolEnsureIntervalLengths{P}{-10}% + \PolPrintIntervals{P}% now all roots are known 10 decimal digits after mark +\end{everbatim*} +Finally, we display 20 digits of the second root: +\begin{everbatim*} + \PolEnsureIntervalLength{P}{2}{-20}% makes Z_2 known with 20 digits after mark + $$\PolSturmIsolatedZeroLeft{P}{2}<Z_2<\PolSturmIsolatedZeroRight{P}{2}$$ +\end{everbatim*} +% The last line produces:: + +% 0.09999900004999650028 < Z_2 < 0.09999900004999650029 + +\section{The Wilkinson polynomial} + + +See \url{https://en.wikipedia.org/wiki/Wilkinson%27s_polynomial}. + + +\begin{everbatim*} + %\xintverbosetrue % for the curious... + + \poldef f(x) := mul((x - i), i = 1..20); + + \def\PolTypesetCmdPrefix#1{\allowbreak\xintiiifSgn{#1}{}{+}{+}}% + \def\PolTypesetOne#1{\xintDecToString{#1}}% + + \noindent\PolTypeset{f} + + \PolToSturm{f}{f} + \PolSturmIsolateZeros{f} + \PolPrintIntervals{f} + % \vfill\eject + + % This page is commented out because it takes about 30s on a 2GHz CPU + % \poldef g(x) := f(x) - 2**{-23} x**19; + + % \PolToSturm{g}{g} + % \noindent\PolTypeset{g_0}% integer coefficient primitive polynomial + + % \PolSturmIsolateZeros{g} + % \PolEnsureIntervalLengths{g}{-10} + + % \PolPrintIntervals*{g} +\end{everbatim*} + +The first polynomial +% +% f(x) = x**20 +% - 210 x**19 +% + 20615 x**18 +% - 1256850 x**17 +% + 53327946 x**16 +% - 1672280820 x**15 +% + 40171771630 x**14 +% - 756111184500 x**13 +% + 11310276995381 x**12 +% - 135585182899530 x**11 +% + 1307535010540395 x**10 +% - 10142299865511450 x**9 +% + 63030812099294896 x**8 +% - 311333643161390640 x**7 +% + 1206647803780373360 x**6 +% - 3599979517947607200 x**5 +% + 8037811822645051776 x**4 +% - 12870931245150988800 x**3 +% + 13803759753640704000 x**2 +% - 8752948036761600000 x +% + 2432902008176640000 +% +is handled fast enough, but the modified one |f(x) - +2**-23 x**19| takes about 20x longer. + +Its Sturm chain polynomials +have integer coefficients with up to 321 digits, whereas (surprisingly +perhaps) those of the Sturm chain polynomials derived from |f| never +have more than 21 digits ... + +Once the Sturm chain is computed and the zeros isolated, obtaining their +decimal digits is relatively faster. Here are the ten real roots of +|f(x) - 2**-23 x**19| which would be computed by the commented-out code above: +\begin{everbatim} + Z_1 = 0.9999999999... + Z_2 = 2.0000000000... + Z_3 = 2.9999999999... + Z_4 = 4.0000000002... + Z_5 = 4.9999999275... + Z_6 = 6.0000069439... + Z_7 = 6.9996972339... + Z_8 = 8.0072676034... + Z_9 = 8.9172502485... + Z_10 = 20.8469081014... +\end{everbatim} + +\section{The second Wilkinson polynomial} + + +\begin{everbatim*} + \poldef f(x) := mul(x - 2^-i, i = 1..20); + + %\PolTypeset{f} + + \PolToSturm{f}{f} + \PolSturmIsolateZeros**{f} + \PolPrintIntervals{f} +\end{everbatim*} + +This takes more time than the polynomial with 1, 2, .., 20 as roots but +less than the latter modified by the |2**-23| tiny change to one of its +coefficient. + +% Here is the output (with release 0.7.2):: + +% Z_1 = 0.00000095367431640625 +% Z_2 = 0.0000019073486328125 +% Z_3 = 0.000003814697265625 +% Z_4 = 0.00000762939453125 +% Z_5 = 0.0000152587890625 +% Z_6 = 0.000030517578125 +% Z_7 = 0.00006103515625 +% Z_8 = 0.0001220703125 +% Z_9 = 1/4096 +% Z_10 = 1/2048 +% Z_11 = 1/1024 +% Z_12 = 1/512 +% Z_13 = 1/256 +% Z_14 = 1/128 +% Z_15 = 0.015625 +% Z_16 = 0.03125 +% Z_17 = 0.0625 +% Z_18 = 0.125 +% Z_19 = 0.25 +% Z_20 = 0.5 + +There is some incoherence in output format which has its source in the +fact that some roots are found in branches which can only find decimal +roots, whereas some are found in branches which could find general +fractions and they use |\xintIrr| before storage of the found root. +This may evolve in future. + + +\section{The degree 41 polynomial with -2, -1.9, -1.8, ..., 0, 0.1, ..., 1.9, 2 as roots} + + + +\begin{everbatim*} + \PolDef{P}{mul((x-i*1e-1), i=-20..20)}% i/10 is same but less efficient +\end{everbatim*} +In the defining expression we could have used |i/10| but this gives +less efficient internal form for the coefficients (the |10|'s end up +in denominators). + +\begin{everbatim*} +\begingroup + \def\PolToExprCmd#1{\PolDecToString{\xintREZ{#1}}} + \def\PolToExprTermPrefix#1{\newline\xintiiifSgn{#1}{}{+}{+}} + \def\PolToExprTimes{${}\cdot{}$} +\ttfamily +\PolToExpr{P} +\endgroup +\end{everbatim*} + % x^41 + % -28.7*x^39 + % +375.7117*x^37 + % -2975.11006*x^35 + % +15935.28150578*x^33 + % -61167.527674162*x^31 + % +173944.259366417394*x^29 + % -373686.963560544648*x^27 + % +613012.0665016658846445*x^25 + % -771182.31133138163125495*x^23 + % +743263.86672885754888959569*x^21 + % -545609.076599482896371978698*x^19 + % +301748.325708943677229642930528*x^17 + % -123655.8987669450434698869844544*x^15 + % +36666.1782054884005855608205864192*x^13 + % -7607.85821367459445649518380016128*x^11 + % +1053.15135918687298508885950223794176*x^9 + % -90.6380005918141132650786081964032*x^7 + % +4.33701563847327366842552218288128*x^5 + % -0.0944770968420804735498178265088*x^3 + % +0.00059190121813899276854174416896*x + +which shows coefficients with up to 36 significant digits... + +Stress test: not a hard challenge to \pkg{xint} + \pkg{polexpr}, but be a bit +patient! + +\begin{everbatim*} + \PolDef{P}{mul((x-i*1e-1), i=-20..20)}% + \PolToSturm{P}{S} % dutifully computes S_0, ..., S_{41} + % the [1] optional argument limits the search to interval (-10,10) + \PolSturmIsolateZeros[1]{S} % finds *exactly* (but a bit slowly) all 41 roots! + \PolPrintIntervals{S} % nice, isn't it? +% Unfortunately \PolPrintIntervals uses a non-breakable array environment +% But see next section on how to customize \PolPrintIntervals and let it +% allow pagebreaks +\end{everbatim*} + +\begin{quote} + Release |0.5| has \emph{experimental} addition of optional argument |E| to + |\PolSturmIsolateZeros|. It instructs to search roots only in interval + |(-10^E, 10^E)|. Important: the extremities are \emph{assumed to not be roots}. + In this example, the |[1]| in |\PolSturmIsolateZeros[1]{S}| gives some speed + gain; without it, it turns out in this case that \pkg{polexpr} would have + started with |(-10^6, 10^6)| interval. + + Please note that this feature may be removed or modified. +\end{quote} + +\section{Roots of a Chebyshev polynomial} + + +\begin{everbatim*} + \poldef T_0(x) := 1; + \poldef T_1(x) := x; + \catcode`@ 11 + \count@ 2 + \xintloop + \poldef T_\the\count@(x) := + 2x*T_\the\numexpr\count@-1\relax + - T_\the\numexpr\count@-2\relax; + \ifnum\count@<15 + \advance\count@ 1 + \repeat + \catcode`@ 12 + + $$T_{15} = \PolTypeset[X]{T_15}$$ + \PolToSturm{T_15}{T_15} + \PolSturmIsolateZeros*{T_15}% "*" as we will want to confirm multiplicity one + % takes time (each next decimal digit is obtained by dichotomy) + \PolEnsureIntervalLengths{T_15}{-20}% ensure 20 decimal digits for each root +\end{everbatim*} + +Here is now an example of customization. Indeed +|\PolPrintIntervals| default uses |array| and thus does not allow page breaks. +And it uses |Left < Z < Right| as presentation of roots and we would like here +rather |Z = decimal expansion...|. +\begin{everbatim*} +% 0.8.6 adds an internal patch which would allow usage of amsmath environments +% like this: +% \def\PolPrintIntervalsBeginEnv{\begin{align*}} +% \def\PolPrintIntervalsEndEnv{\end{align*}} +% (the problem was that align evaluates twice its contents so global variables +% need a reset at the end of first pass, which is what 0.8.6 took care of) +% +% Let's simply do this: +\def\PolPrintIntervalsBeginEnv{\begingroup\leftskip3cm\relax} +\def\PolPrintIntervalsEndEnv{\par\endgroup} +% +% The rows are separated by \PolPrintIntervalsRowSeparator which defaults to \\ +% with LaTeX and \cr with Plain. (prior to 0.8.6 it was hardcoded) +\def\PolPrintIntervalsRowSeparator{\\[\jot]} +% And we enter math mode manually at each row, copying pasting from package +% defaults with some added mathon/mathoff: +\def\PolPrintIntervalsKnownRoot{% + $\PolPrintIntervalsPrintMultiplicity\quad + \PolPrintIntervalsTheVar_{\PolPrintIntervalsTheIndex}=% + \PolPrintIntervalsPrintExactZero + $ +}% +\def\PolPrintIntervalsUnknownRoot{% + $\PolPrintIntervalsPrintMultiplicity\quad + \xintifSgn{\PolPrintIntervalsTheLeftEndPoint}% + {\xintifSgn{\PolPrintIntervalsTheRightEndPoint} + {\PolPrintIntervalsTheVar_{\PolPrintIntervalsTheIndex}=% + \PolPrintIntervalsPrintRightEndPoint\dots}% + {0>\PolPrintIntervalsTheVar_{\PolPrintIntervalsTheIndex}>% + \PolPrintIntervalsPrintLeftEndPoint}% + {\impossibleA}}% + {\xintifSgn{\PolPrintIntervalsTheRightEndPoint} + {\impossibleB}% + {\impossibleC}% + {0<\PolPrintIntervalsTheVar_{\PolPrintIntervalsTheIndex}<% + \PolPrintIntervalsPrintRightEndPoint}}% + {\xintifSgn{\PolPrintIntervalsTheRightEndPoint} + {\impossibleD}% + {\impossibleE}% + {\PolPrintIntervalsTheVar_{\PolPrintIntervalsTheIndex}=% + \PolPrintIntervalsPrintLeftEndPoint\dots}}% + $ +}% +\PolPrintIntervals{T_15} +\end{everbatim*} +\end{document} + diff --git a/Master/texmf-dist/tex/generic/polexpr/polexpr.sty b/Master/texmf-dist/tex/generic/polexpr/polexpr.sty index 04d189de8bb..7d3dbb36bda 100644 --- a/Master/texmf-dist/tex/generic/polexpr/polexpr.sty +++ b/Master/texmf-dist/tex/generic/polexpr/polexpr.sty @@ -2,7 +2,7 @@ % License: LPPL 1.3c (author-maintained) % Usage: \input polexpr.sty (Plain or other macro formats) % or \usepackage{polexpr} (LaTeX macro format) -% Release 0.8.5 (2021/11/30) of polexpr.sty. This file inputs +% Release 0.8.6 (2022/01/09) of polexpr.sty. This file inputs % polexprcore.tex % polexprexpr.tex % polexprsturm.tex @@ -54,12 +54,12 @@ \XINTsetupcatcodes% (does \endlinechar13 in particular) \XINT_providespackage \ProvidesPackage{polexpr}% - [2021/05/27 v0.8.3 Polynomial expressions with rational coefficients (JFB)]% + [2022/01/09 v0.8.6 Polynomial expressions with rational coefficients (JFB)]% \begingroup \def\x#1/#2/#3 #4\xint:{#1#2#3}% \ifnum\expandafter\x\expanded{\csname ver@xintexpr.sty\endcsname}\xint: <20210527 % xint 1.4h - \immediate\write128{! Package polexpr error: xintexpr too old, aborting input}% + \errmessage{Package polexpr error: xintexpr too old, aborting input}% \else\expandafter\xint_gobble_i \fi \endinput\endgroup @@ -475,7 +475,7 @@ }% % %% Euclidean division -% now based on the expandable routine from polexprcore.tex +% since 0.8 based on the expandable routine from polexprcore.tex % \def\PolDivide#1#2#3#4{% #3=quotient, #4=remainder of #1 by #2 \POL@divide{#1}{#2}% diff --git a/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex b/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex index 3648bc8ccb2..8dcc893844b 100644 --- a/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex +++ b/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex @@ -1,7 +1,9 @@ -%% This file polexprcore.tex is part of the polexpr package (0.8.5, 2021/11/30) -%% Core routines to match infix operators +, -, *, //, /:, ^, ** and some -%% functions -%% The atoms representing polynomials inside \xintexpr are +%% filename: polexprcore.tex +%% Part of the polexpr package (0.8.6, 2022/01/09) +%% +%% Core routines for infix operators +, -, *, //, /:, ^, ** and functions +%% +%% Memo: the atoms representing polynomials inside \xintexpr are %% - for constants: a numeric value (indistinguishable. from scalars) %% - for degree at least 1: P<degree>.{c0}{c1}....{cN} with N = degree %% Auxiliaries diff --git a/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex b/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex index f3cc5ac28ef..bbc860cbca4 100644 --- a/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex +++ b/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex @@ -1,5 +1,7 @@ -%% This file polexprexpr.tex is part of the polexpr package (0.8.5, 2021/11/30) -%% Extending \xintexpr syntax: +%% filename: polexprexpr.tex +%% Part of the polexpr package (0.8.6, 2022/01/09) +%% +%% Polynomial extensions to the \xintexpr syntax: %% %% 1. Authorize ' in variable and function names %% This partially breaks infix operators 'and', 'or', 'xor', 'mod' diff --git a/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex b/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex index d590d48aa56..0edc8b8f0a2 100644 --- a/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex +++ b/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex @@ -1,7 +1,11 @@ -%% This file polexprsturm.tex is part of the polexpr package (0.8.5, 2021/11/30) -%% Sturm Algorithm (polexpr 0.4) +%% filename: polexprsturm.tex +%% Part of the polexpr package (0.8.6, 2022/01/09) +%% +%% Implements the Sturm localization Algorithm +%% Added at polexpr 0.4 +%% %% 0.5 uses primitive polynomials for faster evaluations afterwards -%% 0.6 corrects misuse of \@ifstar! (mumble). \PolToSturm* was broken. +%% 0.6 corrects misuse of \@ifstar (mumble). \PolToSturm* was broken. %% 0.6's \PolToSturm* defines both normalized and unnormalized, the %% unnormalized using two underscores, so both are available %% Sole difference is that \PolToSturm* also declares them as @@ -9,19 +13,20 @@ %% holding the coefficients in memory %% 0.6 fixes the case of a constant polynomial P which caused division %% by zero error from P'. -%% 0.8 - fixes 0.7.5 failure to have updated to xint 1.4 format the defined -%% \xintexpr variables holding the localization intervals extremities -%% - also, it uses the prem() in computing the Sturm chain, for a 3X -%% speed gain in the case of the "perturbed" first Wilkinson example -%% +%% 0.8 - fixes 0.7.5 compatibility bug with xint 1.4 internal format +%% regarding the defined \xintexpr variables holding the localization +%% intervals extremities +%% - also, it uses the prem() in computing the Sturm chain, with a 3X +%% speed gain in the case of the "perturbed" first Wilkinson example +%% 0.8.6 has better a priori bounds for positive and negative roots \newcount\POL@count \newif\ifPOL@tosturm@makefirstprimitive\POL@tosturm@makefirstprimitivetrue \newif\ifPOL@isolz@nextwillneedrefine %% \def\PolToSturm{\POL@ifstar{\PolToSturm@@}{\PolToSturm@}}% \def\POL@aux@toint#1{\xintREZ{\xintNum{#1}}}% for polynomials with int. coeffs! -%% Attention that some macros rely upon this one setting \POL@sturmname -%% and \POL@sturm@N as it does +%% Attention that some macros rely upon this one defining \POL@sturmname +%% and \POL@sturm@N as it currently does \def\PolToSturm@#1#2{% \edef\POL@sturmname{#2}% % 0.6 uses 2 underscores (one before index, one after) to keep in memory @@ -61,11 +66,9 @@ }% \def\POL@tosturm@dosturm{% \POL@Diff@@one{\POL@sturmname _0_}{\POL@sturmname _1_}% - % re-utiliser \POL@varcoeffs directement? \POL@makeprimitive{\POL@sturmname _1_}% does not do \POL@newpol \POL@count\@ne \xintloop - % prior to 0.8, code was using here \POL@divide \POL@getprem{\POL@sturmname _\the\numexpr\POL@count-\@ne\relax _}% {\POL@sturmname _\the\POL@count _}% \expandafter\POL@split\POL@R;\POL@degR\POL@polR @@ -117,7 +120,8 @@ \POL@sturmchain@getSV@at\POL@sturmchain@X #1\let#2\POL@sturmchain@SV }% -\def\POL@sturmchain@getSV@at#1{% ATTENTION USES \POL@count +% attention that this modifies current \POL@count value +\def\POL@sturmchain@getSV@at#1{% \def\POL@sturmchain@SV{0}% \edef\POL@sturmchain@sign{\xintiiSgn{\POL@eval{\POL@sturmname _0}{#1}}}% \let\POL@isolz@lastsign\POL@sturmchain@sign @@ -166,7 +170,6 @@ {\PolSturmIsolateZerosGetMultiplicitiesAndRationalRoots}% {\PolSturmIsolateZerosAndGetMultiplicities@}% }% -% on aurait besoin de ça dans xint, mais il aurait un \xintRaw{#1} alors \def\POL@xintfrac@getNDE #1% {\expandafter\POL@xintfrac@getNDE@i\romannumeral`&&@#1}% \def\POL@xintfrac@getNDE@i #1/#2[#3]#4#5#6{\def#4{#1}\def#5{#2}\def#6{#3}}% @@ -196,10 +199,6 @@ \edef\POL@sturm@N{\@nameuse{PolSturmChainLength_\POL@sturmname}}% % isolate the roots (detects case of constant polynomial) \PolSturmIsolateZeros@{\POL@sturmname}% - % 0.8.4 fix: these declarations were formerly not executed in absence of roots! - % on ne va pas utiliser de Horner, mais des divisions par X - x, et ces - % choses vont évoluer, ainsi que le coefficient dominant entier - % (pour \POL@divide entre autres if faut des noms de user pol) \XINT_global \expandafter\let \csname POLuserpol@\POL@sturmname\POL@sqfnorr\expandafter\endcsname @@ -219,7 +218,6 @@ \begingroup\globaldefs\@ne \expandafter\POL@initarray\csname POL_ZM\POL@sturmname*\endcsname{1}% \endgroup - % attention formé avec\xintREZ d'où le \xintAbs pas \xintiiAbs % D and its exponent E will get updated along the way \edef\POL@findrat@D{\xintAbs{\PolLeadingCoeff{\POL@sturmname _0}}}% \POL@xintfrac@getNDE\POL@findrat@D\POL@findrat@Dint\POL@_\POL@findrat@Dexp @@ -227,12 +225,10 @@ {\let\POL@findrat@E\POL@findrat@Dexp} % aussi ok pour 1[0] {\edef\POL@findrat@E{\the\numexpr\xintLen{\POL@findrat@Dint}% +\POL@findrat@Dexp}}% -% ATTENTION QUE LA CONVENTION DE SIGNE POUR \POL@findrat@E EST OPPOSÉE À CELLE -% POUR LE CODE PLUS ANCIEN FAISANT "REFINE" \POL@initarray\POL@IfMultIsKnown\xint_secondoftwo \let\POL@findrat@nbofirrroots\POL@isolz@NbOfRoots % find all rational roots, and their multiplicities, - % factor them out in passing from original (Sturm root) polynomial + % factor them out from original (Sturm root) polynomial \ifnum\POL@findrat@E<7 % \def\POL@findrat@index{1}% \POL@findrat@loop@secondpass@direct @@ -252,7 +248,6 @@ \POL@newpol{\POL@sturmname\POL@norr}% with multiplicities }% \def\POL@findrat@doRRarray#1{% - % il faudrait un \xintAssignArray* qui fasse même expansion que \xintFor* \edef\POL@temp{% \xintiloop[1+1] \romannumeral0\csname POL_ZK\POL@sturmname*\xintiloopindex\endcsname @@ -261,8 +256,6 @@ \ifnum\xintiloopindex<\POL@isolz@NbOfRoots\space \repeat }% \begingroup\globaldefs\@ne - % attention de ne surtout pas faire un \expandafter ici, car en cas d'un - % seul item, \xintAssignArray l'unbraces... \xintAssignArray\POL@temp\to#1% \endgroup }% @@ -286,11 +279,6 @@ }% \def\POL@findrat@loop@decimal{% we have an already found decimal root % we do not go via @storeit, as it is already stored - % j'ai beaucoup hésité néanmoins, car je pourrais faire \xintIrr ici, - % mais attention aussi à l'interaction avec le \PolDecToString. Les racines - % trouvées directement (qui peuvent être des nombres décimaux) sont elles - % stockées comme fraction irréductibles (modulo action additionnelle de - % \PolDecToString). \POL@xintfrac@getNDE {\xintIrr{\POL@xintexprGetVar{\POL@sturmname L_\POL@findrat@index}}[0]}% \POL@findrat@xN\POL@findrat@xD\POl@_ @@ -313,15 +301,13 @@ \else\expandafter\xint_stop_atfirstoftwo \fi }% -\def\POL@findrat@getE #1/1[#2]{#2}% /1 as it should be there. -% so an error will arise if not but cf \POL@refine@getE where I did not put it +\def\POL@findrat@getE #1/1[#2]{#2}% \def\POL@findrat@loop@a{% % attention that the width may have been already smaller than 10^{-6} \POL@get@IsoLeft@rawin \POL@get@IsoRight@rawin \edef\POL@findrat@localW {\the\numexpr-\expandafter\POL@findrat@getE - % do I really need the \xintREZ? \romannumeral0\xintrez {\xintSub{\POL@IsoRight@rawin}{\POL@IsoLeft@rawin}}% }% at least 6, maybe larger @@ -364,9 +350,7 @@ \xintAssign \xintiiDivision\POL@findrat@gcdloop@Ap\POL@findrat@gcdloop@A \to\POL@findrat@gcdloop@B\POL@findrat@gcdloop@An - % on fait de la tambouille pour n'utiliser que \numexpr par la suite - % le reste @An est < 2.10^9 au pire donc ok pour \numexpr - % we will drop integral part in our updating P +% we will drop integral part in our updating P \let\POL@findrat@gcdloop@Binitial\POL@findrat@gcdloop@B \def\POL@findrat@gcdloop@B{0}% do as if B1 = 0 \def\POL@findrat@gcdloop@Pp{1}% P0 @@ -382,7 +366,6 @@ \POL@findrat@gcdloop@body }% \def\POL@findrat@gcdloop@body{% - % annoying that \numexpr has no divmod... use counts? but groups annoying \edef\POL@findrat@gcdloop@B {\the\numexpr(\POL@findrat@gcdloop@Ap+\POL@findrat@gcdloop@A/2)/% \POL@findrat@gcdloop@A - \@ne}% @@ -474,7 +457,8 @@ {\POL@xintexprGetVar{\POL@sturmname L_\POL@findrat@index}}}% \edef\POL@findrat@Rscaled{\xintMul{\POL@findrat@D}% {\POL@xintexprGetVar{\POL@sturmname R_\POL@findrat@index}}}% - \xintiiifNeg{\POL@findrat@Lscaled}% using ii version is an abuse +% using ii version is an abuse + \xintiiifNeg{\POL@findrat@Lscaled}% {% negative interval (right bound possibly zero!) % truncate towards zero (i.e. to the right) the left bound \edef\POL@findrat@Num{\xintNum{\POL@findrat@Lscaled}/1[0]}% @@ -572,13 +556,8 @@ % first get the GCD of remaining pol with its derivative \POL@divide{\POL@sturmname\POL@norr}{\POL@sturmname\POL@sqfnorr}% \expandafter\let - % attention au _ (cf. grosse astuce pour \POL@isolzmult@loop) \csname POLuserpol@@_1\POL@sturmname _\endcsname\POL@Q \ifnum\PolDegree{@_1\POL@sturmname _}>\z@ - % il reste des multiplicités (mais peut-être pour des racines complexes) - % (ou pour des racines en-dehors de l'intervalle optionnel) - % attention recyclage ici de \POL@isolzmult@loop qui dépend de - % la grosse astuce avec \@gobble \POL@makeprimitive{@_1\POL@sturmname _}% \let\POL@originalsturmname\POL@sturmname % trick to get isolzmult@loop to define @@lastGCD to @_1sturmname_ @@ -640,7 +619,7 @@ \fi }% \def\POL@isolzmult@defvar@M{% - % Attention that is used not only in ...GetMultiplicities@ but also + % Attention that this is used not only in ...GetMultiplicities@ but also % in FindRationalRoots \begingroup\xintglobaldefstrue % added at 0.7 @@ -739,7 +718,7 @@ % #1 optional E such that roots are searched in -10^E < x < 10^E % both -10^E and +10^E must not be roots! % #2 name of Sturm chain (already pre-computed from a given polynomial) - % For reasons I have forgotten (no time now) this code **must** be used + % For reasons I have forgotten this code **must** be used % with a *normalized* Sturm chain. \edef\POL@sturmname{#2}% \edef\POL@sturmlength{\PolSturmChainLength{#2}}% @@ -749,22 +728,23 @@ \POL@isolz@getsignchanges@plusinf \POL@isolz@getsignchanges@minusinf \else - \edef\POL@isolz@E{\the\numexpr\xint_zapspaces #1 \xint_gobble_i\relax}% - \POL@sturmchain@getSV@at{1[\POL@isolz@E]}% + \edef\POL@isolz@E@pos{\the\numexpr\xint_zapspaces #1 \xint_gobble_i\relax}% + \let\POL@isolz@E@neg\POL@isolz@E@pos + \POL@sturmchain@getSV@at{1[\POL@isolz@E@pos]}% \let\POL@isolz@plusinf@SV \POL@sturmchain@SV \let\POL@isolz@plusinf@sign\POL@sturmchain@sign - \POL@sturmchain@getSV@at{-1[\POL@isolz@E]}% + \POL@sturmchain@getSV@at{-1[\POL@isolz@E@neg]}% \let\POL@isolz@minusinf@SV \POL@sturmchain@SV \let\POL@isolz@minusinf@sign\POL@sturmchain@sign \ifnum\POL@isolz@plusinf@sign=\z@ \PackageError{polexpr}% -{The polynomial #2 vanishes at set upper bound 10^\POL@isolz@E}% -{Compile again with a bigger exponent in source. (X to abort).}% +{The polynomial #2 vanishes at set upper bound 10^\POL@isolz@E@pos}% +{Try again with a larger exponent. (X to abort).}% \fi \ifnum\POL@isolz@minusinf@sign=\z@ \PackageError{polexpr}% -{The polynomial #2 vanishes at set lower bound -10^\POL@isolz@E}% -{Compile again with a bigger exponent in source. (X to abort).}% +{The polynomial #2 vanishes at set lower bound -10^\POL@isolz@E@neg}% +{Try again with a larger exponent. (X to abort).}% \fi \fi \edef\POL@isolz@NbOfRoots @@ -792,7 +772,8 @@ }% \def\POL@initarray#1#2{% % ATTENTION, if only one item, \xintAssignArray UNBRACES IT -% so we use an \empty trick to avoid that. Maybe considered a bug of xinttools? +% (is this to be considered as a bug of xinttools?) +% We use an \empty trick to avoid that. \expandafter\xintAssignArray\expandafter\empty \romannumeral\xintreplicate{\POL@isolz@NbOfRoots}{{#2}}\to#1% }% @@ -836,9 +817,18 @@ \advance\POL@count\@ne \repeat }% -% utility macro for a priori bound on root decimal exponent, via Float Rounding -\def\POL@isolz@updateE #1e#2;% - {\unless\ifnum#2<\POL@isolz@E\space\edef\POL@isolz@E{\the\numexpr#2+\@ne}\fi}% +% This utility macro bounds positive roots (strictly) by a 10^Epos +% and negative roots strictly by some -10^Eneg. +% (prior to 0.8.6, an E was found with -10^E < all roots < 10^E) +% To obtain Epos, the Cauchy bound "1 + max_j {-a_j/lc(P)|}" +% is used, where non-negative a_j/lc(P)'s are ignored. +% In case the a_j's all have same sign as lc(P) or vanish, there are +% no positive roots. And the macro in this case outputs an E=0 exponent. +% But if at least one non-zero a_j has opposite sign to the leading coeff, +% the produced E will be at least 1. +% Thus if E=0 on exit, it is proof that there are no (positive) roots. +\def\POL@isolz@updateE #1;% + {\unless\ifnum#1<\POL@isolz@E\space\edef\POL@isolz@E{\the\numexpr#1+\@ne}\fi}% \def\POL@isolz@getaprioribound{% \PolAssign{\POL@sturmname _0}\toarray\POL@arrayA \edef\POL@isolz@leading{\POL@arrayA{\POL@arrayA{0}}}% @@ -849,19 +839,47 @@ \expandafter\edef\csname POL@arrayA\the\POL@count\endcsname {\xintDiv{\POL@arrayA\POL@count}\POL@isolz@leading}% \repeat - \def\POL@isolz@E{1}% WE SEEK SMALLEST E SUCH HAT -10^E < roots < +10^E +% We want an E such that 0 < positive roots < +10^E + \def\POL@isolz@E{0}% \advance\POL@count\m@ne \xintloop \ifnum\POL@count>\z@ - \expandafter\POL@isolz@updateE - % use floating point to get decimal exponent - \romannumeral0\xintfloat[4]% should I use with [2] rather? (should work) - {\xintAdd{1/1[0]}{\xintAbs{\POL@arrayA\POL@count}}};% +% only those coefficients with opposite sign to the leading coefficient +% trigger an E update + \xintiiifSgn{\POL@arrayA\POL@count}% + {\expandafter\POL@isolz@updateE + \the\numexpr\xintilogten{\xintAdd{1/1[0]}{\xintiiOpp{\POL@arrayA\POL@count}}};% + }{}{}% \advance\POL@count\m@ne \repeat - % \ifxintverbose\xintMessage{polexpr}{Info}% - % {Roots a priori bounded in absolute value by 10 to the \POL@isolz@E.}% - % \fi + \let\POL@isolz@E@pos\POL@isolz@E +% We want an E such that 0 > negative roots > -10^E + \def\POL@isolz@E{0}% + \POL@count\POL@arrayA{0}\relax + \advance\POL@count\m@ne + \xintloop + \ifnum\POL@count>\@ne + \xintiiifSgn{\xintiiOpp{\POL@arrayA\POL@count}}% + {\expandafter\POL@isolz@updateE + \the\numexpr\xintilogten{\xintAdd{1/1[0]}{\POL@arrayA\POL@count}};% + }{}{}% + \advance\POL@count\m@ne + \xintiiifSgn{\POL@arrayA\POL@count}% + {\expandafter\POL@isolz@updateE + \the\numexpr\xintilogten{\xintAdd{1/1[0]}{\xintiiOpp{\POL@arrayA\POL@count}}};% + }{}{}% + \advance\POL@count\m@ne + \repeat + \ifnum\POL@count=\@ne + \xintiiifSgn{\xintiiOpp{\POL@arrayA\POL@count}}% + {\expandafter\POL@isolz@updateE + \the\numexpr\xintilogten{\xintAdd{1/1[0]}{\POL@arrayA\POL@count}};% + }{}{}% + \fi + \let\POL@isolz@E@neg\POL@isolz@E + \ifxintverbose + \xintMessage{polexpr}{Info}{Epos=\POL@isolz@E@pos, Eneg=\POL@isolz@E@neg.}% + \fi }% \def\POL@IsoRight@raw{\POL@IsoRight@Int/1[\POL@isolz@E]}% \def\POL@IsoLeft@raw {\POL@IsoLeft@Int/1[\POL@isolz@E]}% @@ -875,8 +893,6 @@ {\POL@IsoLeft@Int/1[\POL@isolz@E]}% }% \def\POL@isolz@main {% -% NOTE 2018/02/16. THIS WILL PRESUMABLY BE RE-ORGANIZED IN FUTURE TO DO -% FIRST POSITIVE ROOTS THEN NEGATIVE ROOTS VIA CHANGE OF VARIABLE TO OPPOSITE. \global\POL@isolz@nextwillneedrefinefalse \def\POL@IsoRight@Int{0}% \POL@sturmchain@getSV@at\POL@IsoRight@raw @@ -899,12 +915,13 @@ % \POL@IsoRight@SV was modified if zero is a root \edef\POL@isolz@NbOfNegRoots{\the\numexpr\POL@IsoLeftSV-\POL@IsoRightSV}% \gdef\POL@isolz@IntervalIndex{0}% - \let\POL@isolz@@E\POL@isolz@E +% 0.8.6 has separate initial E's for positive and negative roots + \let\POL@isolz@E\POL@isolz@E@neg \ifnum\POL@isolz@NbOfNegRoots>\z@ -% refactored at 0.7 to fix cases leading to an intervals with zero as end-point +% refactored at 0.7 to fix cases leading to intervals having zero as end-point \POL@isolz@findroots@neg \fi - \let\POL@isolz@E\POL@isolz@@E + \let\POL@isolz@E\POL@isolz@E@pos \def\POL@IsoLeft@Int{0}% \let\POL@IsoLeftSV \POL@IsoAtZeroSV % véritable SV en zéro \let\POL@IsoLeftSign\POL@IsoAtZeroSign% véritable signe en zéro @@ -973,10 +990,6 @@ \repeat }% \def\POL@isolz@findroots@pos{% - % remark (2018/12/08), this needs some refactoring, I hardly understand - % the logic and it hides most into the recursion done by \POL@isolz@check - % It would probably make more sense to proceed like done for the negative - % but here finding the largest roots first. \def\POL@IsoRight@Int{1}% \POL@isolz@findnextzeroboundeddecade@pos \unless\ifnum\POL@IsoRightSV=\POL@IsoLeftSV\space @@ -985,7 +998,7 @@ % and none are larger \POL@isolz@check % will recurse inside groups if needed with modified E \fi - % we know get the roots in the last 9 decades from 10^{e-1} to 10^{e} + % we now get the roots in the last 9 decades from 10^{e-1} to 10^{e} % we should arguably do a more efficient dichotomy here \def\POL@IsoLeft@Int{1}% \let\POL@IsoLeftSV\POL@IsoRightSV @@ -1101,14 +1114,6 @@ \ifnum\POL@IsoRightSign=\POL@@IsoRightSign\space \repeat % now second root has been separated from the one at left end point -% we update the storage of the root at left for it to have the same number -% of digits in mantissa. No, I decided not to do that to avoid complications. - % \begingroup - % \let\POL@IsoRight@Int\POL@IsoLeft@Int - % \def\POL@IsoRightSign{0}% - % \edef\POL@isolz@IntervalIndex{\the\numexpr\POL@isolz@IntervalIndex-\@ne}% - % \POL@refine@storeleftandright - % \endgroup \edef\POL@@IsoRight@Int{\xintDSL{\xintInc{\xintDSR{\POL@IsoLeft@Int}}}}% \let\POL@IsoLeft@Int\POL@IsoRight@Int \let\POL@IsoLeftSign\POL@IsoRightSign @@ -1128,7 +1133,7 @@ % the IsoRightSign is now wrong but here we don't care \fi\fi \fi - % on exit, exact root found iff \POL@IsoRightSign is zero + % on exit, exact root has been found iff \POL@IsoRightSign is zero \POL@refine@storeleftandright \endgroup }% @@ -1224,7 +1229,6 @@ \fi \begingroup\xintglobaldefstrue % skip some overhead of \xintdefvar... - % Let me repeat: ATTENTION to change of internal format at xint 1.4 \XINT_expr_defvar_one{\POL@sturmname L_\POL@isolz@IntervalIndex}% {{\POL@IsoLeft@rawout}}% \XINT_expr_defvar_one{\POL@sturmname R_\POL@isolz@IntervalIndex}% @@ -1235,7 +1239,6 @@ \endgroup }% %% \PolRefineInterval -%% ATTENTION TO xint 1.4 INTERNAL CHANGES \def\POL@xintexprGetVar#1{\expandafter\expandafter\expandafter\xint_firstofone \csname XINT_expr_varvalue_#1\endcsname}% % attention, also used by \POL@findrat@loop@a @@ -1346,9 +1349,6 @@ % % \def\PolIntervalWidth#1#2{% -% le \xintRez est à cause des E positifs, car trailing zéros explicites -% si je travaillais à partir des variables xintexpr directement ne devrait -% pas être nécessaire, mais trop fragile par rapport à chgt internes possibles \romannumeral0\xintrez{\xintSub{\@nameuse{POL_ZR#1*}{#2}}% {\@nameuse{POL_ZL#1*}{#2}}} }% @@ -1363,7 +1363,8 @@ }% \def\POL@ensureintervallengths{% \POL@count\z@ - % \POL@count used by \POL@sturmchain@getSV@at but latter not used + % attention that \POL@count would be modified by \POL@sturmchain@getSV@at + % but this latter macro not invoked by \POL@ensure@one \xintloop \advance\POL@count\@ne \edef\POL@isolz@IntervalIndex{\the\POL@count}% @@ -1377,11 +1378,8 @@ \edef\POL@sturmname{#1}% \edef\POL@ensure@targetE{\the\numexpr#3}% \edef\POL@isolz@IntervalIndex{\the\numexpr#2}% -% peut-être autoriser -1, -2, ... ? \ifnum\POL@isolz@IntervalIndex>\z@ -% 0.7, add this safeguard but attention means this structure must be in place \ifnum\csname POL_ZL\POL@sturmname*0\endcsname>\z@ -% je ne fais pas les \expandafter mais je préfèrerais ne pas être à l'intérieur \POL@ensure@one \fi \fi @@ -1438,8 +1436,9 @@ \catcode`_ 8 % \catcode`& 4 % \def\PolPrintIntervals{\POL@ifstar{\PolPrintIntervals@@}{\PolPrintIntervals@}}% -% As explained in the docs, this is an example of customization so is not -% itself customizable, apart from redefining it entirely! +% As explained in the docs, the starred version is an example of customization +% It is itself basically not easily customizable, except for this: +\def\PolPrintIntervals@@arraystretch{2}% (the 2 was hardcoded prior to 0.8.6) \def\PolPrintIntervals@@{% \begingroup \def\POL@AfterPrintIntervals{\endgroup}% @@ -1447,14 +1446,14 @@ \let\PolPrintIntervalsUnknownRoot\POL@@PrintIntervalsUnknownRoot \let\PolPrintIntervalsKnownRoot\POL@@PrintIntervalsKnownRoot \ifdefined\array - \def\arraystretch{2}% + \let\arraystretch\PolPrintIntervals@@arraystretch \def\PolPrintIntervalsBeginEnv{\[\begin{array}{cl}}%\] \def\PolPrintIntervalsEndEnv{\end{array}\]}% \else \def\PolPrintIntervalsBeginEnv{$$\tabskip0pt plus 1000pt minus 1000pt \halign to\displaywidth\bgroup - \hfil\vrule height 2\ht\strutbox - depth 2\dp\strutbox + \hfil\vrule height \PolPrintIntervals@@arraystretch\ht\strutbox + depth \PolPrintIntervals@@arraystretch\dp\strutbox width \z@ $####$\tabskip6pt&$####$\hfil \tabskip0pt plus 1000pt minus 1000pt\cr}%$$ @@ -1476,6 +1475,10 @@ \begingroup\edef\POL@tmp{\endgroup \unexpanded\expandafter{\PolPrintIntervalsBeginEnv}% \unexpanded\expandafter{\POL@PrintIntervals@Loop}% +% This is added at 0.8.6 to allow usage of amsmath environment as they typeset +% twice: we must prepare for a second execution. Adds slight general overhead. + \gdef\noexpand\PolPrintIntervalsTheIndex{1}% + \noexpand\POL@PrintIntervals@DoDefs \unexpanded\expandafter{\PolPrintIntervalsEndEnv}% }\POL@tmp \fi @@ -1485,7 +1488,7 @@ }% \let\POL@AfterPrintIntervals\empty \let\PolPrintIntervalsNoRealRoots\empty -\def\PolPrintIntervalsArrayStretch{1}% +\def\PolPrintIntervalsArrayStretch{1}% used by non-starred version \ifdefined\array \def\PolPrintIntervalsBeginEnv{\[\begin{array}{rcccl}}% \def\PolPrintIntervalsEndEnv{\end{array}\]}% @@ -1558,7 +1561,6 @@ }% \catcode`& 7 % \catcode`_ 11 % -\def\POL@PrintIntervals@Loop#1{% \def\POL@PrintIntervals@Loop{% \POL@SturmIfZeroExactlyKnown\PolPrintIntervalsTheSturmName \PolPrintIntervalsTheIndex @@ -1568,10 +1570,15 @@ \unless\ifnum\PolPrintIntervalsTheIndex> \@nameuse{POL_ZL\PolPrintIntervalsTheSturmName*0} \POL@PrintIntervals@DoDefs - \xint_afterfi{#1\POL@PrintIntervals@Loop}% + \xint_afterfi{\PolPrintIntervalsRowSeparator\POL@PrintIntervals@Loop}% \fi -}}% -\ifdefined\array\POL@PrintIntervals@Loop{\\}\else\POL@PrintIntervals@Loop{\cr}\fi +}% +% added at 0.8.6: +\ifdefined\array + \def\PolPrintIntervalsRowSeparator{\\}% +\else + \def\PolPrintIntervalsRowSeparator{\cr}% +\fi \def\POL@PrintIntervals@DoDefs{% \xdef\PolPrintIntervalsTheLeftEndPoint{% \csname POL_ZL\PolPrintIntervalsTheSturmName*\PolPrintIntervalsTheIndex |