summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/polexpr
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/polexpr')
-rw-r--r--Master/texmf-dist/doc/latex/polexpr/README.md14
-rw-r--r--Master/texmf-dist/doc/latex/polexpr/polexpr.html347
-rw-r--r--Master/texmf-dist/doc/latex/polexpr/polexpr.txt167
3 files changed, 351 insertions, 177 deletions
diff --git a/Master/texmf-dist/doc/latex/polexpr/README.md b/Master/texmf-dist/doc/latex/polexpr/README.md
index e4e8fa3b38f..e0508c86d3e 100644
--- a/Master/texmf-dist/doc/latex/polexpr/README.md
+++ b/Master/texmf-dist/doc/latex/polexpr/README.md
@@ -65,8 +65,18 @@ Releases
Synced with xint 1.3.
- 0.4.2 (2018/03/03)
Documentation fix.
-
-Files of 0.4.2 release:
+- 0.5 (2018/04/08)
+ - new macros `\PolMakePrimitive` and `\PolIContent`.
+ - breaking change: `\PolToSturm` creates a chain of primitive
+ integer coefficients polynomials.
+ - breaking change: polynomials created from `\PolFromCSV` or
+ `\PolGet` get their coefficients normalized via
+ [xintfrac](http://www.ctan.org/pkg/xint)'s `\xintRaw`.
+ - experimental change: optional argument to
+ `\PolSturmIsolateZeros` to localize search.
+
+
+Files of 0.5 release:
- README.md,
- polexpr.sty (package file),
diff --git a/Master/texmf-dist/doc/latex/polexpr/polexpr.html b/Master/texmf-dist/doc/latex/polexpr/polexpr.html
index 579a6172254..8eeb33a3811 100644
--- a/Master/texmf-dist/doc/latex/polexpr/polexpr.html
+++ b/Master/texmf-dist/doc/latex/polexpr/polexpr.html
@@ -362,7 +362,7 @@ ul.auto-toc {
<body>
<div class="document" id="package-polexpr-documentation">
<h1 class="title">Package polexpr documentation</h1>
-<h2 class="subtitle" id="id1">0.4.2 (2018/03/03)</h2>
+<h2 class="subtitle" id="id1">0.5 (2018/04/08)</h2>
<!-- comment: -*- fill-column: 72; mode: rst; -*- -->
<div class="contents topic" id="contents">
@@ -422,64 +422,66 @@ ul.auto-toc {
<li><a class="reference internal" href="#polreducecoeffs-polname" id="id80"><tt class="docutils literal">\PolReduceCoeffs{polname}</tt></a></li>
<li><a class="reference internal" href="#id15" id="id81"><tt class="docutils literal"><span class="pre">\PolReduceCoeffs*{polname}</span></tt></a></li>
<li><a class="reference internal" href="#polmakemonic-polname" id="id82"><tt class="docutils literal">\PolMakeMonic{polname}</tt></a></li>
+<li><a class="reference internal" href="#polmakeprimitive-polname" id="id83"><tt class="docutils literal">\PolMakePrimitive{polname}</tt></a></li>
</ul>
</li>
-<li><a class="reference internal" href="#expandable-macros" id="id83">Expandable macros</a><ul>
-<li><a class="reference internal" href="#poleval-polname-atexpr-numerical-expression" id="id84"><tt class="docutils literal"><span class="pre">\PolEval{polname}\AtExpr{numerical</span> expression}</tt></a></li>
-<li><a class="reference internal" href="#poleval-polname-at-fraction" id="id85"><tt class="docutils literal"><span class="pre">\PolEval{polname}\At{fraction}</span></tt></a></li>
-<li><a class="reference internal" href="#polevalreduced-polname-atexpr-numerical-expression" id="id86"><tt class="docutils literal"><span class="pre">\PolEvalReduced{polname}\AtExpr{numerical</span> expression}</tt></a></li>
-<li><a class="reference internal" href="#polevalreduced-polname-at-fraction" id="id87"><tt class="docutils literal"><span class="pre">\PolEvalReduced{polname}\At{fraction}</span></tt></a></li>
-<li><a class="reference internal" href="#polfloateval-polname-atexpr-numerical-expression" id="id88"><tt class="docutils literal"><span class="pre">\PolFloatEval{polname}\AtExpr{numerical</span> expression}</tt></a></li>
-<li><a class="reference internal" href="#polfloateval-polname-at-fraction" id="id89"><tt class="docutils literal"><span class="pre">\PolFloatEval{polname}\At{fraction}</span></tt></a></li>
-<li><a class="reference internal" href="#polifcoeffisplusorminusone-a-b" id="id90"><tt class="docutils literal"><span class="pre">\PolIfCoeffIsPlusOrMinusOne{A}{B}</span></tt></a></li>
-<li><a class="reference internal" href="#polleadingcoeff-polname" id="id91"><tt class="docutils literal">\PolLeadingCoeff{polname}</tt></a></li>
-<li><a class="reference internal" href="#polnthcoeff-polname-number" id="id92"><tt class="docutils literal"><span class="pre">\PolNthCoeff{polname}{number}</span></tt></a></li>
-<li><a class="reference internal" href="#poldegree-polname" id="id93"><tt class="docutils literal">\PolDegree{polname}</tt></a></li>
-<li><a class="reference internal" href="#poltoexpr-polname" id="id94"><tt class="docutils literal">\PolToExpr{polname}</tt></a><ul>
-<li><a class="reference internal" href="#poltoexproneterm-raw-coeff-number" id="id95"><tt class="docutils literal"><span class="pre">\PolToExprOneTerm{raw_coeff}{number}</span></tt></a></li>
-<li><a class="reference internal" href="#poltoexpronetermstylea-raw-coeff-number" id="id96"><tt class="docutils literal"><span class="pre">\PolToExprOneTermStyleA{raw_coeff}{number}</span></tt></a></li>
-<li><a class="reference internal" href="#poltoexpronetermstyleb-raw-coeff-number" id="id97"><tt class="docutils literal"><span class="pre">\PolToExprOneTermStyleB{raw_coeff}{number}</span></tt></a></li>
-<li><a class="reference internal" href="#poltoexprcmd-raw-coeff" id="id98"><tt class="docutils literal">\PolToExprCmd{raw_coeff}</tt></a></li>
-<li><a class="reference internal" href="#poltoexprtermprefix-raw-coeff" id="id99"><tt class="docutils literal">\PolToExprTermPrefix{raw_coeff}</tt></a></li>
-<li><a class="reference internal" href="#id23" id="id100"><tt class="docutils literal">\PolToExprVar</tt></a></li>
-<li><a class="reference internal" href="#id24" id="id101"><tt class="docutils literal">\PolToExprTimes</tt></a></li>
+<li><a class="reference internal" href="#expandable-macros" id="id84">Expandable macros</a><ul>
+<li><a class="reference internal" href="#poleval-polname-atexpr-numerical-expression" id="id85"><tt class="docutils literal"><span class="pre">\PolEval{polname}\AtExpr{numerical</span> expression}</tt></a></li>
+<li><a class="reference internal" href="#poleval-polname-at-fraction" id="id86"><tt class="docutils literal"><span class="pre">\PolEval{polname}\At{fraction}</span></tt></a></li>
+<li><a class="reference internal" href="#polevalreduced-polname-atexpr-numerical-expression" id="id87"><tt class="docutils literal"><span class="pre">\PolEvalReduced{polname}\AtExpr{numerical</span> expression}</tt></a></li>
+<li><a class="reference internal" href="#polevalreduced-polname-at-fraction" id="id88"><tt class="docutils literal"><span class="pre">\PolEvalReduced{polname}\At{fraction}</span></tt></a></li>
+<li><a class="reference internal" href="#polfloateval-polname-atexpr-numerical-expression" id="id89"><tt class="docutils literal"><span class="pre">\PolFloatEval{polname}\AtExpr{numerical</span> expression}</tt></a></li>
+<li><a class="reference internal" href="#polfloateval-polname-at-fraction" id="id90"><tt class="docutils literal"><span class="pre">\PolFloatEval{polname}\At{fraction}</span></tt></a></li>
+<li><a class="reference internal" href="#polifcoeffisplusorminusone-a-b" id="id91"><tt class="docutils literal"><span class="pre">\PolIfCoeffIsPlusOrMinusOne{A}{B}</span></tt></a></li>
+<li><a class="reference internal" href="#polleadingcoeff-polname" id="id92"><tt class="docutils literal">\PolLeadingCoeff{polname}</tt></a></li>
+<li><a class="reference internal" href="#polnthcoeff-polname-number" id="id93"><tt class="docutils literal"><span class="pre">\PolNthCoeff{polname}{number}</span></tt></a></li>
+<li><a class="reference internal" href="#poldegree-polname" id="id94"><tt class="docutils literal">\PolDegree{polname}</tt></a></li>
+<li><a class="reference internal" href="#policontent-polname" id="id95"><tt class="docutils literal">\PolIContent{polname}</tt></a></li>
+<li><a class="reference internal" href="#poltoexpr-polname" id="id96"><tt class="docutils literal">\PolToExpr{polname}</tt></a><ul>
+<li><a class="reference internal" href="#poltoexproneterm-raw-coeff-number" id="id97"><tt class="docutils literal"><span class="pre">\PolToExprOneTerm{raw_coeff}{number}</span></tt></a></li>
+<li><a class="reference internal" href="#poltoexpronetermstylea-raw-coeff-number" id="id98"><tt class="docutils literal"><span class="pre">\PolToExprOneTermStyleA{raw_coeff}{number}</span></tt></a></li>
+<li><a class="reference internal" href="#poltoexpronetermstyleb-raw-coeff-number" id="id99"><tt class="docutils literal"><span class="pre">\PolToExprOneTermStyleB{raw_coeff}{number}</span></tt></a></li>
+<li><a class="reference internal" href="#poltoexprcmd-raw-coeff" id="id100"><tt class="docutils literal">\PolToExprCmd{raw_coeff}</tt></a></li>
+<li><a class="reference internal" href="#poltoexprtermprefix-raw-coeff" id="id101"><tt class="docutils literal">\PolToExprTermPrefix{raw_coeff}</tt></a></li>
+<li><a class="reference internal" href="#id23" id="id102"><tt class="docutils literal">\PolToExprVar</tt></a></li>
+<li><a class="reference internal" href="#id24" id="id103"><tt class="docutils literal">\PolToExprTimes</tt></a></li>
</ul>
</li>
-<li><a class="reference internal" href="#id26" id="id102"><tt class="docutils literal"><span class="pre">\PolToExpr*{polname}</span></tt></a></li>
-<li><a class="reference internal" href="#poltofloatexpr-polname" id="id103"><tt class="docutils literal">\PolToFloatExpr{polname}</tt></a><ul>
-<li><a class="reference internal" href="#poltofloatexproneterm-raw-coeff-number" id="id104"><tt class="docutils literal"><span class="pre">\PolToFloatExprOneTerm{raw_coeff}{number}</span></tt></a></li>
-<li><a class="reference internal" href="#poltofloatexprcmd-raw-coeff" id="id105"><tt class="docutils literal">\PolToFloatExprCmd{raw_coeff}</tt></a></li>
+<li><a class="reference internal" href="#id26" id="id104"><tt class="docutils literal"><span class="pre">\PolToExpr*{polname}</span></tt></a></li>
+<li><a class="reference internal" href="#poltofloatexpr-polname" id="id105"><tt class="docutils literal">\PolToFloatExpr{polname}</tt></a><ul>
+<li><a class="reference internal" href="#poltofloatexproneterm-raw-coeff-number" id="id106"><tt class="docutils literal"><span class="pre">\PolToFloatExprOneTerm{raw_coeff}{number}</span></tt></a></li>
+<li><a class="reference internal" href="#poltofloatexprcmd-raw-coeff" id="id107"><tt class="docutils literal">\PolToFloatExprCmd{raw_coeff}</tt></a></li>
</ul>
</li>
-<li><a class="reference internal" href="#id30" id="id106"><tt class="docutils literal"><span class="pre">\PolToFloatExpr*{polname}</span></tt></a></li>
-<li><a class="reference internal" href="#poltolist-polname" id="id107"><tt class="docutils literal">\PolToList{polname}</tt></a></li>
-<li><a class="reference internal" href="#poltocsv-polname" id="id108"><tt class="docutils literal">\PolToCSV{polname}</tt></a></li>
-<li><a class="reference internal" href="#polsturmchainlength-sturmname" id="id109"><tt class="docutils literal">\PolSturmChainLength{sturmname}</tt></a></li>
-<li><a class="reference internal" href="#polsturmifzeroexactlyknown-sturmname-index-a-b" id="id110"><tt class="docutils literal"><span class="pre">\PolSturmIfZeroExactlyKnown{sturmname}{index}{A}{B}</span></tt></a></li>
-<li><a class="reference internal" href="#polsturmisolatedzeroleft-sturmname-index" id="id111"><tt class="docutils literal"><span class="pre">\PolSturmIsolatedZeroLeft{sturmname}{index}</span></tt></a></li>
-<li><a class="reference internal" href="#polsturmisolatedzeroright-sturmname-index" id="id112"><tt class="docutils literal"><span class="pre">\PolSturmIsolatedZeroRight{sturmname}{index}</span></tt></a></li>
-<li><a class="reference internal" href="#polsturmnbofisolatedzeros-sturmname" id="id113"><tt class="docutils literal">\PolSturmNbOfIsolatedZeros{sturmname}</tt></a></li>
-<li><a class="reference internal" href="#polintervalwidth-sturmname-index" id="id114"><tt class="docutils literal"><span class="pre">\PolIntervalWidth{sturmname}{index}</span></tt></a></li>
-<li><a class="reference internal" href="#macros-for-use-within-execution-of-polprintintervals" id="id115">Macros for use within execution of <tt class="docutils literal">\PolPrintIntervals</tt></a><ul>
-<li><a class="reference internal" href="#id31" id="id116"><tt class="docutils literal">\PolPrintIntervalsTheEndPoint</tt></a></li>
-<li><a class="reference internal" href="#id32" id="id117"><tt class="docutils literal">\PolPrintIntervalsTheIndex</tt></a></li>
-<li><a class="reference internal" href="#polifendpointispositive-a-b" id="id118"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsPositive{A}{B}</span></tt></a></li>
-<li><a class="reference internal" href="#polifendpointisnegative-a-b" id="id119"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsNegative{A}{B}</span></tt></a></li>
-<li><a class="reference internal" href="#polifendpointiszero-a-b" id="id120"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsZero{A}{B}</span></tt></a></li>
+<li><a class="reference internal" href="#id30" id="id108"><tt class="docutils literal"><span class="pre">\PolToFloatExpr*{polname}</span></tt></a></li>
+<li><a class="reference internal" href="#poltolist-polname" id="id109"><tt class="docutils literal">\PolToList{polname}</tt></a></li>
+<li><a class="reference internal" href="#poltocsv-polname" id="id110"><tt class="docutils literal">\PolToCSV{polname}</tt></a></li>
+<li><a class="reference internal" href="#polsturmchainlength-sturmname" id="id111"><tt class="docutils literal">\PolSturmChainLength{sturmname}</tt></a></li>
+<li><a class="reference internal" href="#polsturmifzeroexactlyknown-sturmname-index-a-b" id="id112"><tt class="docutils literal"><span class="pre">\PolSturmIfZeroExactlyKnown{sturmname}{index}{A}{B}</span></tt></a></li>
+<li><a class="reference internal" href="#polsturmisolatedzeroleft-sturmname-index" id="id113"><tt class="docutils literal"><span class="pre">\PolSturmIsolatedZeroLeft{sturmname}{index}</span></tt></a></li>
+<li><a class="reference internal" href="#polsturmisolatedzeroright-sturmname-index" id="id114"><tt class="docutils literal"><span class="pre">\PolSturmIsolatedZeroRight{sturmname}{index}</span></tt></a></li>
+<li><a class="reference internal" href="#polsturmnbofisolatedzeros-sturmname" id="id115"><tt class="docutils literal">\PolSturmNbOfIsolatedZeros{sturmname}</tt></a></li>
+<li><a class="reference internal" href="#polintervalwidth-sturmname-index" id="id116"><tt class="docutils literal"><span class="pre">\PolIntervalWidth{sturmname}{index}</span></tt></a></li>
+<li><a class="reference internal" href="#macros-for-use-within-execution-of-polprintintervals" id="id117">Macros for use within execution of <tt class="docutils literal">\PolPrintIntervals</tt></a><ul>
+<li><a class="reference internal" href="#id31" id="id118"><tt class="docutils literal">\PolPrintIntervalsTheEndPoint</tt></a></li>
+<li><a class="reference internal" href="#id32" id="id119"><tt class="docutils literal">\PolPrintIntervalsTheIndex</tt></a></li>
+<li><a class="reference internal" href="#polifendpointispositive-a-b" id="id120"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsPositive{A}{B}</span></tt></a></li>
+<li><a class="reference internal" href="#polifendpointisnegative-a-b" id="id121"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsNegative{A}{B}</span></tt></a></li>
+<li><a class="reference internal" href="#polifendpointiszero-a-b" id="id122"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsZero{A}{B}</span></tt></a></li>
</ul>
</li>
-<li><a class="reference internal" href="#poldectostring-decimal-number" id="id121"><tt class="docutils literal">\PolDecToString{decimal number}</tt></a></li>
+<li><a class="reference internal" href="#poldectostring-decimal-number" id="id123"><tt class="docutils literal">\PolDecToString{decimal number}</tt></a></li>
</ul>
</li>
-<li><a class="reference internal" href="#booleans-with-default-setting-as-indicated" id="id122">Booleans (with default setting as indicated)</a><ul>
-<li><a class="reference internal" href="#xintverbosefalse" id="id123"><tt class="docutils literal">\xintverbosefalse</tt></a></li>
-<li><a class="reference internal" href="#poltypesetallfalse" id="id124"><tt class="docutils literal">\poltypesetallfalse</tt></a></li>
-<li><a class="reference internal" href="#poltoexprallfalse" id="id125"><tt class="docutils literal">\poltoexprallfalse</tt></a></li>
+<li><a class="reference internal" href="#booleans-with-default-setting-as-indicated" id="id124">Booleans (with default setting as indicated)</a><ul>
+<li><a class="reference internal" href="#xintverbosefalse" id="id125"><tt class="docutils literal">\xintverbosefalse</tt></a></li>
+<li><a class="reference internal" href="#poltypesetallfalse" id="id126"><tt class="docutils literal">\poltypesetallfalse</tt></a></li>
+<li><a class="reference internal" href="#poltoexprallfalse" id="id127"><tt class="docutils literal">\poltoexprallfalse</tt></a></li>
</ul>
</li>
-<li><a class="reference internal" href="#technicalities" id="id126">Technicalities</a></li>
-<li><a class="reference internal" href="#change-log" id="id127">CHANGE LOG</a></li>
-<li><a class="reference internal" href="#acknowledgments" id="id128">Acknowledgments</a></li>
+<li><a class="reference internal" href="#technicalities" id="id128">Technicalities</a></li>
+<li><a class="reference internal" href="#change-log" id="id129">CHANGE LOG</a></li>
+<li><a class="reference internal" href="#acknowledgments" id="id130">Acknowledgments</a></li>
</ul>
</div>
<div class="section" id="basic-examples">
@@ -580,7 +582,14 @@ PSTricks-compatible; the letter used in output can be
</div>
<div class="section" id="examples-of-localization-of-roots">
<h1><a class="toc-backref" href="#id36">Examples of localization of roots</a></h1>
-<p>First some remarks about auxiliaries.</p>
+<div class="admonition attention">
+<p class="first admonition-title">Attention!</p>
+<p class="last">At <tt class="docutils literal">0.5</tt>, <a class="reference internal" href="#poltosturm">\PolToSturm{P}{S}</a> was modified to
+create a chain of primitive integer coefficients polynomials. This
+speeds up evaluations, hence localization of roots afterwards. Thus
+<tt class="docutils literal">S_1</tt> will not necessarily be the derivative of <tt class="docutils literal">S_0</tt>, even if
+<tt class="docutils literal">P</tt> is square-free.</p>
+</div>
<ul>
<li><p class="first">To make printed decimal numbers more enjoyable than via
<tt class="docutils literal">\xintSignedFrac</tt>:</p>
@@ -597,9 +606,10 @@ that one can also do:</p>
</pre>
<p>to modify output of <a class="reference internal" href="#poltoexpr-polname">\PolToExpr{polname}</a>.</p>
</li>
-<li><p class="first">for extra info in log file <tt class="docutils literal">\xintverbosetrue</tt>. In fact one can also
-work from command line then (I recommend <tt class="docutils literal">rlwrap</tt> for encapsulating
-<tt class="docutils literal">latex</tt>).</p>
+<li><p class="first">For extra info in log file use <tt class="docutils literal">\xintverbosetrue</tt>.</p>
+</li>
+<li><p class="first">To make producing this documentation simpler, the results from execution
+of the code snippets are not included. Please try them out yourself...</p>
</li>
</ul>
<div class="section" id="a-typical-example">
@@ -623,8 +633,10 @@ Here is the second root with ten more decimal digits:
And here is the first root with twenty digits after decimal mark:
\PolEnsureIntervalLength{f}{1}{-20}
\[\PolSturmIsolatedZeroLeft{f}{1}&lt;Z_1&lt;\PolSturmIsolatedZeroRight{f}{1}\]
-The derivative polynomial is \PolTypeset{f_1} (from
-$\PolDegree{f_0}=7$ we know that original polynomial was square-free).
+The first element of the Sturm chain has degree $\PolDegree{f_0}$. As
+this same as $\PolDegree{f}$ we know that the latter was square free.
+So the derivative is up to a constant \PolTypeset{f_1} (in fact here
+it is identical with it).
\PolToSturm{f_1}{f_1}\PolSturmIsolateZeros{f_1}%
It has \PolSturmNbOfIsolatedZeros{f_1} distinct real
roots:
@@ -691,16 +703,20 @@ It has \PolSturmNbOfIsolatedZeros{P} real roots.
\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 &lt; Z_1 &lt; -1, 0 &lt; Z_2 &lt; 0.1, 0.1 &lt; Z_3 &lt; 0.2, 1 &lt; Z_4 &lt; 2
+Let us refine the second and third intervals to separate the corresponding
+roots:
\PolRefineInterval*{P}{2}% will refine to 0.0999990 &lt; Z_2 &lt; 0.0999991
\PolRefineInterval*{P}{3}% will refine to 0.100001 &lt; Z_3 &lt; 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
-There are $\PolSturmNbOfIsolatedZeros{P}$ distinct real roots and there holds
-$\PolSturmIsolatedZeroLeft{P}{2}&lt;Z_2&lt;\PolSturmIsolatedZeroRight{P}{2}$.
+\[\PolSturmIsolatedZeroLeft{P}{2}&lt;Z_2&lt;\PolSturmIsolatedZeroRight{P}{2}\]
</pre>
<p>The last line produces:</p>
<pre class="literal-block">
@@ -746,10 +762,24 @@ x^41
<p>Stress test: not a hard challenge to <tt class="docutils literal">xint + polexpr</tt>, 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}
-\PolSturmIsolateZeros{S} % finds *exactly* (but a bit slowly) all 41 roots!
-\PolPrintIntervals{S} % nice, isn't it?
+\PolToSturm{P}{S} % dutifully computes S_0, ..., S_{41}
+\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="first admonition-title">Note</p>
+<p>Release <tt class="docutils literal">0.5</tt> has experimental addition of optional argument
+<tt class="docutils literal">E</tt> to <tt class="docutils literal">\PolSturmIsolateZeros</tt>. It instructs to search roots only
+in interval <tt class="docutils literal"><span class="pre">(-10^E,</span> 10^E)</tt>, extremities assumed to not be roots.
+Thus here:</p>
+<pre class="literal-block">
+\PolSturmIsolateZeros[1]{S}
+</pre>
+<p>gives some speed gain; without it, it turns out in this case that
+<tt class="docutils literal">polexpr</tt> would have started with <tt class="docutils literal"><span class="pre">(-10^6,</span> 10^6)</tt> interval.</p>
+<p class="last">This will probably get replaced in future by the specification of
+a general interval.</p>
+</div>
</div>
<div class="section" id="roots-of-chebyshev-polynomials">
<h2><a class="toc-backref" href="#id42">Roots of Chebyshev polynomials</a></h2>
@@ -878,19 +908,22 @@ indices act the same in both.)</p>
<div class="section" id="polget-polname-fromarray-macro">
<span id="polget"></span><h2><a class="toc-backref" href="#id50"><tt class="docutils literal"><span class="pre">\PolGet{polname}\fromarray\macro</span></tt></a></h2>
<blockquote>
-<p>Does the converse operation to <tt class="docutils literal"><span class="pre">\PolAssign{polname}\toarray\macro</span></tt>. No
-error checks on validity of coefficients as numbers. Each
-<tt class="docutils literal">\macro{number}</tt> is expanded in an <tt class="docutils literal">\edef</tt> before being assigned
-to a coefficient. Leading zero coefficients are removed from the
-polynomial.</p>
+<p>Does the converse operation to
+<tt class="docutils literal"><span class="pre">\PolAssign{polname}\toarray\macro</span></tt>. Each individual
+<tt class="docutils literal">\macro{number}</tt> gets expanded in an <tt class="docutils literal">\edef</tt> and then normalized
+via <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>'s macro <tt class="docutils literal">\xintRaw</tt>.</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
\PolGet{f}\fromarray\foo
</pre>
-<p>This will define <tt class="docutils literal">f</tt> as would have <tt class="docutils literal">\poldef <span class="pre">f(x):=1-2x+5x^2-3x^3;</span></tt>.
-However the coefficients are still in their original form (i.e.
-they were not subjected to <tt class="docutils literal">\xintRaw</tt> or similar <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macro.)</p>
+<p>This will define <tt class="docutils literal">f</tt> as would have <tt class="docutils literal">\poldef <span class="pre">f(x):=1-2x+5x^2-3x^3;</span></tt>.</p>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">Prior to <tt class="docutils literal">0.5</tt>, coefficients were not normalized via
+<tt class="docutils literal">\xintRaw</tt> for internal storage.</p>
+</div>
</blockquote>
</div>
<div class="section" id="polfromcsv-polname-csv">
@@ -900,15 +933,19 @@ they were not subjected to <tt class="docutils literal">\xintRaw</tt> or similar
values (or a macro expanding to such a list) of its coefficients,
the constant term being the first item. No validity checks. Spaces
from the list argument are trimmed. List items are each expanded in
-an <tt class="docutils literal">\edef</tt>, but currently left in their original form like e.g.
-<tt class="docutils literal">1.5e3</tt> which is not converted to <tt class="docutils literal">15/1[2]</tt> <em>raw</em> <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>
-format (this may change).</p>
+an <tt class="docutils literal">\edef</tt> and then put into normalized form via <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>'s
+macro <tt class="docutils literal">\xintRaw</tt>.</p>
<p>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 has only one (zero) coefficient.</p>
<p>See also expandable macro <a class="reference internal" href="#poltocsv-polname">\PolToCSV</a>.</p>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">Prior to <tt class="docutils literal">0.5</tt>, coefficients were not normalized via
+<tt class="docutils literal">\xintRaw</tt> for internal storage.</p>
+</div>
</blockquote>
</div>
<div class="section" id="poltypeset-polname">
@@ -1071,13 +1108,19 @@ polynomial.</blockquote>
<p>With, for example, <tt class="docutils literal">polname</tt> being <tt class="docutils literal">P</tt> and <tt class="docutils literal">sturmname</tt> being
<tt class="docutils literal">S</tt>, the macro starts by computing polynomials <tt class="docutils literal">S_0 = P</tt>, <tt class="docutils literal">S_1
= P'</tt>, ..., with <tt class="docutils literal">S_{n+1}</tt> the opposite of the remainder of
-euclidean division of <tt class="docutils literal"><span class="pre">S_{n-1}</span></tt> by <tt class="docutils literal">S_{n}</tt>. The last non-zero
-remainder <tt class="docutils literal">S_N</tt> is up to a factor the GCD of <tt class="docutils literal">P</tt> and <tt class="docutils literal">P'</tt>
-hence a constant if and only if <tt class="docutils literal">P</tt> is square-free.</p>
+euclidean division of <tt class="docutils literal"><span class="pre">S_{n-1}</span></tt> by <tt class="docutils literal">S_{n}</tt>.</p>
+<div class="admonition attention">
+<p class="first admonition-title">Attention!</p>
+<p class="last">Since <tt class="docutils literal">0.5</tt>, it further normalizes all these polynomials by making
+them primitive (see <a class="reference internal" href="#polmakeprimitive">\PolMakePrimitive</a>).</p>
+</div>
+<p>The last non-zero remainder <tt class="docutils literal">S_N</tt> is up to a factor the GCD of
+<tt class="docutils literal">P</tt> and <tt class="docutils literal">P'</tt> hence it is a constant (i.e. <tt class="docutils literal">1</tt> or <tt class="docutils literal"><span class="pre">-1</span></tt> since
+<tt class="docutils literal">0.5</tt>) if and only if <tt class="docutils literal">P</tt> is square-free.</p>
<p>In case <tt class="docutils literal">S_N</tt> is not a constant, the macro then goes on with
-dividing all <tt class="docutils literal">S_k</tt>'s with <tt class="docutils literal">S_N</tt> (which becomes <tt class="docutils literal">1</tt>).</p>
-<p>Thus <tt class="docutils literal">S_0</tt> now has exactly the same real and complex
-roots as polynomial <tt class="docutils literal">polname</tt>, but each with multiplicity one.</p>
+dividing all <tt class="docutils literal">S_k</tt>'s with <tt class="docutils literal">S_N</tt> (which then becomes <tt class="docutils literal">1</tt>).</p>
+<p>Thus <tt class="docutils literal">S_0</tt> has exactly the same real and complex roots as
+polynomial <tt class="docutils literal">polname</tt>, but each root being now with multiplicity one.</p>
</blockquote>
</div>
<div class="section" id="id10">
@@ -1350,20 +1393,27 @@ done automatically, due to the case the original polynomial had integer
coefficients and we want to keep the leading one as common
denominator.</blockquote>
</div>
+<div class="section" id="polmakeprimitive-polname">
+<span id="polmakeprimitive"></span><h2><a class="toc-backref" href="#id83"><tt class="docutils literal">\PolMakePrimitive{polname}</tt></a></h2>
+<blockquote>
+Divides by the integer content see (<a class="reference internal" href="#policontent">\PolIContent</a>). This thus produces a polynomial with integer
+coefficients having no common factor. The sign of the leading
+coefficient is not modified.</blockquote>
+</div>
</div>
<div class="section" id="expandable-macros">
-<h1><a class="toc-backref" href="#id83">Expandable macros</a></h1>
+<h1><a class="toc-backref" href="#id84">Expandable macros</a></h1>
<p>All these macros expand completely in two steps except <tt class="docutils literal">\PolToExpr</tt>
and <tt class="docutils literal">\PolToFloatExpr</tt> (and their auxiliaries) which need a
<tt class="docutils literal">\write</tt>, <tt class="docutils literal">\edef</tt> or a <tt class="docutils literal"><span class="pre">\csname...\endcsname</span></tt> context.</p>
<div class="section" id="poleval-polname-atexpr-numerical-expression">
-<span id="polevalatexpr"></span><h2><a class="toc-backref" href="#id84"><tt class="docutils literal"><span class="pre">\PolEval{polname}\AtExpr{numerical</span> expression}</tt></a></h2>
+<span id="polevalatexpr"></span><h2><a class="toc-backref" href="#id85"><tt class="docutils literal"><span class="pre">\PolEval{polname}\AtExpr{numerical</span> expression}</tt></a></h2>
<blockquote>
It boils down to
<tt class="docutils literal">\xinttheexpr polname(numerical <span class="pre">expression)\relax</span></tt>.</blockquote>
</div>
<div class="section" id="poleval-polname-at-fraction">
-<span id="polevalat"></span><h2><a class="toc-backref" href="#id85"><tt class="docutils literal"><span class="pre">\PolEval{polname}\At{fraction}</span></tt></a></h2>
+<span id="polevalat"></span><h2><a class="toc-backref" href="#id86"><tt class="docutils literal"><span class="pre">\PolEval{polname}\At{fraction}</span></tt></a></h2>
<blockquote>
<p>Evaluates the polynomial at value <tt class="docutils literal">fraction</tt> 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>
@@ -1379,12 +1429,12 @@ e.g. the variables as defined by <a class="reference external" href="PolSturmIso
</blockquote>
</div>
<div class="section" id="polevalreduced-polname-atexpr-numerical-expression">
-<span id="polevalreducedatexpr"></span><h2><a class="toc-backref" href="#id86"><tt class="docutils literal"><span class="pre">\PolEvalReduced{polname}\AtExpr{numerical</span> expression}</tt></a></h2>
+<span id="polevalreducedatexpr"></span><h2><a class="toc-backref" href="#id87"><tt class="docutils literal"><span class="pre">\PolEvalReduced{polname}\AtExpr{numerical</span> expression}</tt></a></h2>
<blockquote>
Boils down to <tt class="docutils literal">\xinttheexpr reduce(polname(numerical <span class="pre">expression))\relax</span></tt>.</blockquote>
</div>
<div class="section" id="polevalreduced-polname-at-fraction">
-<span id="polevalreducedat"></span><h2><a class="toc-backref" href="#id87"><tt class="docutils literal"><span class="pre">\PolEvalReduced{polname}\At{fraction}</span></tt></a></h2>
+<span id="polevalreducedat"></span><h2><a class="toc-backref" href="#id88"><tt class="docutils literal"><span class="pre">\PolEvalReduced{polname}\At{fraction}</span></tt></a></h2>
<blockquote>
<p>Evaluates the polynomial at value <tt class="docutils literal">fraction</tt> 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 produce
@@ -1397,7 +1447,7 @@ could be given as an expression.</p>
</blockquote>
</div>
<div class="section" id="polfloateval-polname-atexpr-numerical-expression">
-<span id="polfloatevalatexpr"></span><h2><a class="toc-backref" href="#id88"><tt class="docutils literal"><span class="pre">\PolFloatEval{polname}\AtExpr{numerical</span> expression}</tt></a></h2>
+<span id="polfloatevalatexpr"></span><h2><a class="toc-backref" href="#id89"><tt class="docutils literal"><span class="pre">\PolFloatEval{polname}\AtExpr{numerical</span> expression}</tt></a></h2>
<blockquote>
<p>Boils down to <tt class="docutils literal">\xintthefloatexpr polname(numerical <span class="pre">expression)\relax</span></tt>.</p>
<p>This is done via a Horner Scheme (see <a class="reference internal" href="#poldef">\poldef</a> and
@@ -1435,7 +1485,7 @@ nested expressions.</td></tr>
</blockquote>
</div>
<div class="section" id="polfloateval-polname-at-fraction">
-<span id="polfloatevalat"></span><h2><a class="toc-backref" href="#id89"><tt class="docutils literal"><span class="pre">\PolFloatEval{polname}\At{fraction}</span></tt></a></h2>
+<span id="polfloatevalat"></span><h2><a class="toc-backref" href="#id90"><tt class="docutils literal"><span class="pre">\PolFloatEval{polname}\At{fraction}</span></tt></a></h2>
<blockquote>
<p>Evaluates the polynomial at value <tt class="docutils literal">fraction</tt> 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 produces
@@ -1448,7 +1498,7 @@ could be given as an expression.</p>
</blockquote>
</div>
<div class="section" id="polifcoeffisplusorminusone-a-b">
-<span id="polifcoeffisplusorminusone"></span><h2><a class="toc-backref" href="#id90"><tt class="docutils literal"><span class="pre">\PolIfCoeffIsPlusOrMinusOne{A}{B}</span></tt></a></h2>
+<span id="polifcoeffisplusorminusone"></span><h2><a class="toc-backref" href="#id91"><tt class="docutils literal"><span class="pre">\PolIfCoeffIsPlusOrMinusOne{A}{B}</span></tt></a></h2>
<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
@@ -1460,25 +1510,34 @@ plus or minus one, and <tt class="docutils literal">B</tt> if not.</p>
</blockquote>
</div>
<div class="section" id="polleadingcoeff-polname">
-<span id="polleadingcoeff"></span><h2><a class="toc-backref" href="#id91"><tt class="docutils literal">\PolLeadingCoeff{polname}</tt></a></h2>
+<span id="polleadingcoeff"></span><h2><a class="toc-backref" href="#id92"><tt class="docutils literal">\PolLeadingCoeff{polname}</tt></a></h2>
<blockquote>
Expands to the leading coefficient.</blockquote>
</div>
<div class="section" id="polnthcoeff-polname-number">
-<span id="polnthcoeff"></span><h2><a class="toc-backref" href="#id92"><tt class="docutils literal"><span class="pre">\PolNthCoeff{polname}{number}</span></tt></a></h2>
+<span id="polnthcoeff"></span><h2><a class="toc-backref" href="#id93"><tt class="docutils literal"><span class="pre">\PolNthCoeff{polname}{number}</span></tt></a></h2>
<blockquote>
It expands to the raw <tt class="docutils literal">N</tt>-th coefficient (<tt class="docutils literal">0/1[0]</tt> if the index
number is out of range). With <tt class="docutils literal"><span class="pre">N=-1</span></tt>, <tt class="docutils literal"><span class="pre">-2</span></tt>, ... expands to the
leading coefficients.</blockquote>
</div>
<div class="section" id="poldegree-polname">
-<span id="poldegree"></span><h2><a class="toc-backref" href="#id93"><tt class="docutils literal">\PolDegree{polname}</tt></a></h2>
+<span id="poldegree"></span><h2><a class="toc-backref" href="#id94"><tt class="docutils literal">\PolDegree{polname}</tt></a></h2>
<blockquote>
It expands to the degree. This is <tt class="docutils literal"><span class="pre">-1</span></tt> if zero polynomial but this
may change in future. Should it then expand to <tt class="docutils literal"><span class="pre">-\infty</span></tt> ?</blockquote>
</div>
+<div class="section" id="policontent-polname">
+<span id="policontent"></span><h2><a class="toc-backref" href="#id95"><tt class="docutils literal">\PolIContent{polname}</tt></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
+with integer coefficients having no common prime divisor.</p>
+<p>See <a class="reference internal" href="#polmakeprimitive">\PolMakePrimitive</a>.</p>
+</blockquote>
+</div>
<div class="section" id="poltoexpr-polname">
-<span id="poltoexpr"></span><h2><a class="toc-backref" href="#id94"><tt class="docutils literal">\PolToExpr{polname}</tt></a></h2>
+<span id="poltoexpr"></span><h2><a class="toc-backref" href="#id96"><tt class="docutils literal">\PolToExpr{polname}</tt></a></h2>
<blockquote>
<p>Expands <a class="footnote-reference" href="#id22" id="id21">[4]</a> to <tt class="docutils literal"><span class="pre">coeff_N*x^N+...</span></tt> (descending powers.)</p>
<table class="docutils footnote" frame="void" id="id22" rules="none">
@@ -1503,7 +1562,7 @@ of <tt class="docutils literal">\PolToExpr{f}</tt>, but a simple <tt class="docu
the identical result.</p>
</blockquote>
<div class="section" id="poltoexproneterm-raw-coeff-number">
-<span id="poltoexproneterm"></span><h3><a class="toc-backref" href="#id95"><tt class="docutils literal"><span class="pre">\PolToExprOneTerm{raw_coeff}{number}</span></tt></a></h3>
+<span id="poltoexproneterm"></span><h3><a class="toc-backref" href="#id97"><tt class="docutils literal"><span class="pre">\PolToExprOneTerm{raw_coeff}{number}</span></tt></a></h3>
<blockquote>
<p>This two argument expandable command takes care of the monomial and
its coefficient. The default definition is done in order for
@@ -1516,13 +1575,13 @@ or a minus one. See <a class="reference internal" href="#poltoexprtimes">\PolToE
</blockquote>
</div>
<div class="section" id="poltoexpronetermstylea-raw-coeff-number">
-<span id="poltoexpronetermstylea"></span><h3><a class="toc-backref" href="#id96"><tt class="docutils literal"><span class="pre">\PolToExprOneTermStyleA{raw_coeff}{number}</span></tt></a></h3>
+<span id="poltoexpronetermstylea"></span><h3><a class="toc-backref" href="#id98"><tt class="docutils literal"><span class="pre">\PolToExprOneTermStyleA{raw_coeff}{number}</span></tt></a></h3>
<blockquote>
Holds the default package meaning of
<a class="reference internal" href="#poltoexproneterm-raw-coeff-number">\PolToExprOneTerm{raw_coeff}{number}</a>.</blockquote>
</div>
<div class="section" id="poltoexpronetermstyleb-raw-coeff-number">
-<span id="poltoexpronetermstyleb"></span><h3><a class="toc-backref" href="#id97"><tt class="docutils literal"><span class="pre">\PolToExprOneTermStyleB{raw_coeff}{number}</span></tt></a></h3>
+<span id="poltoexpronetermstyleb"></span><h3><a class="toc-backref" href="#id99"><tt class="docutils literal"><span class="pre">\PolToExprOneTermStyleB{raw_coeff}{number}</span></tt></a></h3>
<blockquote>
<p>For output in this style:</p>
<pre class="literal-block">
@@ -1536,7 +1595,7 @@ To revert to package default, issue
</blockquote>
</div>
<div class="section" id="poltoexprcmd-raw-coeff">
-<span id="poltoexprcmd"></span><h3><a class="toc-backref" href="#id98"><tt class="docutils literal">\PolToExprCmd{raw_coeff}</tt></a></h3>
+<span id="poltoexprcmd"></span><h3><a class="toc-backref" href="#id100"><tt class="docutils literal">\PolToExprCmd{raw_coeff}</tt></a></h3>
<blockquote>
It is the one-argument macro used by the package definition of
<tt class="docutils literal">\PolToExprOneTerm</tt> for the coefficients themselves (when not
@@ -1546,21 +1605,21 @@ to <tt class="docutils literal"><span class="pre">\xintIrr{#1}</span></tt> or to
output forcefully reduced coefficients.</blockquote>
</div>
<div class="section" id="poltoexprtermprefix-raw-coeff">
-<span id="poltoexprtermprefix"></span><h3><a class="toc-backref" href="#id99"><tt class="docutils literal">\PolToExprTermPrefix{raw_coeff}</tt></a></h3>
+<span id="poltoexprtermprefix"></span><h3><a class="toc-backref" href="#id101"><tt class="docutils literal">\PolToExprTermPrefix{raw_coeff}</tt></a></h3>
<blockquote>
Defined identically as <a class="reference internal" href="#poltypesetcmdprefix-raw-coeff">\PolTypesetCmdPrefix{raw_coeff}</a>. It
prefixes with a plus sign for non-negative coefficients, because
they don't carry one by themselves.</blockquote>
</div>
<div class="section" id="id23">
-<span id="poltoexprvar"></span><h3><a class="toc-backref" href="#id100"><tt class="docutils literal">\PolToExprVar</tt></a></h3>
+<span id="poltoexprvar"></span><h3><a class="toc-backref" href="#id102"><tt class="docutils literal">\PolToExprVar</tt></a></h3>
<blockquote>
This expands to the variable to use in output (it does not have to
be a single letter, may be an expandable macro.) Initial definition
is <tt class="docutils literal">x</tt>.</blockquote>
</div>
<div class="section" id="id24">
-<span id="poltoexprtimes"></span><h3><a class="toc-backref" href="#id101"><tt class="docutils literal">\PolToExprTimes</tt></a></h3>
+<span id="poltoexprtimes"></span><h3><a class="toc-backref" href="#id103"><tt class="docutils literal">\PolToExprTimes</tt></a></h3>
<blockquote>
This expands to the symbol used for multiplication of an
<tt class="docutils literal"><span class="pre">x^{number}</span></tt> by the corresponding coefficient. The default is
@@ -1570,13 +1629,13 @@ algebra software).</blockquote>
</div>
</div>
<div class="section" id="id26">
-<span id="id25"></span><h2><a class="toc-backref" href="#id102"><tt class="docutils literal"><span class="pre">\PolToExpr*{polname}</span></tt></a></h2>
+<span id="id25"></span><h2><a class="toc-backref" href="#id104"><tt class="docutils literal"><span class="pre">\PolToExpr*{polname}</span></tt></a></h2>
<blockquote>
Expands to <tt class="docutils literal"><span class="pre">coeff_0+coeff_1*x+coeff_2*x^2+...</span></tt> (ascending powers).
Customizable like <a class="reference internal" href="#poltoexpr-polname">\PolToExpr{polname}</a> via the same macros.</blockquote>
</div>
<div class="section" id="poltofloatexpr-polname">
-<span id="poltofloatexpr"></span><h2><a class="toc-backref" href="#id103"><tt class="docutils literal">\PolToFloatExpr{polname}</tt></a></h2>
+<span id="poltofloatexpr"></span><h2><a class="toc-backref" href="#id105"><tt class="docutils literal">\PolToFloatExpr{polname}</tt></a></h2>
<blockquote>
<p>Similar to <a class="reference internal" href="#poltoexpr-polname">\PolToExpr{polname}</a> but uses <a class="reference external" href="\PolToFloatExprCmd{raw_coeff}">\PolToFloatExprCmd</a>
which by default rounds and converts the coefficients to floating
@@ -1595,13 +1654,13 @@ those output by <tt class="docutils literal">\PolToFloatExpr{polname}</tt>.</p>
</div>
</blockquote>
<div class="section" id="poltofloatexproneterm-raw-coeff-number">
-<span id="poltofloatexproneterm"></span><h3><a class="toc-backref" href="#id104"><tt class="docutils literal"><span class="pre">\PolToFloatExprOneTerm{raw_coeff}{number}</span></tt></a></h3>
+<span id="poltofloatexproneterm"></span><h3><a class="toc-backref" href="#id106"><tt class="docutils literal"><span class="pre">\PolToFloatExprOneTerm{raw_coeff}{number}</span></tt></a></h3>
<blockquote>
Similar to <a class="reference external" href="\PolToExprOneTerm{raw_coeff}{number}">\PolToExprOneTerm</a>. But does not treat
especially coefficients equal to plus or minus one.</blockquote>
</div>
<div class="section" id="poltofloatexprcmd-raw-coeff">
-<span id="id28"></span><h3><a class="toc-backref" href="#id105"><tt class="docutils literal">\PolToFloatExprCmd{raw_coeff}</tt></a></h3>
+<span id="id28"></span><h3><a class="toc-backref" href="#id107"><tt class="docutils literal">\PolToFloatExprCmd{raw_coeff}</tt></a></h3>
<blockquote>
<p>It is the one-argument macro used by <tt class="docutils literal">\PolToFloatExprOneTerm</tt>.
Its package definition is <tt class="docutils literal"><span class="pre">\xintFloat{#1}</span></tt>.</p>
@@ -1624,25 +1683,25 @@ in <tt class="docutils literal">xintfrac</tt> raw format.</p>
</div>
</div>
<div class="section" id="id30">
-<span id="id29"></span><h2><a class="toc-backref" href="#id106"><tt class="docutils literal"><span class="pre">\PolToFloatExpr*{polname}</span></tt></a></h2>
+<span id="id29"></span><h2><a class="toc-backref" href="#id108"><tt class="docutils literal"><span class="pre">\PolToFloatExpr*{polname}</span></tt></a></h2>
<blockquote>
Typesets in ascending powers.</blockquote>
</div>
<div class="section" id="poltolist-polname">
-<span id="poltolist"></span><h2><a class="toc-backref" href="#id107"><tt class="docutils literal">\PolToList{polname}</tt></a></h2>
+<span id="poltolist"></span><h2><a class="toc-backref" href="#id109"><tt class="docutils literal">\PolToList{polname}</tt></a></h2>
<blockquote>
Expands to <tt class="docutils literal"><span class="pre">{coeff_0}{coeff_1}...{coeff_N}</span></tt> with <tt class="docutils literal">N</tt> = degree
(except zero polynomial which does give <tt class="docutils literal">{0/1[0]}</tt> and not an
empty output.)</blockquote>
</div>
<div class="section" id="poltocsv-polname">
-<span id="poltocsv"></span><h2><a class="toc-backref" href="#id108"><tt class="docutils literal">\PolToCSV{polname}</tt></a></h2>
+<span id="poltocsv"></span><h2><a class="toc-backref" href="#id110"><tt class="docutils literal">\PolToCSV{polname}</tt></a></h2>
<blockquote>
Expands to <tt class="docutils literal">coeff_0, coeff_1, coeff_2, <span class="pre">.....,</span> coeff_N</tt>. Converse
to <a class="reference internal" href="#polfromcsv-polname-csv">\PolFromCSV</a>.</blockquote>
</div>
<div class="section" id="polsturmchainlength-sturmname">
-<span id="polsturmchainlength"></span><h2><a class="toc-backref" href="#id109"><tt class="docutils literal">\PolSturmChainLength{sturmname}</tt></a></h2>
+<span id="polsturmchainlength"></span><h2><a class="toc-backref" href="#id111"><tt class="docutils literal">\PolSturmChainLength{sturmname}</tt></a></h2>
<blockquote>
<p>Returns the integer <tt class="docutils literal">N</tt> such that <tt class="docutils literal">sturmname_N</tt> is the last one
in the Sturm chain <tt class="docutils literal">sturmname_0</tt>, <tt class="docutils literal">sturmname_1</tt>, ...</p>
@@ -1650,7 +1709,7 @@ in the Sturm chain <tt class="docutils literal">sturmname_0</tt>, <tt class="doc
</blockquote>
</div>
<div class="section" id="polsturmifzeroexactlyknown-sturmname-index-a-b">
-<span id="polsturmifzeroexactlyknown"></span><h2><a class="toc-backref" href="#id110"><tt class="docutils literal"><span class="pre">\PolSturmIfZeroExactlyKnown{sturmname}{index}{A}{B}</span></tt></a></h2>
+<span id="polsturmifzeroexactlyknown"></span><h2><a class="toc-backref" href="#id112"><tt class="docutils literal"><span class="pre">\PolSturmIfZeroExactlyKnown{sturmname}{index}{A}{B}</span></tt></a></h2>
<blockquote>
<p>Executes <tt class="docutils literal">A</tt> if the <tt class="docutils literal">index</tt>th interval reduces to a singleton,
i.e. the root is known exactly, else <tt class="docutils literal">B</tt>.</p>
@@ -1667,21 +1726,21 @@ error message (right before everything goes haywire).</p>
</blockquote>
</div>
<div class="section" id="polsturmisolatedzeroleft-sturmname-index">
-<span id="polsturmisolatedzeroleft"></span><h2><a class="toc-backref" href="#id111"><tt class="docutils literal"><span class="pre">\PolSturmIsolatedZeroLeft{sturmname}{index}</span></tt></a></h2>
+<span id="polsturmisolatedzeroleft"></span><h2><a class="toc-backref" href="#id113"><tt class="docutils literal"><span class="pre">\PolSturmIsolatedZeroLeft{sturmname}{index}</span></tt></a></h2>
<blockquote>
Expands to the left end-point for the <tt class="docutils literal">index</tt>th interval
obtained via <a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{sturmname}</a> and possibly
refined afterwards.</blockquote>
</div>
<div class="section" id="polsturmisolatedzeroright-sturmname-index">
-<span id="polsturmisolatedzeroright"></span><h2><a class="toc-backref" href="#id112"><tt class="docutils literal"><span class="pre">\PolSturmIsolatedZeroRight{sturmname}{index}</span></tt></a></h2>
+<span id="polsturmisolatedzeroright"></span><h2><a class="toc-backref" href="#id114"><tt class="docutils literal"><span class="pre">\PolSturmIsolatedZeroRight{sturmname}{index}</span></tt></a></h2>
<blockquote>
Expands to the right end-point for the <tt class="docutils literal">index</tt>th interval
obtained via <a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{sturmname}</a> and possibly
refined afterwards.</blockquote>
</div>
<div class="section" id="polsturmnbofisolatedzeros-sturmname">
-<span id="polsturmnbofisolatedzeros"></span><h2><a class="toc-backref" href="#id113"><tt class="docutils literal">\PolSturmNbOfIsolatedZeros{sturmname}</tt></a></h2>
+<span id="polsturmnbofisolatedzeros"></span><h2><a class="toc-backref" href="#id115"><tt class="docutils literal">\PolSturmNbOfIsolatedZeros{sturmname}</tt></a></h2>
<blockquote>
Expands to the number of real roots of the polynomial
<tt class="docutils literal">&lt;sturmname&gt;_0</tt> (which is the number of distinct real roots of the
@@ -1689,17 +1748,17 @@ polynomial used to create the Sturm chain via
<a class="reference internal" href="#poltosturm-polname-sturmname">\PolToSturm{polname}{sturmname}</a>.</blockquote>
</div>
<div class="section" id="polintervalwidth-sturmname-index">
-<span id="polintervalwidth"></span><h2><a class="toc-backref" href="#id114"><tt class="docutils literal"><span class="pre">\PolIntervalWidth{sturmname}{index}</span></tt></a></h2>
+<span id="polintervalwidth"></span><h2><a class="toc-backref" href="#id116"><tt class="docutils literal"><span class="pre">\PolIntervalWidth{sturmname}{index}</span></tt></a></h2>
<blockquote>
The <tt class="docutils literal">10^E</tt> width of the current <tt class="docutils literal">index</tt>th root localization
interval. Output is in <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> raw <tt class="docutils literal">1/1[E]</tt> format (if not zero).</blockquote>
</div>
<div class="section" id="macros-for-use-within-execution-of-polprintintervals">
-<h2><a class="toc-backref" href="#id115">Macros for use within execution of <tt class="docutils literal">\PolPrintIntervals</tt></a></h2>
+<h2><a class="toc-backref" href="#id117">Macros for use within execution of <tt class="docutils literal">\PolPrintIntervals</tt></a></h2>
<p>More precisely, they can be used within the replacement texts of the
<a class="reference internal" href="#polprintintervalsprintleftendpoint">\PolPrintIntervalsPrintLeftEndPoint</a>, etc, macros.</p>
<div class="section" id="id31">
-<span id="polprintintervalstheendpoint"></span><h3><a class="toc-backref" href="#id116"><tt class="docutils literal">\PolPrintIntervalsTheEndPoint</tt></a></h3>
+<span id="polprintintervalstheendpoint"></span><h3><a class="toc-backref" href="#id118"><tt class="docutils literal">\PolPrintIntervalsTheEndPoint</tt></a></h3>
<blockquote>
Within a custom <a class="reference internal" href="#polprintintervalsprintleftendpoint">\PolPrintIntervalsPrintLeftEndPoint</a>, custom
<a class="reference internal" href="#polprintintervalsprintrightendpoint">\PolPrintIntervalsPrintRightEndPoint</a>, or custom
@@ -1708,7 +1767,7 @@ or right end point of the considered interval. Serves as default
replacement for <a class="reference internal" href="#polprintintervalsprintleftendpoint">\PolPrintIntervalsPrintLeftEndPoint</a> , etc...</blockquote>
</div>
<div class="section" id="id32">
-<span id="polprintintervalstheindex"></span><h3><a class="toc-backref" href="#id117"><tt class="docutils literal">\PolPrintIntervalsTheIndex</tt></a></h3>
+<span id="polprintintervalstheindex"></span><h3><a class="toc-backref" href="#id119"><tt class="docutils literal">\PolPrintIntervalsTheIndex</tt></a></h3>
<blockquote>
Within a custom <a class="reference internal" href="#polprintintervalsprintleftendpoint">\PolPrintIntervalsPrintLeftEndPoint</a>, custom
<a class="reference internal" href="#polprintintervalsprintrightendpoint">\PolPrintIntervalsPrintRightEndPoint</a>, or custom
@@ -1719,7 +1778,7 @@ in the replacement text of <a class="reference internal" href="#polprintinterval
the other two similar macros.</blockquote>
</div>
<div class="section" id="polifendpointispositive-a-b">
-<span id="polifendpointispositive"></span><h3><a class="toc-backref" href="#id118"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsPositive{A}{B}</span></tt></a></h3>
+<span id="polifendpointispositive"></span><h3><a class="toc-backref" href="#id120"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsPositive{A}{B}</span></tt></a></h3>
<blockquote>
Within a custom <a class="reference internal" href="#polprintintervalsprintleftendpoint">\PolPrintIntervalsPrintLeftEndPoint</a>, custom
<a class="reference internal" href="#polprintintervalsprintrightendpoint">\PolPrintIntervalsPrintRightEndPoint</a>, or custom
@@ -1727,7 +1786,7 @@ Within a custom <a class="reference internal" href="#polprintintervalsprintlefte
the considered interval end-point is positive, else <tt class="docutils literal">B</tt>.</blockquote>
</div>
<div class="section" id="polifendpointisnegative-a-b">
-<span id="polifendpointisnegative"></span><h3><a class="toc-backref" href="#id119"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsNegative{A}{B}</span></tt></a></h3>
+<span id="polifendpointisnegative"></span><h3><a class="toc-backref" href="#id121"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsNegative{A}{B}</span></tt></a></h3>
<blockquote>
Within a custom <a class="reference internal" href="#polprintintervalsprintleftendpoint">\PolPrintIntervalsPrintLeftEndPoint</a>, custom
<a class="reference internal" href="#polprintintervalsprintrightendpoint">\PolPrintIntervalsPrintRightEndPoint</a>, or custom
@@ -1735,7 +1794,7 @@ Within a custom <a class="reference internal" href="#polprintintervalsprintlefte
the considered interval end-point is negative, else <tt class="docutils literal">B</tt>.</blockquote>
</div>
<div class="section" id="polifendpointiszero-a-b">
-<span id="polifendpointiszero"></span><h3><a class="toc-backref" href="#id120"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsZero{A}{B}</span></tt></a></h3>
+<span id="polifendpointiszero"></span><h3><a class="toc-backref" href="#id122"><tt class="docutils literal"><span class="pre">\PolIfEndPointIsZero{A}{B}</span></tt></a></h3>
<blockquote>
Within a custom <a class="reference internal" href="#polprintintervalsprintleftendpoint">\PolPrintIntervalsPrintLeftEndPoint</a>, custom
<a class="reference internal" href="#polprintintervalsprintrightendpoint">\PolPrintIntervalsPrintRightEndPoint</a>, or custom
@@ -1744,7 +1803,7 @@ the considered interval end-point is zero, else <tt class="docutils literal">B</
</div>
</div>
<div class="section" id="poldectostring-decimal-number">
-<span id="poldectostring"></span><h2><a class="toc-backref" href="#id121"><tt class="docutils literal">\PolDecToString{decimal number}</tt></a></h2>
+<span id="poldectostring"></span><h2><a class="toc-backref" href="#id123"><tt class="docutils literal">\PolDecToString{decimal number}</tt></a></h2>
<blockquote>
<p>This is a utility macro to print decimal numbers. It has been
backported to <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> (release <tt class="docutils literal">1.3</tt> of <tt class="docutils literal">2018/03/01</tt>) under
@@ -1761,9 +1820,9 @@ zeroes, one can use <tt class="docutils literal"><span class="pre">\PolDecToStri
</div>
</div>
<div class="section" id="booleans-with-default-setting-as-indicated">
-<h1><a class="toc-backref" href="#id122">Booleans (with default setting as indicated)</a></h1>
+<h1><a class="toc-backref" href="#id124">Booleans (with default setting as indicated)</a></h1>
<div class="section" id="xintverbosefalse">
-<h2><a class="toc-backref" href="#id123"><tt class="docutils literal">\xintverbosefalse</tt></a></h2>
+<h2><a class="toc-backref" href="#id125"><tt class="docutils literal">\xintverbosefalse</tt></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
<tt class="docutils literal">true</tt> triggers the writing of information to the log when new
@@ -1776,20 +1835,20 @@ unstable and undocumented internal structures.</p>
</blockquote>
</div>
<div class="section" id="poltypesetallfalse">
-<h2><a class="toc-backref" href="#id124"><tt class="docutils literal">\poltypesetallfalse</tt></a></h2>
+<h2><a class="toc-backref" href="#id126"><tt class="docutils literal">\poltypesetallfalse</tt></a></h2>
<blockquote>
If <tt class="docutils literal">true</tt>, <a class="reference internal" href="#poltypeset-polname">\PolTypeset{polname}</a> will also typeset the vanishing
coefficients.</blockquote>
</div>
<div class="section" id="poltoexprallfalse">
-<h2><a class="toc-backref" href="#id125"><tt class="docutils literal">\poltoexprallfalse</tt></a></h2>
+<h2><a class="toc-backref" href="#id127"><tt class="docutils literal">\poltoexprallfalse</tt></a></h2>
<blockquote>
If <tt class="docutils literal">true</tt>, <a class="reference internal" href="#poltoexpr-polname">\PolToExpr{polname}</a> and <a class="reference internal" href="#poltofloatexpr-polname">\PolToFloatExpr{polname}</a> will
also include the vanishing coefficients in their outputs.</blockquote>
</div>
</div>
<div class="section" id="technicalities">
-<h1><a class="toc-backref" href="#id126">Technicalities</a></h1>
+<h1><a class="toc-backref" href="#id128">Technicalities</a></h1>
<ul>
<li><p class="first">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
@@ -1831,17 +1890,6 @@ resulting coefficients, except that the <em>power of ten</em> part <tt class="do
reduction of the fraction. This is tentative and may change.</p>
<p>Same remark for <a class="reference internal" href="#polantidiff-polname-1-polname-2">\PolAntiDiff{polname_1}{polname_2}</a>.</p>
</li>
-<li><p class="first">If <tt class="docutils literal">f</tt> was created from comma separated values by macro
-<a class="reference internal" href="#polfromcsv-polname-csv">\PolFromCSV{polname}{&lt;csv&gt;}</a>, then the coefficients will be in
-the output of <a class="reference internal" href="#poltolist-polname">\PolToList{polname}</a> and <a class="reference internal" href="#poltocsv-polname">\PolToCSV{polname}</a> in
-the same format as originally in input: a <tt class="docutils literal">1.3e2</tt> will again be a
-<tt class="docutils literal">1.3e2</tt>.</p>
-<p>In contrast when such coefficients are used in a <tt class="docutils literal">\poldef</tt> (or
-<tt class="docutils literal">\PolDef</tt>) expression, they get transformed during the parsing to
-the xintfrac <em>raw</em> format.
-This <em>raw</em> format speeds up expansion of xintfrac macros for numerical
-evaluations.</p>
-</li>
<li><p class="first">Currently, the package stores all coefficients from index <tt class="docutils literal">0</tt> to
index equal to the polynomial degree inside a single macro, as a list.
This data structure is obviously very inefficient for polynomials of
@@ -1857,7 +1905,7 @@ documented and unstable. Don't use them.</p>
</ul>
</div>
<div class="section" id="change-log">
-<h1><a class="toc-backref" href="#id127">CHANGE LOG</a></h1>
+<h1><a class="toc-backref" href="#id129">CHANGE LOG</a></h1>
<ul>
<li><p class="first">v0.1 (2018/01/11): initial release. Features:</p>
<ul class="simple">
@@ -2034,10 +2082,45 @@ for localization of the real roots of polynomials.</p>
<li><p class="first">v0.4.2 (2018/03/03)</p>
<p>Documentation fix.</p>
</li>
+<li><p class="first">v0.5 (2018/04/08)</p>
+<ul class="simple">
+<li>bug fixes:<ul>
+<li><a class="reference internal" href="#polget-polname-fromarray-macro">\PolGet{polname}\fromarray\macro</a> crashed when <tt class="docutils literal">\macro</tt> 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
+polynomial.</li>
+</ul>
+</li>
+<li>breaking changes:<ul>
+<li><a class="reference internal" href="#poltosturm">\PolToSturm</a> creates primitive integer coefficients polynomials.
+This speeds up localization of roots via
+<a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a>. In case of user protests the author
+will make available again the code producing the bona fide Sturm
+polynomials as used formerly.</li>
+<li>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 <tt class="docutils literal">\xintRaw</tt>.</li>
+</ul>
+</li>
+<li>experimental change:<ul>
+<li>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
+an interval specification.</li>
+</ul>
+</li>
+<li>new non-expandable macros:<ul>
+<li><a class="reference internal" href="#polmakeprimitive">\PolMakePrimitive</a></li>
+</ul>
+</li>
+<li>new expandable macros:<ul>
+<li><a class="reference internal" href="#policontent">\PolIContent</a></li>
+</ul>
+</li>
+</ul>
+</li>
</ul>
</div>
<div class="section" id="acknowledgments">
-<h1><a class="toc-backref" href="#id128">Acknowledgments</a></h1>
+<h1><a class="toc-backref" href="#id130">Acknowledgments</a></h1>
<p>Thanks to Jürgen Gilg whose question about <a class="reference external" href="http://www.ctan.org/pkg/xint">xint</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
diff --git a/Master/texmf-dist/doc/latex/polexpr/polexpr.txt b/Master/texmf-dist/doc/latex/polexpr/polexpr.txt
index 16cdff04d1e..dd2ab246900 100644
--- a/Master/texmf-dist/doc/latex/polexpr/polexpr.txt
+++ b/Master/texmf-dist/doc/latex/polexpr/polexpr.txt
@@ -4,8 +4,8 @@
Package polexpr documentation
===============================
-0.4.2 (2018/03/03)
-==================
+0.5 (2018/04/08)
+================
.. contents::
@@ -120,7 +120,13 @@ the macro call ``\PolGCD{f_1}{f_2}{k}`` sets ``k`` to the (unitary) GCD of
Examples of localization of roots
---------------------------------
-First some remarks about auxiliaries.
+.. attention::
+
+ At ``0.5``, `\\PolToSturm{P}{S} <PolToSturm_>`_ was modified to
+ create a chain of primitive integer coefficients polynomials. This
+ speeds up evaluations, hence localization of roots afterwards. Thus
+ ``S_1`` will not necessarily be the derivative of ``S_0``, even if
+ ``P`` is square-free.
- To make printed decimal numbers more enjoyable than via
``\xintSignedFrac``::
@@ -137,9 +143,10 @@ First some remarks about auxiliaries.
to modify output of `\\PolToExpr{polname}`_.
-- for extra info in log file ``\xintverbosetrue``. In fact one can also
- work from command line then (I recommend ``rlwrap`` for encapsulating
- ``latex``).
+- For extra info in log file use ``\xintverbosetrue``.
+
+- To make producing this documentation simpler, the results from execution
+ of the code snippets are not included. Please try them out yourself...
A typical example
@@ -166,8 +173,10 @@ was no further reduction.
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 derivative polynomial is \PolTypeset{f_1} (from
- $\PolDegree{f_0}=7$ we know that original polynomial was square-free).
+ The first element of the Sturm chain has degree $\PolDegree{f_0}$. As
+ this same as $\PolDegree{f}$ we know that the latter was square free.
+ So the derivative is up to a constant \PolTypeset{f_1} (in fact here
+ it is identical with it).
\PolToSturm{f_1}{f_1}\PolSturmIsolateZeros{f_1}%
It has \PolSturmNbOfIsolatedZeros{f_1} distinct real
roots:
@@ -238,23 +247,27 @@ A Mignotte type polynomial
\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 < Z_2 < 0.1, 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
- There are $\PolSturmNbOfIsolatedZeros{P}$ distinct real roots and there holds
- $\PolSturmIsolatedZeroLeft{P}{2}<Z_2<\PolSturmIsolatedZeroRight{P}{2}$.
+ \[\PolSturmIsolatedZeroLeft{P}{2}<Z_2<\PolSturmIsolatedZeroRight{P}{2}\]
The last line produces::
0.09999900004999650028 < Z_2 < 0.09999900004999650029
The degree 41 polynomial with -2, -1.9, -1.8, ..., 0, 0.1, ..., 1.9, 2 as roots
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
@@ -299,9 +312,24 @@ Stress test: not a hard challenge to ``xint + polexpr``, but be a bit patient!
::
\PolDef{P}{mul((x-i*1e-1), i=-20..20)}%
- \PolToSturm{P}{S} % dutifully computes S_0, ..., S_{41}
- \PolSturmIsolateZeros{S} % finds *exactly* (but a bit slowly) all 41 roots!
- \PolPrintIntervals{S} % nice, isn't it?
+ \PolToSturm{P}{S} % dutifully computes S_0, ..., S_{41}
+ \PolSturmIsolateZeros[1]{S} % finds *exactly* (but a bit slowly) all 41 roots!
+ \PolPrintIntervals{S} % nice, isn't it?
+
+.. note::
+
+ Release ``0.5`` has experimental addition of optional argument
+ ``E`` to ``\PolSturmIsolateZeros``. It instructs to search roots only
+ in interval ``(-10^E, 10^E)``, extremities assumed to not be roots.
+ Thus here::
+
+ \PolSturmIsolateZeros[1]{S}
+
+ gives some speed gain; without it, it turns out in this case that
+ ``polexpr`` would have started with ``(-10^6, 10^6)`` interval.
+
+ This will probably get replaced in future by the specification of
+ a general interval.
Roots of Chebyshev polynomials
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -453,11 +481,12 @@ Non-expandable macros
``\PolGet{polname}\fromarray\macro``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Does the converse operation to ``\PolAssign{polname}\toarray\macro``. No
- error checks on validity of coefficients as numbers. Each
- ``\macro{number}`` is expanded in an ``\edef`` before being assigned
- to a coefficient. Leading zero coefficients are removed from the
- polynomial.
+ Does the converse operation to
+ ``\PolAssign{polname}\toarray\macro``. Each individual
+ ``\macro{number}`` gets expanded in an ``\edef`` and then normalized
+ via xintfrac_\ 's macro ``\xintRaw``.
+
+ The leading zeros are removed from the polynomial.
(contrived) Example::
@@ -465,8 +494,11 @@ Non-expandable macros
\PolGet{f}\fromarray\foo
This will define ``f`` as would have ``\poldef f(x):=1-2x+5x^2-3x^3;``.
- However the coefficients are still in their original form (i.e.
- they were not subjected to ``\xintRaw`` or similar xintfrac_ macro.)
+
+ .. note::
+
+ Prior to ``0.5``, coefficients were not normalized via
+ ``\xintRaw`` for internal storage.
.. _PolFromCSV:
@@ -477,9 +509,8 @@ Non-expandable macros
values (or a macro expanding to such a list) of its coefficients,
the constant term being the first item. No validity checks. Spaces
from the list argument are trimmed. List items are each expanded in
- an ``\edef``, but currently left in their original form like e.g.
- ``1.5e3`` which is not converted to ``15/1[2]`` *raw* xintfrac_
- format (this may change).
+ an ``\edef`` and then put into normalized form via xintfrac_\ 's
+ macro ``\xintRaw``.
Leading zero coefficients are removed::
@@ -489,6 +520,11 @@ Non-expandable macros
See also expandable macro `\\PolToCSV <\\PolToCSV{polname}_>`_.
+ .. note::
+
+ Prior to ``0.5``, coefficients were not normalized via
+ ``\xintRaw`` for internal storage.
+
.. _PolTypeset:
``\PolTypeset{polname}``
@@ -679,15 +715,22 @@ Non-expandable macros
With, for example, ``polname`` being ``P`` and ``sturmname`` being
``S``, the macro starts by computing polynomials ``S_0 = P``, ``S_1
= P'``, ..., with ``S_{n+1}`` the opposite of the remainder of
- euclidean division of ``S_{n-1}`` by ``S_{n}``. The last non-zero
- remainder ``S_N`` is up to a factor the GCD of ``P`` and ``P'``
- hence a constant if and only if ``P`` is square-free.
+ euclidean division of ``S_{n-1}`` by ``S_{n}``.
+
+ .. attention::
+
+ Since ``0.5``, it further normalizes all these polynomials by making
+ them primitive (see `\\PolMakePrimitive`_).
+
+ The last non-zero remainder ``S_N`` is up to a factor the GCD of
+ ``P`` and ``P'`` hence it is a constant (i.e. ``1`` or ``-1`` since
+ ``0.5``) if and only if ``P`` is square-free.
In case ``S_N`` is not a constant, the macro then goes on with
- dividing all ``S_k``'s with ``S_N`` (which becomes ``1``).
+ dividing all ``S_k``'s with ``S_N`` (which then becomes ``1``).
- Thus ``S_0`` now has exactly the same real and complex
- roots as polynomial ``polname``, but each with multiplicity one.
+ Thus ``S_0`` has exactly the same real and complex roots as
+ polynomial ``polname``, but each root being now with multiplicity one.
.. _PolToSturm*:
@@ -999,6 +1042,16 @@ Non-expandable macros
coefficients and we want to keep the leading one as common
denominator.
+.. _PolMakePrimitive:
+
+``\PolMakePrimitive{polname}``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ Divides by the integer content see (`\\PolIContent
+ <PolIContent_>`_). This thus produces a polynomial with integer
+ coefficients having no common factor. The sign of the leading
+ coefficient is not modified.
+
Expandable macros
-----------------
@@ -1142,6 +1195,17 @@ and ``\PolToFloatExpr`` (and their auxiliaries) which need a
It expands to the degree. This is ``-1`` if zero polynomial but this
may change in future. Should it then expand to ``-\infty`` ?
+.. _PolIContent:
+
+``\PolIContent{polname}``
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ It expands to the contents of the polynomial, i.e. to the positive
+ fraction such that dividing by this fraction produces a polynomial
+ with integer coefficients having no common prime divisor.
+
+ See `\\PolMakePrimitive <PolMakePrimitive_>`_.
+
.. _PolToExpr:
``\PolToExpr{polname}``
@@ -1365,7 +1429,6 @@ and ``\PolToFloatExpr`` (and their auxiliaries) which need a
There is also an out-of-range check done for some reasonable
error message (right before everything goes haywire).
-
.. _PolSturmIsolatedZeroLeft:
``\PolSturmIsolatedZeroLeft{sturmname}{index}``
@@ -1551,18 +1614,6 @@ Technicalities
Same remark for `\\PolAntiDiff{polname_1}{polname_2}`_.
-- If ``f`` was created from comma separated values by macro
- `\\PolFromCSV{polname}{\<csv\>}`_, then the coefficients will be in
- the output of `\\PolToList{polname}`_ and `\\PolToCSV{polname}`_ in
- the same format as originally in input: a ``1.3e2`` will again be a
- ``1.3e2``.
-
- In contrast when such coefficients are used in a ``\poldef`` (or
- ``\PolDef``) expression, they get transformed during the parsing to
- the xintfrac *raw* format.
- This *raw* format speeds up expansion of xintfrac macros for numerical
- evaluations.
-
- Currently, the package stores all coefficients from index ``0`` to
index equal to the polynomial degree inside a single macro, as a list.
This data structure is obviously very inefficient for polynomials of
@@ -1737,6 +1788,36 @@ CHANGE LOG
Documentation fix.
+- v0.5 (2018/04/08)
+
+ * bug fixes:
+
+ - `\\PolGet{polname}\\fromarray\\macro`_ crashed when ``\macro`` was
+ an xinttools_ array macro with no items. It now produces the zero
+ polynomial.
+ * breaking changes:
+
+ - `\\PolToSturm`_ creates primitive integer coefficients polynomials.
+ This speeds up localization of roots via
+ `\\PolSturmIsolateZeros`_. In case of user protests the author
+ will make available again the code producing the bona fide Sturm
+ polynomials as used formerly.
+ - polynomials created from `\\PolFromCSV`_ or `\\PolGet <PolGet_>`_
+ get their coefficients normalized via xintfrac_\ 's ``\xintRaw``.
+ * experimental change:
+
+ - optional argument to `\\PolSturmIsolateZeros`_ (see `The
+ degree 41 polynomial with -2, -1.9, -1.8, ..., 0, 0.1, ..., 1.9, 2
+ as roots`_ for usage). It will presumably be replaced in future by
+ an interval specification.
+ * new non-expandable macros:
+
+ - `\\PolMakePrimitive`_
+ * new expandable macros:
+
+ - `\\PolIContent`_
+
+
Acknowledgments
---------------