From dacf576055f59aefcd2c687d90bc7145338738b9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 30 Apr 2018 17:03:34 +0000 Subject: polexpr (23apr18) git-svn-id: svn://tug.org/texlive/trunk@47509 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/polexpr/README.md | 11 ++- Master/texmf-dist/doc/latex/polexpr/polexpr.html | 88 ++++++++++++++++-------- Master/texmf-dist/doc/latex/polexpr/polexpr.txt | 85 +++++++++++++++-------- Master/texmf-dist/tex/latex/polexpr/polexpr.sty | 25 ++++++- 4 files changed, 145 insertions(+), 64 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/polexpr/README.md b/Master/texmf-dist/doc/latex/polexpr/README.md index e0508c86d3e..be224aa4af4 100644 --- a/Master/texmf-dist/doc/latex/polexpr/README.md +++ b/Master/texmf-dist/doc/latex/polexpr/README.md @@ -67,16 +67,13 @@ Releases 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), diff --git a/Master/texmf-dist/doc/latex/polexpr/polexpr.html b/Master/texmf-dist/doc/latex/polexpr/polexpr.html index 8eeb33a3811..ce67c863193 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 {

Package polexpr documentation

-

0.5 (2018/04/08)

+

0.5.1 (2018/04/22)

@@ -490,9 +490,25 @@ ul.auto-toc {
 \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}
 
@@ -501,7 +517,8 @@ from its default x.

\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.
\PolDef{f}{1-x+x^2}
@@ -518,20 +535,28 @@ some non-standard catcode by some package.
\poldef k(z):= f(z)-g(g(z)^2)^2;
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{df_dx}{f_xx}
+
\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).
+
+
+

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

@@ -644,16 +669,16 @@ roots: \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$! @@ -813,8 +838,9 @@ a general interval.

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);
 
@@ -2107,16 +2133,24 @@ as roots for usage). It will presumably be replaced in future by an interval specification. -
  • new non-expandable macros:
      +
    • new non-expandable macro:
    • -
    • new expandable macros:
    • +
    • v0.5.1 (2018/04/22)

      +
        +
      • new feature:
          +
        • the character ' can be used in polynomial names.
        • +
        +
      • +
      +
  • diff --git a/Master/texmf-dist/doc/latex/polexpr/polexpr.txt b/Master/texmf-dist/doc/latex/polexpr/polexpr.txt index dd2ab246900..7b792ed8ca0 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.5 (2018/04/08) -================ +0.5.1 (2018/04/22) +================== .. contents:: @@ -16,9 +16,26 @@ The syntax is:: \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} @@ -27,7 +44,8 @@ from its default ``x``. ``\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 @@ from its default ``x``. 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 @@ was no further reduction. \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 @@ Non-expandable macros 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,14 +1835,18 @@ CHANGE LOG 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 --------------- diff --git a/Master/texmf-dist/tex/latex/polexpr/polexpr.sty b/Master/texmf-dist/tex/latex/polexpr/polexpr.sty index 02d3ecdec76..e5e2acd6922 100644 --- a/Master/texmf-dist/tex/latex/polexpr/polexpr.sty +++ b/Master/texmf-dist/tex/latex/polexpr/polexpr.sty @@ -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@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@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@count \newif\ifPOL@pol @@ -47,9 +65,12 @@ \POL@restoresemicolon \edef\POL@tmp{\ifxintverbose1\else0\fi}% \unless\ifxintveryverbose\xintverbosefalse\fi + \let\POL@originalXINT_expr_scanfunc_b\XINT_expr_scanfunc_b + \let\XINT_expr_scanfunc_b\POL@XINT_expr_scanfunc_b \xintdeffunc __pol(#2):=0+(#4);% force conversion to raw if a constant \if1\POL@tmp\xintverbosetrue\fi \edef\POL@polname{\xint_zapspaces #1 \xint_gobble_i}% + \let\XINT_expr_scanfunc_b\POL@originalXINT_expr_scanfunc_b \begingroup \setbox0\hbox{% \let\xintScalarAdd\xintAdd -- cgit v1.2.3