From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 2 Sep 2019 13:46:59 +0900
Subject: Initial commit

---
 macros/latex/contrib/polynom/polydemo.tex | 107 ++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 macros/latex/contrib/polynom/polydemo.tex

(limited to 'macros/latex/contrib/polynom/polydemo.tex')

diff --git a/macros/latex/contrib/polynom/polydemo.tex b/macros/latex/contrib/polynom/polydemo.tex
new file mode 100644
index 0000000000..972fc768c7
--- /dev/null
+++ b/macros/latex/contrib/polynom/polydemo.tex
@@ -0,0 +1,107 @@
+%
+% This file is copyright 2004 Carsten Heinz.
+%
+% This file may be distributed and/or modified under the conditions
+% of the LaTeX Project Public License, either version 1.3 of this
+% license or (at your option) any later version.
+% The latest version of this license is in
+%   http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+\documentclass[12pt]{article}
+\pagestyle{empty}
+
+\usepackage{geometry,hyperref,color,polynom}
+\geometry{screen}
+\hypersetup{pdfpagemode=FullScreen}
+
+%%%%%%%%%%%%%
+%
+% \tokentotext<csname>{<tokens>}
+% converts token sequence into a \texttt-printable form.
+%
+%%%%%%%%%%%%%
+\makeatletter % We'll use three internal LaTeX definitions
+\newcommand\tokentotext[2]{%
+    \def#1{#2}%
+    \edef#1{\expandafter\strip@prefix\meaning#1}%
+    \edef#1{\expandafter\zap@space#1 \@empty}}
+\makeatother
+
+
+\newcounter{currentstage}
+%%%%%%%%%%%%%
+%
+% \dopolylongdiv{<page title>}{<loop min>}{<loop max>}{<key=value list for \polyset>}
+%
+%%%%%%%%%%%%%
+\newcommand\dopolylongdiv[4]{%
+  \begingroup
+    \tokentotext\keyvaluetext{#4}%
+    \polyset{#4}%
+    \setcounter{currentstage}{#2}\addtocounter{currentstage}{-1}%
+    %
+    \loop \ifnum \value{currentstage}<#3\relax
+        \addtocounter{currentstage}{1}%
+        \newpage
+        \section*{\strut#1}\section*{\strut\texttt{\keyvaluetext}}%
+        \[\polylongdiv[stage=\value{currentstage}]{x^3+x^2-1}{x+2}\]
+    \repeat
+  \endgroup}
+%%%%%%%%%%%%%
+%
+% \dopolyhornerscheme{<page title>}{<loop min>}{<loop max>}{<key=value list for \polyset>}
+%
+%%%%%%%%%%%%%
+\newcommand\dopolyhornerscheme[4]{% similar to \dopolylongdiv
+  \begingroup
+    \tokentotext\keyvaluetext{#4}%
+    \polyset{#4}%
+    \setcounter{currentstage}{#2}\addtocounter{currentstage}{-1}%
+    %
+    \loop \ifnum \value{currentstage}<#3\relax
+        \addtocounter{currentstage}{1}%
+        \newpage
+        \section*{\strut#1}\section*{\strut\texttt{\keyvaluetext}}%
+        \[\polyhornerscheme[x=-2,stage=\value{currentstage}]{x^3+x^2-1}\]
+    \repeat
+  \endgroup}
+
+%%%%%%%%%%%%%
+%
+% T H E   D O C U M E N T
+%
+%%%%%%%%%%%%%
+\begin{document}
+
+\LARGE
+
+\dopolylongdiv{Polynomial long division -- Stages 1 to 10}{1}{10}
+              {}
+
+\dopolylongdiv{Polynomial long division -- Stages 1 to 11}{1}{11}
+              {style=B}
+
+\dopolylongdiv{Polynomial long division -- Stages 1 to 11}{1}{11}
+              {style=C}
+
+\dopolylongdiv{Polynomial long division -- Stages 1 to 11}{1}{11}
+              {style=D}
+
+\dopolyhornerscheme{Horner's scheme -- Stages 1 to 8}{1}{8}
+                   {}
+
+\dopolyhornerscheme{Horner's scheme -- Stages 1 to 8}{1}{8}
+                   {tutor=true,resultstyle=\color{blue}}
+
+\dopolyhornerscheme{Horner's scheme -- Rule the result}{8}{8}
+                   {resultbottomrule,resultleftrule,resultrightrule}
+
+\dopolyhornerscheme{Horner's scheme -- Stages 1 to 8}{1}{8}
+                   {tutor=true,tutorlimit=3}
+
+\dopolyhornerscheme{Horner's scheme: Some more options}{8}{8}
+                   {showbase=top,showbasesep=false}
+
+\end{document}
-- 
cgit v1.2.3

