summaryrefslogtreecommitdiff
path: root/macros/generic/polexpr/polexprcore.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/generic/polexpr/polexprcore.tex')
-rw-r--r--macros/generic/polexpr/polexprcore.tex81
1 files changed, 43 insertions, 38 deletions
diff --git a/macros/generic/polexpr/polexprcore.tex b/macros/generic/polexpr/polexprcore.tex
index e071729e42..a5c93f0f46 100644
--- a/macros/generic/polexpr/polexprcore.tex
+++ b/macros/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