texlive[47509] Master/texmf-dist: polexpr (23apr18)

commits+karl at tug.org commits+karl at tug.org
Mon Apr 30 19:03:35 CEST 2018


Revision: 47509
          http://tug.org/svn/texlive?view=revision&revision=47509
Author:   karl
Date:     2018-04-30 19:03:34 +0200 (Mon, 30 Apr 2018)
Log Message:
-----------
polexpr (23apr18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/polexpr/README.md
    trunk/Master/texmf-dist/doc/latex/polexpr/polexpr.html
    trunk/Master/texmf-dist/doc/latex/polexpr/polexpr.txt
    trunk/Master/texmf-dist/tex/latex/polexpr/polexpr.sty

Modified: trunk/Master/texmf-dist/doc/latex/polexpr/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/polexpr/README.md	2018-04-30 17:03:06 UTC (rev 47508)
+++ trunk/Master/texmf-dist/doc/latex/polexpr/README.md	2018-04-30 17:03:34 UTC (rev 47509)
@@ -67,16 +67,13 @@
   Documentation fix.
 - 0.5 (2018/04/08)
   - new macros `\PolMakePrimitive` and `\PolIContent`.
-  - breaking change: `\PolToSturm` creates a chain of primitive
+  - main (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.
+- 0.5.1 (2018/04/22)
+  The `'` character can be used in polynomial names.
 
 
-Files of 0.5 release:
+Files of 0.5.1 release:
 
 - README.md,
 - polexpr.sty (package file),

Modified: trunk/Master/texmf-dist/doc/latex/polexpr/polexpr.html
===================================================================
--- trunk/Master/texmf-dist/doc/latex/polexpr/polexpr.html	2018-04-30 17:03:06 UTC (rev 47508)
+++ trunk/Master/texmf-dist/doc/latex/polexpr/polexpr.html	2018-04-30 17:03:34 UTC (rev 47509)
@@ -362,7 +362,7 @@
 <body>
 <div class="document" id="package-polexpr-documentation">
 <h1 class="title">Package polexpr documentation</h1>
-<h2 class="subtitle" id="id1">0.5 (2018/04/08)</h2>
+<h2 class="subtitle" id="id1">0.5.1 (2018/04/22)</h2>
 
 <!-- comment: -*- fill-column: 72; mode: rst; -*- -->
 <div class="contents topic" id="contents">
@@ -490,9 +490,25 @@
 <pre class="literal-block">
 \poldef polname(x):= expression in variable x;
 </pre>
-<p>where in place of <tt class="docutils literal">x</tt> an arbitrary <em>dummy variable</em> is authorized
-(i.e. per default any of <tt class="docutils literal"><span class="pre">[a-z|A-Z]</span></tt>; more letters can be declared
-under Unicode engines.) One can also issue:</p>
+<p>where:</p>
+<ul class="simple">
+<li>in place of <tt class="docutils literal">x</tt> an arbitrary <em>dummy variable</em> is authorized,
+i.e. per default any of <tt class="docutils literal"><span class="pre">[a-z|A-Z]</span></tt> (more letters can be declared
+under Unicode engines.)</li>
+<li><tt class="docutils literal">polname</tt> consists of letters, digits, and the <tt class="docutils literal">_</tt> and
+<tt class="docutils literal">'</tt> characters. It must start with a letter.</li>
+</ul>
+<div class="admonition attention">
+<p class="first admonition-title">Attention!</p>
+<p class="last">The <tt class="docutils literal">'</tt> is authorized since <tt class="docutils literal">0.5.1</tt>. As a result some constructs
+recognized by the <tt class="docutils literal">\xintexpr</tt> parser, such as <tt class="docutils literal">var1 'and' var2</tt>
+will get misinterpreted and cause errors. However these constructs
+are unlikely to be frequently needed in polynomial expressions, and
+the <tt class="docutils literal">\xintexpr</tt> syntax offers alternatives, so it was deemed a
+small evil. Of course the <tt class="docutils literal">\xintexpr</tt> parser is modified only
+temporarily during execution of <tt class="docutils literal">\poldef</tt>.</p>
+</div>
+<p>One can also issue:</p>
 <pre class="literal-block">
 \PolDef{polname}{expression in variable x}
 </pre>
@@ -501,7 +517,8 @@
 <dl class="docutils">
 <dt><tt class="docutils literal">\poldef <span class="pre">f(x):=</span> <span class="pre">1-x+x^2;</span></tt></dt>
 <dd>defines polynomial <tt class="docutils literal">f</tt>. Polynomial names must start with a
-letter and may contain letters, digits, and underscores. The
+letter and may contain letters, digits, underscores and the right
+tick character. The
 variable must be a single letter. The colon character is optional.
 The semi-colon at end of expression is mandatory.</dd>
 <dt><tt class="docutils literal"><span class="pre">\PolDef{f}{1-x+x^2}</span></tt></dt>
@@ -518,20 +535,28 @@
 <dt><tt class="docutils literal">\poldef <span class="pre">k(z):=</span> <span class="pre">f(z)-g(g(z)^2)^2;</span></tt></dt>
 <dd>should now define the zero polynomial... Let's check:
 <tt class="docutils literal">\[ k(z) = <span class="pre">\PolTypeset[z]{k}</span> \]</tt></dd>
-<dt><tt class="docutils literal"><span class="pre">\PolDiff{f}{df_dx}</span></tt></dt>
-<dd>sets <tt class="docutils literal">df_dx</tt> to the derivative of <tt class="docutils literal">f</tt>.</dd>
-<dt><tt class="docutils literal"><span class="pre">\PolDiff{df_dx}{f_xx}</span></tt></dt>
+<dt><tt class="docutils literal"><span class="pre">\PolDiff{f}{f'}</span></tt></dt>
+<dd>sets <tt class="docutils literal">f'</tt> to the derivative of <tt class="docutils literal">f</tt>. The name doesn't have to be
+<tt class="docutils literal">f'</tt> (in fact the <tt class="docutils literal">'</tt> is licit only since <tt class="docutils literal">0.5.1</tt>).</dd>
+</dl>
+<div class="admonition important">
+<p class="first admonition-title">Important</p>
+<p class="last">This is not done automatically. If some new definition needs to use
+the derivative of some available polynomial, that derivative
+polynomial must have been defined via <tt class="docutils literal">\PolDiff</tt>: something like
+<tt class="docutils literal"><span class="pre">T'(x)^2</span></tt> will not work without a prior <tt class="docutils literal"><span class="pre">\PolDiff{T}{T'}</span></tt>.</p>
+</div>
+<dl class="docutils">
+<dt><tt class="docutils literal"><span class="pre">\PolDiff{f}{f''}</span></tt></dt>
 <dd>obtains second derivative.</dd>
-<dt><tt class="docutils literal"><span class="pre">\PolDiff[3]{f}{d3f_dx3}</span></tt></dt>
-<dd>computes directly the third derivative. Its name does not have to be
-chosen so complicated <tt class="docutils literal">:)</tt>, but the right quote <tt class="docutils literal">'</tt> is not
-allowed in polynomial names (currently).</dd>
+<dt><tt class="docutils literal"><span class="pre">\PolDiff[3]{f}{f'''}</span></tt></dt>
+<dd>computes the third derivative.</dd>
 </dl>
 <pre class="literal-block">
 $f(z)   = \PolTypeset[z]{f}    $\newline
-$f'(z)  = \PolTypeset[z]{df_dx}$\newline
-$f''(z) = \PolTypeset[z]{f_xx}$\newline
-$f'''(z)= \PolTypeset[z]{d3f_dx3}$\par
+$f'(z)  = \PolTypeset[z]{f'}   $\newline
+$f''(z) = \PolTypeset[z]{f''}  $\newline
+$f'''(z)= \PolTypeset[z]{f'''} $\par
 </pre>
 <div class="admonition important">
 <p class="first admonition-title">Important</p>
