summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-04-12 20:04:33 +0000
committerKarl Berry <karl@freefriends.org>2021-04-12 20:04:33 +0000
commit1b46f20416a9e8cc55188c0b4ad13cc91ace5aed (patch)
treef9a5b51954f08f9b50c5cb634e6f748bb0a8b78a /Master/texmf-dist/tex/generic
parent0e064a27b10ac2dc27a364c969f8f52e5783c6c7 (diff)
polexpr (12apr21)
git-svn-id: svn://tug.org/texlive/trunk@58854 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r--Master/texmf-dist/tex/generic/polexpr/polexpr.sty29
-rw-r--r--Master/texmf-dist/tex/generic/polexpr/polexprcore.tex81
-rw-r--r--Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex12
-rw-r--r--Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex27
4 files changed, 81 insertions, 68 deletions
diff --git a/Master/texmf-dist/tex/generic/polexpr/polexpr.sty b/Master/texmf-dist/tex/generic/polexpr/polexpr.sty
index c94a4e8d61d..420f469cf12 100644
--- a/Master/texmf-dist/tex/generic/polexpr/polexpr.sty
+++ b/Master/texmf-dist/tex/generic/polexpr/polexpr.sty
@@ -2,7 +2,7 @@
% License: LPPL 1.3c (author-maintained)
% Usage: \input polexpr.sty (Plain or other macro formats)
% or \usepackage{polexpr} (LaTeX macro format)
-% polexpr.sty (this file) inputs:
+% Release 0.8.1 (2021/04/12) of polexpr.sty. This file inputs
% polexprcore.tex
% polexprexpr.tex
% polexprsturm.tex
@@ -43,7 +43,7 @@
% variable is initialized, but \ProvidesPackage not yet seen
\ifx\w\relax % xintexpr.sty not yet loaded.
\expandafter\def\expandafter\z\expandafter
- {\z\RequirePackage{xintexpr}[2021/02/20]}%
+ {\z\RequirePackage{xintexpr}[2021/03/29]}%
\fi
\else
\aftergroup\endinput % polexpr already loaded.
@@ -51,14 +51,14 @@
\fi
\fi
\z%
-\XINTsetupcatcodes%
+\XINTsetupcatcodes% (does \endlinechar13 in particular)
\XINT_providespackage
\ProvidesPackage{polexpr}%
- [2021/03/29 v0.8 Polynomial expressions with rational coefficients (JFB)]%
+ [2021/04/12 v0.8.1 Polynomial expressions with rational coefficients (JFB)]%
\begingroup
\def\x#1/#2/#3 #4\xint:{#1#2#3}%
\ifnum\expandafter\x\expanded{\csname ver@xintexpr.sty\endcsname}\xint:
- <20210220 % actually 20200131 (xint 1.4) is presumably ok
+ <20210329 %
\immediate\write128{! Package polexpr error: xintexpr too old, aborting input}%
\else\expandafter\xint_gobble_i
\fi
@@ -88,7 +88,7 @@
\def\next{\expandafter\endgroup\@tempb}\fi\fi\next
}%
% \polexprsetup added at 0.7
-\catcode`! 3
+\catcode`! 3 %
\def\polexprsetup#1{\POL@setup_parsekeys #1,=!,\xint_bye}%
\def\POL@setup_parsekeys #1=#2#3,{%
\ifx!#2\expandafter\xint_bye\fi
@@ -100,7 +100,7 @@
}%
\def\POL@setup_setkey_norr #1#2{\edef\POL@norr}%
\def\POL@setup_setkey_sqfnorr #1#2{\edef\POL@sqfnorr}%
-\polexprsetup{norr=_norr, sqfnorr=_sqf_norr}
+\polexprsetup{norr=_norr, sqfnorr=_sqf_norr}%
\catcode`! 11 % special catcode for ! as used in xintexpr.sty
%
\newif\ifxintveryverbose
@@ -332,7 +332,7 @@
\POL@defpolfunc{#1}{expr}%
\ifpolnewpolverbose\POL@info{#1}\fi
}%
-\def\PolGlobalLet#1#2{\begingroup\xintglobaldefstrue\PolLet{#1}{#2}\endgroup}
+\def\PolGlobalLet#1#2{\begingroup\xintglobaldefstrue\PolLet{#1}{#2}\endgroup}%
%
\def\PolAssign#1{\def\POL@polname{#1}\POL@assign}% zap spaces in #1?
\def\POL@assign#1\toarray#2{%
@@ -771,7 +771,7 @@
\else
\def\PolTypesetOne{\xintSignedFwOver}%
\fi
-\catcode`^ 7
+\catcode`^ 7 %
\def\PolTypesetMonomialCmd{%
\ifcase\PolIndex\space
%
@@ -906,11 +906,12 @@
\def\PolToCSV#1{\romannumeral0\xintlistwithsep{, }{\PolToList{#1}}}%
%
% \PolIContent (0.5)
-% Why did I call this IContent and not Content? Ah, I see Maple terminology
-% But I realize now I misread the Maple doc, its icontent() is the gcd of
-% all coeffs of a multivariate polynomial. Whereas content(,) second argument
-% specifies which variable to consider expression as being univariate in it
-%
+% Why did I call this IContent and not Content? Ah, I see, Maple terminology!
+% But I realize now I misread in 2018 the Maple doc, its icontent() is the gcd
+% of all coeffs of a multivariate polynomial. Whereas content(,) second argument
+% specifies which variable to consider expression as being univariate in it.
+% Refactored at 0.8 as xint 1.4 has a backported fractional gcd
+% (itself refactored at 1.4d)
\def\POL@icontent#1{\romannumeral0\expandafter\XINT_fgcd_out
\romannumeral0\expandafter\XINT_fgcdof\romannumeral`&&@#1^}%
% Since xintexpr 1.4d, \xintGCDof always outputs an irreducible fraction A/B.
diff --git a/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex b/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex
index e071729e42b..a5c93f0f467 100644
--- a/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex
+++ b/Master/texmf-dist/tex/generic/polexpr/polexprcore.tex
@@ -1,4 +1,4 @@
-%% This file polexprcore.tex is part of the polexpr package (0.8, 2021/03/29)
+%% This file polexprcore.tex is part of the polexpr package (0.8.1, 2021/04/12)
%% Core routines to match infix operators +, -, *, //, /:, ^, ** and some
%% functions
%% The atoms representing polynomials inside \xintexpr are
@@ -38,29 +38,13 @@
\POL_bBye #7\xint_Bye{#15{#7}}%
\POL_bBye #8\xint_Bye{#16{#8}}%
\POL_bBye #9\xint_Bye{#17{#9}}%
- \POL_apply:x_iloop_a#1%
+ \POL_apply:x_iloop_a #1%
}%
\def\POL_apply:x_iloop_a#1#2.%
{%
\expandafter\POL_apply:x_iloop
- \expandafter{\expandafter#1\the\numexpr\xint_c_viii+#1.}%
-}%
-\long\def\POL_apply:x_iloop #1#2#3#4#5#6#7#8#9%
-{%
- \POL_bBye #2\xint_Bye{#10{#2}}%
- \POL_bBye #3\xint_Bye{#11{#3}}%
- \POL_bBye #4\xint_Bye{#12{#4}}%
- \POL_bBye #5\xint_Bye{#13{#5}}%
- \POL_bBye #6\xint_Bye{#14{#6}}%
- \POL_bBye #7\xint_Bye{#15{#7}}%
- \POL_bBye #8\xint_Bye{#16{#8}}%
- \POL_bBye #9\xint_Bye{#17{#9}}%
- \POL_apply:x_iloop_a#1%
-}%
-\def\POL_apply:x_iloop_a#1#2.%
-{%
- \expandafter\POL_apply:x_iloop
- \expandafter{\expandafter#1\the\numexpr\xint_c_viii+#1.}%
+% arrgggh, 0.8 had +#1 in place of +#2... again I did not test enough
+ \expandafter{\expandafter#1\the\numexpr\xint_c_viii+#2.}%
}%
%%
%% ADDITION
@@ -694,7 +678,7 @@
}%
\def\POL_quorem_ERem_fix_a 0/1[0]#1.#2%
{%
- \ifcase #1
+ \ifcase #1 %
\or
\expandafter\xint_firstofone
\else
@@ -869,6 +853,11 @@
\xint:\xint:\xint:\xint:\xint_bye
\xint_bye
}%
+% 0.8.1 adds \xintPolLPol. Not much to do... as long as I don't worry about
+% empty input... (not motivated about this, there are other such places)
+\def\xintPolLPol#1{\romannumeral`&&@\expandafter\POL_add_d
+ \romannumeral`&&@#1\xint_bye
+}%
% attention to not overwrite macro names (there is a legacy \PolEvalAt)
\def\xintPolEvalAt#1#2%
{%
@@ -948,6 +937,22 @@
% annoying that we had to put this delimiter \xint:
\def\POL_coeffs_pol P#1.#2\xint:{#2}%
%
+\def\xintPolLCoeffs#1%
+{%
+ \romannumeral`&&@\expandafter\POL_lcoeffs_fork
+ \romannumeral`&&@#1\xint:\xint:\xint:\xint:%
+ \xint:\xint:\xint:\xint:\xint_bye
+}%
+\def\POL_lcoeffs_fork #1%
+{%
+ \POL_Pfork
+ #1\POL_lcoeffs_pol
+ P\POL_lcoeffs_cst
+ \krof #1%
+}%
+\def\POL_lcoeffs_cst #1\xint:#2\xint_bye{{#1}}%
+\def\POL_lcoeffs_pol P#1.{\XINT_revwbr_loop {}}%
+%
\def\xintPolCoeff#1#2%
{%
\romannumeral`&&@\expandafter\POL_coeff_fork
@@ -979,24 +984,24 @@
\def\POL_coeff_a#1{\expandafter\POL_coeff_b\romannumeral\xintgobble{#1}}%
\def\POL_coeff_b#1#2\xint:{#1}%
%
-\def\xintPolLCoeff#1%
+\def\xintPolLC#1%
{%
- \romannumeral`&&@\expandafter\POL_lcoeff_fork
+ \romannumeral`&&@\expandafter\POL_lc_fork
\romannumeral`&&@#1\xint:
}%
-\def\POL_lcoeff_fork #1%
+\def\POL_lc_fork #1%
{%
\POL_Pfork
- #1\POL_lcoeff_pol
- P\POL_lcoeff_cst
+ #1\POL_lc_pol
+ P\POL_lc_cst
\krof #1%
}%
-\def\POL_lcoeff_cst#1\xint:{#1}%
-\def\POL_lcoeff_pol P#1.%
+\def\POL_lc_cst#1\xint:{#1}%
+\def\POL_lc_pol P#1.%
{%
- \expandafter\POL_lcoeff_a\romannumeral\xintgobble{#1}%
+ \expandafter\POL_lc_a\romannumeral\xintgobble{#1}%
}%
-\def\POL_lcoeff_a#1\xint:{#1}%
+\def\POL_lc_a#1\xint:{#1}%
%
\def\xintPolMonicPart#1%
{%
@@ -1027,20 +1032,20 @@
\POL_apply:x_loop{\POL@DivByFirstAndIrrAndREZ{#1}}%
}%
%
-\def\xintPolIContent#1%
+\def\xintPolCont#1%
{%
- \romannumeral`&&@\expandafter\POL_icontent_fork
+ \romannumeral`&&@\expandafter\POL_cont_fork
\romannumeral`&&@#1^%
}%
-\def\POL_icontent_fork #1%
+\def\POL_cont_fork #1%
{%
\POL_Pfork
- #1\POL_icontent_pol
- P\POL_icontent_cst
+ #1\POL_cont_pol
+ P\POL_cont_cst
\krof #1%
}%
-\def\POL_icontent_cst #1^{\xintIrr{\xintAbs{#1}}[0]}%
-\def\POL_icontent_pol P#1.%
+\def\POL_cont_cst #1^{\xintIrr{\xintAbs{#1}}[0]}%
+\def\POL_cont_pol P#1.%
{%
% 1.4d xintfrac \XINT_fgcdof much saner than 1.4 version !
% \XINT_fgcd_out does \xintIrr
@@ -1211,7 +1216,7 @@
\def\POL_difftwo_cst#1\xint:{0/1[0]}%
\def\POL_difftwo_pol P#1.%
{%
- \ifcase #1
+ \ifcase #1 %
\or \expandafter\POL_difftwo_zeroout
\or \expandafter\POL_difftwo_cstout
\else\expandafter\POL_difftwo_polout
diff --git a/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex b/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex
index 9b60e7bab00..adb228a48b0 100644
--- a/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex
+++ b/Master/texmf-dist/tex/generic/polexpr/polexprexpr.tex
@@ -1,4 +1,4 @@
-%% This file polexprexpr.tex is part of the polexpr package (0.8, 2021/03/29)
+%% This file polexprexpr.tex is part of the polexpr package (0.8.1, 2021/04/12)
%% Extending \xintexpr syntax:
%%
%% 1. Authorize ' in variable and function names
@@ -72,7 +72,7 @@
\toks0\expandafter{\XINT_expr_redefinemacros}%
\toks2 {\let\POL:NEhook:polfunc\POL:NE:polfunc}%
\edef\XINT_expr_redefinemacros{\the\toks0 \the\toks2}%
-\catcode`~ 12
+\catcode`~ 12 %
\def\POL@defpolfunc #1#2%
{%
\expandafter\POL@defpolfunc_a
@@ -137,13 +137,17 @@
}%
}%
\POL_tmp {sqr} \XINT:NEhook:f:one:from:one \xintPolSqr
+% 0.8.1 renames 0.8.0 icontent() to cont() and lcoeff() to lc()
+% and adds topol() and lcoeffs()
\POL_tmp {pol} \XINT:NEhook:f:one:from:one \xintPolPol
+\POL_tmp {lpol} \XINT:NEhook:f:one:from:one \xintPolLPol
\POL_tmp {deg} \XINT:NEhook:f:one:from:one \xintPolDeg
\POL_tmp {coeffs} \XINT:NEhook:f:one:from:one \xintPolCoeffs
+\POL_tmp {lcoeffs} \XINT:NEhook:f:one:from:one \xintPolLCoeffs
\POL_tmp {coeff} \XINT:NEhook:f:one:from:two \xintPolCoeff
-\POL_tmp {lcoeff} \XINT:NEhook:f:one:from:one \xintPolLCoeff
+\POL_tmp {lc} \XINT:NEhook:f:one:from:one \xintPolLC
\POL_tmp {monicpart} \XINT:NEhook:f:one:from:one \xintPolMonicPart
-\POL_tmp {icontent} \XINT:NEhook:f:one:from:one \xintPolIContent
+\POL_tmp {cont} \XINT:NEhook:f:one:from:one \xintPolCont
\POL_tmp {primpart} \XINT:NEhook:f:one:from:one \xintPolPrimPart
\POL_tmp {rdcoeffs} \XINT:NEhook:f:one:from:one \xintPolRedCoeffs
\POL_tmp {rdzcoeffs} \XINT:NEhook:f:one:from:one \xintPolSRedCoeffs
diff --git a/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex b/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex
index 3fa1861558d..c21980830cd 100644
--- a/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex
+++ b/Master/texmf-dist/tex/generic/polexpr/polexprsturm.tex
@@ -1,4 +1,4 @@
-%% This file polexprsturm.tex is part of the polexpr package (0.8, 2021/03/29)
+%% This file polexprsturm.tex is part of the polexpr package (0.8.1, 2021/04/12)
%% Sturm Algorithm (polexpr 0.4)
%% 0.5 uses primitive polynomials for faster evaluations afterwards
%% 0.6 corrects misuse of \@ifstar! (mumble). \PolToSturm* was broken.
@@ -232,7 +232,7 @@
\let\POL@findrat@nbofirrroots\POL@isolz@NbOfRoots
% find all rational roots, and their multiplicities,
% factor them out in passing from original (Sturm root) polynomial
- \ifnum\POL@findrat@E<7
+ \ifnum\POL@findrat@E<7 %
\def\POL@findrat@index{1}%
\POL@findrat@loop@secondpass@direct
\else
@@ -332,7 +332,7 @@
\edef\POL@findrat@halflocalW{\the\numexpr(\POL@findrat@localW+1)/2-1}%
% Legendre Theorem will be used now but we separate a branch where
% everything can be done with \numexpr
- \ifnum\POL@findrat@localW>9
+ \ifnum\POL@findrat@localW>9 %
% not implemented yet by lazyness!
% this root will be handled in second pass only
\else
@@ -1297,7 +1297,7 @@
\ifnum\POL@IsoRightSign=\z@
\expandafter\xintbreakiloop
\fi
- \ifnum\xintiloopindex<#1
+ \ifnum\xintiloopindex<#1 %
\repeat
}%
\def\POL@refine@main{%
@@ -1434,8 +1434,8 @@
}%
%
%% \PolPrintIntervals
-\catcode`_ 8
-\catcode`& 4
+\catcode`_ 8 %
+\catcode`& 4 %
\def\PolPrintIntervals{\POL@ifstar{\PolPrintIntervals@@}{\PolPrintIntervals@}}%
% As explained in the docs, this is an example of customization so is not
% itself customizable, apart from redefining it entirely!
@@ -1555,8 +1555,8 @@
{\PolPrintIntervalsTheVar_{\PolPrintIntervalsTheIndex}=%
\PolPrintIntervalsPrintLeftEndPoint\dots}}%
}%
-\catcode`& 7
-\catcode`_ 11
+\catcode`& 7 %
+\catcode`_ 11 %
\def\POL@PrintIntervals@Loop#1{%
\def\POL@PrintIntervals@Loop{%
\POL@SturmIfZeroExactlyKnown\PolPrintIntervalsTheSturmName
@@ -1672,12 +1672,15 @@
}%
%
\def\POL@leq@fork#1\LessThanOrEqualTo#2#3\krof{#2}%
-\def\PolSturmNbOfRootsOf#1#2#3{\romannumeral`&&@\POL@leq@fork
+\def\PolSturmNbOfRootsOf#1#2#3{%
+ \romannumeral`&&@\POL@leq@fork
#2\PolNbOfRootsLessThanOrEqualTo
- \LessThanOrEqualTo\PolNbOfRootsLessThanOrEqualToExpr\krof {#1}{#3}%
+ \LessThanOrEqualTo\PolNbOfRootsLessThanOrEqualToExpr
+ \krof {#1}{#3}%
+}%
+\def\PolNbOfRootsLessThanOrEqualToExpr#1#2{%
+ \PolNbOfRootsLessThanOrEqualTo{#1}{\xinttheexpr#2\relax}%
}%
-\def\PolNbOfRootsLessThanOrEqualToExpr#1#2
- {\PolNbOfRootsLessThanOrEqualTo{#1}{\xinttheexpr#2\relax}}%
\def\PolNbOfRootsLessThanOrEqualTo#1{%
\ifnum\PolSturmNbOfIsolatedZeros{#1}=\z@
\expandafter\xint_firstofthree\expandafter0%