From f6a51c75352a2ec3f36f78893ab07879ea22bf77 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 9 Apr 2018 21:18:59 +0000 Subject: polexpr (9apr18) git-svn-id: svn://tug.org/texlive/trunk@47412 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/polexpr/README.md | 14 +- Master/texmf-dist/doc/latex/polexpr/polexpr.html | 347 ++++++++++++++--------- Master/texmf-dist/doc/latex/polexpr/polexpr.txt | 167 ++++++++--- 3 files changed, 351 insertions(+), 177 deletions(-) (limited to 'Master/texmf-dist/doc') 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 {

Package polexpr documentation

-

0.4.2 (2018/03/03)

+

0.5 (2018/04/08)

@@ -422,64 +422,66 @@ ul.auto-toc {
  • \PolReduceCoeffs{polname}
  • \PolReduceCoeffs*{polname}
  • \PolMakeMonic{polname}
  • +
  • \PolMakePrimitive{polname}
  • -
  • Expandable macros
  • @@ -580,7 +582,14 @@ PSTricks-compatible; the letter used in output can be

    Examples of localization of roots

    -

    First some remarks about auxiliaries.

    +
    +

    Attention!

    +

    At 0.5, \PolToSturm{P}{S} 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:

      @@ -597,9 +606,10 @@ that one can also do:

      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...

    @@ -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}<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: @@ -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 < 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:

    @@ -746,10 +762,24 @@ x^41
     

    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

    @@ -878,19 +908,22 @@ indices act the same in both.)

    \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:

     \xintAssignArray{1}{-2}{5}{-3}\to\foo
     \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.)

    +

    This will define f as would have \poldef f(x):=1-2x+5x^2-3x^3;.

    +
    +

    Note

    +

    Prior to 0.5, coefficients were not normalized via +\xintRaw for internal storage.

    +
    @@ -900,15 +933,19 @@ they were not subjected to \xintRaw 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 \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:

     \PolFromCSV{f}{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
     

    defines the zero polynomial, which has only one (zero) coefficient.

    See also expandable macro \PolToCSV.

    +
    +

    Note

    +

    Prior to 0.5, coefficients were not normalized via +\xintRaw for internal storage.

    +
    @@ -1071,13 +1108,19 @@ polynomial.

    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).

    -

    Thus S_0 now has exactly the same real and complex -roots as polynomial polname, but each with multiplicity one.

    +dividing all S_k's with S_N (which then becomes 1).

    +

    Thus S_0 has exactly the same real and complex roots as +polynomial polname, but each root being now with multiplicity one.

    @@ -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.
    +
    +

    \PolMakePrimitive{polname}

    +
    +Divides by the integer content see (\PolIContent). This thus produces a polynomial with integer +coefficients having no common factor. The sign of the leading +coefficient is not modified.
    +
    -

    Expandable macros

    +

    Expandable macros

    All these macros expand completely in two steps except \PolToExpr and \PolToFloatExpr (and their auxiliaries) which need a \write, \edef or a \csname...\endcsname context.

    -

    \PolEval{polname}\AtExpr{numerical expression}

    +

    \PolEval{polname}\AtExpr{numerical expression}

    It boils down to \xinttheexpr polname(numerical expression)\relax.
    -

    \PolEval{polname}\At{fraction}

    +

    \PolEval{polname}\At{fraction}

    Evaluates the polynomial at value fraction which must be in (or expand to) a format acceptable to the xintfrac macros.

    @@ -1379,12 +1429,12 @@ e.g. the variables as defined by -

    \PolEvalReduced{polname}\AtExpr{numerical expression}

    +

    \PolEvalReduced{polname}\AtExpr{numerical expression}

    Boils down to \xinttheexpr reduce(polname(numerical expression))\relax.
    -

    \PolEvalReduced{polname}\At{fraction}

    +

    \PolEvalReduced{polname}\At{fraction}

    Evaluates the polynomial at value fraction which must be in (or expand to) a format acceptable to the xintfrac macros, and produce @@ -1397,7 +1447,7 @@ could be given as an expression.

    -

    \PolFloatEval{polname}\AtExpr{numerical expression}

    +

    \PolFloatEval{polname}\AtExpr{numerical expression}

    Boils down to \xintthefloatexpr polname(numerical expression)\relax.

    This is done via a Horner Scheme (see \poldef and @@ -1435,7 +1485,7 @@ nested expressions.

    -

    \PolFloatEval{polname}\At{fraction}

    +

    \PolFloatEval{polname}\At{fraction}

    Evaluates the polynomial at value fraction which must be in (or expand to) a format acceptable to the xintfrac macros, and produces @@ -1448,7 +1498,7 @@ could be given as an expression.

    -

    \PolIfCoeffIsPlusOrMinusOne{A}{B}

    +

    \PolIfCoeffIsPlusOrMinusOne{A}{B}

    This macro is a priori undefined.

    It is defined via the default \PolTypesetCmd{raw_coeff} to be @@ -1460,25 +1510,34 @@ plus or minus one, and B if not.

    -

    \PolLeadingCoeff{polname}

    +

    \PolLeadingCoeff{polname}

    Expands to the leading coefficient.
    -

    \PolNthCoeff{polname}{number}

    +

    \PolNthCoeff{polname}{number}

    It expands to the raw N-th coefficient (0/1[0] if the index number is out of range). With N=-1, -2, ... expands to the leading coefficients.
    -

    \PolDegree{polname}

    +

    \PolDegree{polname}

    It expands to the degree. This is -1 if zero polynomial but this may change in future. Should it then expand to -\infty ?
    +
    +

    \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.

    +
    +
    -

    \PolToExpr{polname}

    +

    \PolToExpr{polname}

    Expands [4] to coeff_N*x^N+... (descending powers.)

    @@ -1503,7 +1562,7 @@ of \PolToExpr{f}, but a simple -

    \PolToExprOneTerm{raw_coeff}{number}

    +

    \PolToExprOneTerm{raw_coeff}{number}

    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 \PolToE

    -

    \PolToExprOneTermStyleB{raw_coeff}{number}

    +

    \PolToExprOneTermStyleB{raw_coeff}{number}

    For output in this style:

    @@ -1536,7 +1595,7 @@ To revert to package default, issue
     
    -

    \PolToExprCmd{raw_coeff}

    +

    \PolToExprCmd{raw_coeff}

    It is the one-argument macro used by the package definition of \PolToExprOneTerm for the coefficients themselves (when not @@ -1546,21 +1605,21 @@ to \xintIrr{#1} or to output forcefully reduced coefficients.
    -

    \PolToExprTermPrefix{raw_coeff}

    +

    \PolToExprTermPrefix{raw_coeff}

    Defined identically as \PolTypesetCmdPrefix{raw_coeff}. It prefixes with a plus sign for non-negative coefficients, because they don't carry one by themselves.
    -

    \PolToExprVar

    +

    \PolToExprVar

    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 x.
    -

    \PolToExprTimes

    +

    \PolToExprTimes

    This expands to the symbol used for multiplication of an x^{number} by the corresponding coefficient. The default is @@ -1570,13 +1629,13 @@ algebra software).
    -

    \PolToExpr*{polname}

    +

    \PolToExpr*{polname}

    Expands to coeff_0+coeff_1*x+coeff_2*x^2+... (ascending powers). Customizable like \PolToExpr{polname} via the same macros.
    -

    \PolToFloatExpr{polname}

    +

    \PolToFloatExpr{polname}

    Similar to \PolToExpr{polname} but uses \PolToFloatExprCmd which by default rounds and converts the coefficients to floating @@ -1595,13 +1654,13 @@ those output by \PolToFloatExpr{polname}.

    -

    \PolToFloatExprOneTerm{raw_coeff}{number}

    +

    \PolToFloatExprOneTerm{raw_coeff}{number}

    Similar to \PolToExprOneTerm. But does not treat especially coefficients equal to plus or minus one.
    -

    \PolToFloatExprCmd{raw_coeff}

    +

    \PolToFloatExprCmd{raw_coeff}

    It is the one-argument macro used by \PolToFloatExprOneTerm. Its package definition is \xintFloat{#1}.

    @@ -1624,25 +1683,25 @@ in xintfrac raw format.

    -

    \PolToFloatExpr*{polname}

    +

    \PolToFloatExpr*{polname}

    Typesets in ascending powers.
    -

    \PolToList{polname}

    +

    \PolToList{polname}

    Expands to {coeff_0}{coeff_1}...{coeff_N} with N = degree (except zero polynomial which does give {0/1[0]} and not an empty output.)
    -

    \PolToCSV{polname}

    +

    \PolToCSV{polname}

    Expands to coeff_0, coeff_1, coeff_2, ....., coeff_N. Converse to \PolFromCSV.
    -

    \PolSturmChainLength{sturmname}

    +

    \PolSturmChainLength{sturmname}

    Returns the integer N such that sturmname_N is the last one in the Sturm chain sturmname_0, sturmname_1, ...

    @@ -1650,7 +1709,7 @@ in the Sturm chain sturmname_0, -

    \PolSturmIfZeroExactlyKnown{sturmname}{index}{A}{B}

    +

    \PolSturmIfZeroExactlyKnown{sturmname}{index}{A}{B}

    Executes A if the indexth interval reduces to a singleton, i.e. the root is known exactly, else B.

    @@ -1667,21 +1726,21 @@ error message (right before everything goes haywire).

    -

    \PolSturmIsolatedZeroLeft{sturmname}{index}

    +

    \PolSturmIsolatedZeroLeft{sturmname}{index}

    Expands to the left end-point for the indexth interval obtained via \PolSturmIsolateZeros{sturmname} and possibly refined afterwards.
    -

    \PolSturmIsolatedZeroRight{sturmname}{index}

    +

    \PolSturmIsolatedZeroRight{sturmname}{index}

    Expands to the right end-point for the indexth interval obtained via \PolSturmIsolateZeros{sturmname} and possibly refined afterwards.
    -

    \PolSturmNbOfIsolatedZeros{sturmname}

    +

    \PolSturmNbOfIsolatedZeros{sturmname}

    Expands to the number of real roots of the polynomial <sturmname>_0 (which is the number of distinct real roots of the @@ -1689,17 +1748,17 @@ polynomial used to create the Sturm chain via \PolToSturm{polname}{sturmname}.
    -

    \PolIntervalWidth{sturmname}{index}

    +

    \PolIntervalWidth{sturmname}{index}

    The 10^E width of the current indexth root localization interval. Output is in xintfrac raw 1/1[E] format (if not zero).
    -

    Macros for use within execution of \PolPrintIntervals

    +

    Macros for use within execution of \PolPrintIntervals

    More precisely, they can be used within the replacement texts of the \PolPrintIntervalsPrintLeftEndPoint, etc, macros.

    -

    \PolPrintIntervalsTheEndPoint

    +

    \PolPrintIntervalsTheEndPoint

    Within a custom \PolPrintIntervalsPrintLeftEndPoint, custom \PolPrintIntervalsPrintRightEndPoint, or custom @@ -1708,7 +1767,7 @@ or right end point of the considered interval. Serves as default replacement for \PolPrintIntervalsPrintLeftEndPoint , etc...
    -

    \PolIfEndPointIsZero{A}{B}

    +

    \PolIfEndPointIsZero{A}{B}

    Within a custom \PolPrintIntervalsPrintLeftEndPoint, custom \PolPrintIntervalsPrintRightEndPoint, or custom @@ -1744,7 +1803,7 @@ the considered interval end-point is zero, else B
    -

    \PolDecToString{decimal number}

    +

    \PolDecToString{decimal number}

    This is a utility macro to print decimal numbers. It has been backported to xintfrac (release 1.3 of 2018/03/01) under @@ -1761,9 +1820,9 @@ zeroes, one can use \PolDecToStri

    -

    Booleans (with default setting as indicated)

    +

    Booleans (with default setting as indicated)

    -

    \xintverbosefalse

    +

    \xintverbosefalse

    This is actually an xintexpr configuration. Setting it to true triggers the writing of information to the log when new @@ -1776,20 +1835,20 @@ unstable and undocumented internal structures.

    -

    \poltypesetallfalse

    +

    \poltypesetallfalse

    If true, \PolTypeset{polname} will also typeset the vanishing coefficients.
    -

    \poltoexprallfalse

    +

    \poltoexprallfalse

    If true, \PolToExpr{polname} and \PolToFloatExpr{polname} will also include the vanishing coefficients in their outputs.
    -

    Technicalities

    +

    Technicalities

    • The catcode of the semi-colon is reset temporarily by \poldef 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 power of ten part \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 @@ -1857,7 +1905,7 @@ documented and unstable. Don't use them.

    -

    CHANGE LOG

    +

    CHANGE LOG

    -

    Acknowledgments

    +

    Acknowledgments

    Thanks to Jürgen Gilg whose question about xint 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} `_ 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}`_. + .. 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 + `_). 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 `_. + .. _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}{\}`_, 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 `_ + 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 --------------- -- cgit v1.2.3