@@ -644,16 +669,16 @@
 \PolEnsureIntervalLengths{f_1}{-10}%
 Here they are with ten digits after decimal mark:
 \PolPrintIntervals[W]{f_1}
-\PolDiff{f_1}{f_xx}
-\PolToSturm{f_xx}{f_xx}
-\PolSturmIsolateZeros{f_xx}
-The second derivative is \PolTypeset{f_xx}.
-It has \PolSturmNbOfIsolatedZeros{f_xx} distinct real
+\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_xx}
+\PolPrintIntervals[X]{f''}
 Here is the positive one with 20 digits after decimal mark:
-\PolEnsureIntervalLength{f_xx}{2}{-20}%
-\[X_2 = \PolSturmIsolatedZeroLeft{f_xx}{2}\dots\]
+\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>
@@ -813,8 +838,9 @@
 in a private structure accessible later via other package macros,
 under the user-chosen <tt class="docutils literal">polname</tt>. Of course the <em>expression</em> can
 use other previously defined polynomials. Names must start with a
-letter and are constituted of letters, digits and underscore
-characters. The whole <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> syntax is authorized:</p>
+letter and are constituted of letters, digits, underscores and
+(since <tt class="docutils literal">0.5.1</tt>) the right tick <tt class="docutils literal">'</tt>.
+The whole <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> syntax is authorized:</p>
 <pre class="literal-block">
 \poldef sin(z) := add((-1)^i z^(2i+1)/(2i+1)!, i = 0..10);
 </pre>
@@ -2107,17 +2133,25 @@
 an interval specification.</li>
 </ul>
 </li>
