From 2fe97cec533b012f5030d9674055e5ef35b77e38 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 8 Jan 2017 22:20:53 +0000 Subject: xlop (8jan17) git-svn-id: svn://tug.org/texlive/trunk@42899 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/xlop/LISEZMOI | 7 ++- Master/texmf-dist/doc/generic/xlop/README | 3 +- Master/texmf-dist/doc/generic/xlop/xlop-doc-fr.pdf | Bin 340255 -> 346691 bytes Master/texmf-dist/doc/generic/xlop/xlop-doc-fr.tex | 42 ++++++++++++++++ Master/texmf-dist/doc/generic/xlop/xlop-doc.pdf | Bin 321396 -> 328002 bytes Master/texmf-dist/doc/generic/xlop/xlop-doc.tex | 56 ++++++++++++++++++--- 6 files changed, 95 insertions(+), 13 deletions(-) (limited to 'Master/texmf-dist/doc/generic/xlop') diff --git a/Master/texmf-dist/doc/generic/xlop/LISEZMOI b/Master/texmf-dist/doc/generic/xlop/LISEZMOI index e8dbdc9449c..dac91214966 100644 --- a/Master/texmf-dist/doc/generic/xlop/LISEZMOI +++ b/Master/texmf-dist/doc/generic/xlop/LISEZMOI @@ -8,8 +8,8 @@ manipuler des nombres de taille quelconque, la seule limitation la mémoire de TeX. Ces manipulations incluent toutes les opérations usuelles, les entrées-sorties, la notion de variable numérique, les tests et quelques opérations de haut niveau (sans permettre les -opérations nécessitant un traitement infini telles que la racine -carrée, l'exponentielle, les fonctions trigonométriques, etc.). +opérations nécessitant un traitement infini telles l'exponentielle, +les fonctions trigonométriques, etc.). DISTRIBUTION ------------ @@ -21,8 +21,7 @@ Contenu ------- La distribution comporte les fichiers suivants : - LISEZ.MOI (celui que vous êtes en train de lire) ; - - README (la même en anglais) ; - - XLOP03 qui indique ce que devrait fournir la version prochaine ; + - README (le même en anglais) ; - history.txt qui retrace l'historique rapide du projet ; - manual.sty qui est le fichier de style nécessaire à la compilation des fichiers de documentation ; diff --git a/Master/texmf-dist/doc/generic/xlop/README b/Master/texmf-dist/doc/generic/xlop/README index ea198b986ca..ca05f549833 100644 --- a/Master/texmf-dist/doc/generic/xlop/README +++ b/Master/texmf-dist/doc/generic/xlop/README @@ -6,7 +6,7 @@ operands. Second, xlop is able to deal with unlimited numbers, in fact, limitations are due to TeX memory. This features include basic arithmetic operations, input/ouput, numeric variables, tests, and some high level operation (without operations which imply infinite -processing such roots, exponential, trigonometric functions, etc.). +processing such exponential, trigonometric functions, etc.). DISTRIBUTION ------------ @@ -19,7 +19,6 @@ Contents Distribution consists of files: * README (the file you are reading) * LISEZ.MOI (same in french) - * XLOP03 indicates what features the next version should be provide * history.txt relates project history * manual.sty package file to compile documentation * xlop-doc-fr.tex and xlop-doc-fr.pdf source and pdf of french user's diff --git a/Master/texmf-dist/doc/generic/xlop/xlop-doc-fr.pdf b/Master/texmf-dist/doc/generic/xlop/xlop-doc-fr.pdf index bf995e2639a..04743ca0a2f 100644 Binary files a/Master/texmf-dist/doc/generic/xlop/xlop-doc-fr.pdf and b/Master/texmf-dist/doc/generic/xlop/xlop-doc-fr.pdf differ diff --git a/Master/texmf-dist/doc/generic/xlop/xlop-doc-fr.tex b/Master/texmf-dist/doc/generic/xlop/xlop-doc-fr.tex index 037aeb4c8f6..060cde198b5 100644 --- a/Master/texmf-dist/doc/generic/xlop/xlop-doc-fr.tex +++ b/Master/texmf-dist/doc/generic/xlop/xlop-doc-fr.tex @@ -1461,6 +1461,43 @@ de ces trois macros. \end{tabular} \end{center} +\index{racine carrée} +Avec la version~0.26, \package{xlop} propose l'opération de racine +carrée \macro{opsqrt}. Cette macro n'a pas la même syntaxe que les +autres macros arithmétiques puisqu'il n'y a pas de forme étoilée. En +réalité, il y a bien une façon d'afficher l'opération d'extraction de +racine carrée mais elle n'est pas franchement courante. Je suis +relativement âgé et mon grand-père me racontait qu'il l'avait vue +lorsqu'il était à l'école. Ainsi, il y a une macro \macro{opgfsqrt} où +le \og gf \fg{} est pour \og grandfather \fg{} (grand-père). + +Voyons la première macro : celle qui calcule la racine carrée et qui +stocke le résultat dans une variable \package{xlop}: +\begin{SideBySideExample} + \opsqrt{2}{sqrt2} + $\sqrt{2}\approx\opprint{sqrt2}$ +\end{SideBySideExample} +Cette macro partage le paramètre \parameter{maxdivstep} avec les +macros de division. Par exemple: +\begin{SideBySideExample} + \opsqrt[maxdivstep=15]{2}{sqrt2} + $\sqrt{2}\approx\opprint{sqrt2}$ +\end{SideBySideExample} + +Pour la présentation à la \og grand-père \fg{}, je n'ai vraiment pas +le courage d'expliquer tout le processus. Il se base sur l'eidentioté +remarquable $(a+b)^2=a^2+2ab+b^2$. Merci à Jean-Michel Sarlat d'avoir +pris le temps de m'expliquer cette méthode afin que je puisse la coder +dans \package{xlop}. + +Voici un exemple avec le calcul de la racine carrée de 15 : +\begin{CenterExample} + \opgfsqrt[maxdivstep=5]{15} +\end{CenterExample} +Cette méthode est horrible, autant pour un humain que pour +l'ordinateur. Par exemple, l'opération réellement effectuée par +\package{xlop} se fonde sur la méthode de Héron. + \index{expression complexe|(} La dernière macro qui nous reste à voir est \macro{opexpr} qui permet de réaliser le calcul d'une expression complexe. Cette macro demande @@ -1737,6 +1774,9 @@ ce Construit le nombre \verb+N+ avec le seul chiffre situé en \verb+T+ième position de la partie entière du nombre \verb+n+. \\\hline + \verb+\opgfsqrt{n}+ & + Affiche la façon ancienne d'afficher le calcul de la racine + carrée de \verb+n+. \\\hline \verb+\ophline(T1,T2){T3}+ & Trace un trait horizontal de longueur \verb+T3+, d'épaisseur \verb+hrulewidth+ et débutant en \verb+(T1,T2)+ par @@ -1787,6 +1827,8 @@ ce \verb+\opsetintegerdigit{n}{T}{N}+ & Modifie le \verb+T+ième chiffre de la partie entière de \verb+N+ pour qu'il soit égal à \verb+n+. \\\hline + \verb+\opsqrt{n}{N}+ & + Mémorise la racine carrée de \verb+n+ dans \verb+N+. \\\hline \verb+\opsub[P]{n1}{n2}+ & Affiche le résultat de l'opération n1-n2. \\\hline \verb+\opsub*{n1}{n2}{N}+ & diff --git a/Master/texmf-dist/doc/generic/xlop/xlop-doc.pdf b/Master/texmf-dist/doc/generic/xlop/xlop-doc.pdf index 4b75108c46f..1910db999ae 100644 Binary files a/Master/texmf-dist/doc/generic/xlop/xlop-doc.pdf and b/Master/texmf-dist/doc/generic/xlop/xlop-doc.pdf differ diff --git a/Master/texmf-dist/doc/generic/xlop/xlop-doc.tex b/Master/texmf-dist/doc/generic/xlop/xlop-doc.tex index 396c09e141d..fb623b21d04 100644 --- a/Master/texmf-dist/doc/generic/xlop/xlop-doc.tex +++ b/Master/texmf-dist/doc/generic/xlop/xlop-doc.tex @@ -248,7 +248,7 @@ page~\pageref{sec:Creation d'operations complexes}. \index{number!valid}In practice, what does it mean all these rules? First, they means that a number writes in a decimal form can be preceded by any sequence of plus or minus signs. Obviously, if there -is a odd number of minus signs, the number will be negative. Next, a +is an odd number of minus signs, the number will be negative. Next, a decimal number admits only one decimal separator symbol which can be a dot or a comma, this one can be put anywhere in the number. Finally, a number is write in basis~10. Be carefull: these @@ -262,7 +262,7 @@ variable name with the character \texttt{@}. \index{parameter!syntax|(} Parameter assignments are local to the macro when they are indicated in the optional argument. To make global a parameter assignment, you -have to use the \macro{opset} macro. For example: +have to use the \macro{opset} macro. For instance: \begin{Verbatim}[xrightmargin=0pt] \opset{decimalsepsymbol={,}} \end{Verbatim} @@ -779,7 +779,7 @@ only) under the control of \parameter{maxdivstep}, \parameter{safedivstep}, and \parameter{period} parameters. It is only partially true because a classical division will stop automatically when a remainder will be zero, whatever the values of these three -parameters and a euclidean division will stop with an integer quotient +parameters and an euclidean division will stop with an integer quotient without attention for these three parameters. \begin{SideBySideExample} \opdiv{25}{7} @@ -845,7 +845,7 @@ $\left\lfloor\frac{2^{31}-1}{10}\right\rfloor = 214748364$. In order to avoid too long calculations, \package{xlop} don't process beyond the value of \parameter{safedivstep} parameter in division with period. Its default value is~50. However, \package{xlop} package show -this problem. For example, if you ask for such a division with the +this problem. For instance, if you ask for such a division with the code: \begin{Verbatim}[xrightmargin=0pt,frame=none] \opdiv[period]{1}{289} @@ -1388,6 +1388,42 @@ work. \end{tabular} \end{center} +\index{square root} +With version~0.26 comes the square root operation: +\macro{opsqrt}. This macro has not the same syntax as the other +arithmetic macros since there is no starred version. In fact, there is +a way to display a processing of square root but it's really not +current. I'm pretty old and my grandfather told me that he saw +this method when he was young! Therefore, there is an \macro{opgfsqrt} +macro to display the operation (``gf'' for grandfather). + +Let us see the first macro: the one which calculates the square root +and store the result in a xlop variable: +\begin{SideBySideExample} + \opsqrt{2}{sqrt2} + $\sqrt{2}\approx\opprint{sqrt2}$ +\end{SideBySideExample} +This macro shares the parameter \parameter{maxdivstep} with division +macros. For instance: +\begin{SideBySideExample} + \opsqrt[maxdivstep=15]{2}{sqrt2} + $\sqrt{2}\approx\opprint{sqrt2}$ +\end{SideBySideExample} + +For ``grandfather'' display, I have not the energy to explain the +processus. It's based on remarkable identity +$(a+b)^2=a^2+2ab+b^2$. Thanks to Jean-Michel Sarlat who had taken time +to explain this method in order that I can write it for +\package{xlop}! + +Here is an example for square root of 15: +\begin{CenterExample} + \opgfsqrt[maxdivstep=5]{15} +\end{CenterExample} +This method is horrible. It's horrible for human being. It's horrible +for computer. For instance, the real operation isn't make that way: +it uses Heron method. + \index{complex expression|(} The very last macro we have to study is \macro{opexpr}. It calculates a complex expression. This macro needs two parameters: the first one @@ -1564,7 +1600,7 @@ expected. \index{compilation time|)}\index{time (calculation)|)}% \newpage -\section{Macros List} +\section{Macro List} \label{sec:Liste des macros} \index{macros!table of|(}% \noindent\begin{longtable}{|l|p{6.3cm}|} @@ -1641,6 +1677,9 @@ expected. \verb+\opgetintegerdigit{n}{T}{N}+ & Build the number \verb+N+ width the only digit in slot \verb+T+ of integer part of \verb+n+. \\\hline + \verb+\opgfsqrt{n}+ & + Display the old timed way to calculate a square root of + \verb+n+. \\\hline \verb+\ophline(T1,T2){T3}+ & Draw a horizontal rule of length \verb+T3+, of thickness \verb+hrulewidth+, and which begin at \verb+(T1,T2)+ in relation to @@ -1690,6 +1729,8 @@ expected. \verb+\opsetintegerdigit{n}{T}{N}+ & Modify the digit of rank \verb+T+ in integer part of \verb+N+ in order to have the value \verb+n+ for this digit. \\\hline + \verb+\opsqrt{n}{N}+ & Put square root of \verb+n+ in + \verb+N+. \\\hline \verb+\opsub[P]{n1}{n2}+ & Display result of \verb+n1-n2+. \\\hline \verb+\opsub*{n1}{n2}{N}+ & @@ -1816,7 +1857,8 @@ In this table, parameters: shifting. \\\hline \verb+maxdivstep+ & \verb+10+ & - Maximal number of steps in division. \\\hline + Maximal number of steps in division or in square root + operation. \\\hline \verb+safedivstep+ & \verb+50+ & Maximal number of steps in division when there is a period to @@ -2070,7 +2112,7 @@ ones). \end{SideBySideExample} Note that this code is very bad: it is very slow and don't give -anything against native \TeX{} operations. It is only a educational +anything against native \TeX{} operations. It is only an educational example. Note also that the tricks to put loop into loop with macro \verb+\testprimality+ inside a group. \package{xlop} operations give global results.\index{global allocation} -- cgit v1.2.3