-<li>new non-expandable macros:<ul>
+<li>new non-expandable macro:<ul>
 <li><a class="reference internal" href="#polmakeprimitive">\PolMakePrimitive</a></li>
 </ul>
 </li>
-<li>new expandable macros:<ul>
+<li>new expandable macro:<ul>
 <li><a class="reference internal" href="#policontent">\PolIContent</a></li>
 </ul>
 </li>
 </ul>
 </li>
+<li><p class="first">v0.5.1 (2018/04/22)</p>
+<ul class="simple">
+<li>new feature:<ul>
+<li>the character <tt class="docutils literal">'</tt> can be used in polynomial names.</li>
 </ul>
+</li>
+</ul>
+</li>
+</ul>
 </div>
 <div class="section" id="acknowledgments">
 <h1><a class="toc-backref" href="#id130">Acknowledgments</a></h1>

Modified: trunk/Master/texmf-dist/doc/latex/polexpr/polexpr.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/polexpr/polexpr.txt	2018-04-30 17:03:06 UTC (rev 47508)
+++ trunk/Master/texmf-dist/doc/latex/polexpr/polexpr.txt	2018-04-30 17:03:34 UTC (rev 47509)
@@ -4,8 +4,8 @@
  Package polexpr documentation
 ===============================
 
-0.5 (2018/04/08)
-================
+0.5.1 (2018/04/22)
+==================
 
 .. contents::
 
@@ -16,10 +16,27 @@
 
     \poldef polname(x):= expression in variable x;
 
-where in place of ``x`` an arbitrary *dummy variable* is authorized
-(i.e. per default any of ``[a-z|A-Z]``; more letters can be declared
-under Unicode engines.) One can also issue::
+where:
 
+-  in place of ``x`` an arbitrary *dummy variable* is authorized,
+   i.e. per default any of ``[a-z|A-Z]`` (more letters can be declared
+   under Unicode engines.)
+
+- ``polname`` consists of letters, digits, and the ``_`` and
+  ``'`` characters. It must start with a letter.
+
+.. attention::
+
+   The ``'`` is authorized since ``0.5.1``. As a result some constructs
+   recognized by the ``\xintexpr`` parser, such as ``var1 'and' var2``
+   will get misinterpreted and cause errors. However these constructs
+   are unlikely to be frequently needed in polynomial expressions, and
+   the ``\xintexpr`` syntax offers alternatives, so it was deemed a
+   small evil. Of course the ``\xintexpr`` parser is modified only
+   temporarily during execution of ``\poldef``.
+
+One can also issue::
+
     \PolDef{polname}{expression in variable x}
 
 which admits an optional first argument to modify the variable letter
@@ -27,7 +44,8 @@
 
 ``\poldef f(x):= 1-x+x^2;``
     defines polynomial ``f``. Polynomial names must start with a
-    letter and may contain letters, digits, and underscores. The
+    letter and may contain letters, digits, underscores and the right
+    tick character. The
     variable must be a single letter. The colon character is optional.
     The semi-colon at end of expression is mandatory.
 
@@ -50,23 +68,29 @@
     should now define the zero polynomial... Let's check:
     ``\[ k(z) = \PolTypeset[z]{k} \]``
 
-``\PolDiff{f}{df_dx}``
-    sets ``df_dx`` to the derivative of ``f``.
+``\PolDiff{f}{f'}``
+    sets ``f'`` to the derivative of ``f``. The name doesn't have to be
+    ``f'`` (in fact the ``'`` is licit only since ``0.5.1``).
 
-``\PolDiff{df_dx}{f_xx}``
+.. important::
+
+   This is not done automatically. If some new definition needs to use
+   the derivative of some available polynomial, that derivative
+   polynomial must have been defined via ``\PolDiff``: something like
+   ``T'(x)^2`` will not work without a prior ``\PolDiff{T}{T'}``.
+
+``\PolDiff{f}{f''}``
     obtains second derivative.
 
-``\PolDiff[3]{f}{d3f_dx3}``
-    computes directly the third derivative. Its name does not have to be
-    chosen so complicated ``:)``, but the right quote ``'`` is not
-    allowed in polynomial names (currently).
+``\PolDiff[3]{f}{f'''}``
+    computes the third derivative.
 
 ::
 
   $f(z)   = \PolTypeset[z]{f}    $\newline
-  $f'(z)  = \PolTypeset[z]{df_dx}$\newline
-  $f''(z) = \PolTypeset[z]{f_xx}$\newline
-  $f'''(z)= \PolTypeset[z]{d3f_dx3}$\par
+  $f'(z)  = \PolTypeset[z]{f'}   $\newline
+  $f''(z) = \PolTypeset[z]{f''}  $\newline
+  $f'''(z)= \PolTypeset[z]{f'''} $\par
 
 .. important::
 
@@ -184,16 +208,16 @@
   \PolEnsureIntervalLengths{f_1}{-10}%
   Here they are with ten digits after decimal mark:
   \PolPrintIntervals[W]{f_1}
-  \PolDiff{f_1}{f_xx}
-  \PolToSturm{f_xx}{f_xx}
-  \PolSturmIsolateZeros{f_xx}
-  The second derivative is \PolTypeset{f_xx}.
-  It has \PolSturmNbOfIsolatedZeros{f_xx} distinct real
+  \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_xx}
+  \PolPrintIntervals[X]{f''}
   Here is the positive one with 20 digits after decimal mark:
-  \PolEnsureIntervalLength{f_xx}{2}{-20}%
-  \[X_2 = \PolSturmIsolatedZeroLeft{f_xx}{2}\dots\]
+  \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$!
 
@@ -367,8 +391,9 @@
     in a private structure accessible later via other package macros,
     under the user-chosen ``polname``. Of course the *expression* can
     use other previously defined polynomials. Names must start with a
-    letter and are constituted of letters, digits and underscore
-    characters. The whole xintexpr_ syntax is authorized::
+    letter and are constituted of letters, digits, underscores and
+    (since ``0.5.1``) the right tick ``'``.
+    The whole xintexpr_ syntax is authorized::
 
        \poldef sin(z) := add((-1)^i z^(2i+1)/(2i+1)!, i = 0..10);
 
@@ -1810,15 +1835,19 @@
       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:
+  * new non-expandable macro:
 
     - `\\PolMakePrimitive`_
-  * new expandable macros:
+  * new expandable macro:
 
     - `\\PolIContent`_
       
+- v0.5.1 (2018/04/22)
 
+  * new feature:
 
+    - the character ``'`` can be used in polynomial names.
+
 Acknowledgments
 ---------------
 

Modified: trunk/Master/texmf-dist/tex/latex/polexpr/polexpr.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/polexpr/polexpr.sty	2018-04-30 17:03:06 UTC (rev 47508)
+++ trunk/Master/texmf-dist/tex/latex/polexpr/polexpr.sty	2018-04-30 17:03:34 UTC (rev 47509)
@@ -1,12 +1,30 @@
 % author: Jean-François Burnol
 % License: LPPL 1.3c (author-maintained)
 \ProvidesPackage{polexpr}%
-  [2018/04/08 v0.5 Polynomial expressions with rational coefficients (JFB)]%
+  [2018/04/22 v0.5.1 Polynomial expressions with rational coefficients (JFB)]%
 \RequirePackage{xintexpr}[2018/03/01]% xint 1.3
 \edef\POL at restorecatcodes
-    {\catcode`\noexpand\_ \the\catcode`\_ \catcode0 \the\catcode0\relax}%
+    {\catcode`\noexpand\_ \the\catcode`\_ %
+     \catcode`\noexpand\! \the\catcode`\! %
+     \catcode0 \the\catcode0\relax}%
 \catcode`\_ 11 \catcode0 12
 
+%% PATCH xintexpr TO AUTHORIZE ' IN NAMES (0.5.1)
+\catcode`\! 11
+\def\POL at XINT_expr_scanfunc_b #1%
+{%
+  \ifx !#1\xint_dothis{(_}\fi
+  \ifcat \relax#1\xint_dothis{(_}\fi
+  \if (#1\xint_dothis{\xint_firstoftwo{(`}}\fi
+  \if '#1\xint_dothis \XINT_expr_scanfunc_a \fi
+  \if @#1\xint_dothis \XINT_expr_scanfunc_a \fi
+  \if _#1\xint_dothis \XINT_expr_scanfunc_a \fi
+  \ifnum \xint_c_ix<1\string#1 \xint_dothis \XINT_expr_scanfunc_a \fi
+  \ifcat a#1\xint_dothis \XINT_expr_scanfunc_a \fi
+  \xint_orthat {(_}%
+    #1%
+}%
+
 %% AUXILIARIES
 \newcount\POL at count
 \newif\ifPOL at pol
@@ -47,9 +65,12 @@
    \POL at restoresemicolon
    \edef\POL at tmp{\ifxintverbose1\else0\fi}%
    \unless\ifxintveryverbose\xintverbosefalse\fi
+   \let\POL at originalXINT_expr_scanfunc_b\XINT_expr_scanfunc_b
+   \let\XINT_expr_scanfunc_b\POL at XINT_expr_scanfunc_b
    \xintdeffunc __pol(#2):=0+(#4);% force conversion to raw if a constant
    \if1\POL at tmp\xintverbosetrue\fi
    \edef\POL at polname{\xint_zapspaces #1 \xint_gobble_i}%
+   \let\XINT_expr_scanfunc_b\POL at originalXINT_expr_scanfunc_b
    \begingroup
      \setbox0\hbox{%
      \let\xintScalarAdd\xintAdd



More information about the tex-live-commits mailing list