diff options
author | Karl Berry <karl@freefriends.org> | 2007-01-12 01:30:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-01-12 01:30:54 +0000 |
commit | 0c2102d58a913cd6d2487c947a9cedb4b872d698 (patch) | |
tree | c95b74407b9d2cadfebac27dc58817c2de14a03f /Master/texmf-dist | |
parent | c4a18cc35b13311ec9424f499268be12a8b09eb6 (diff) |
new package binomexp
git-svn-id: svn://tug.org/texlive/trunk@3355 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/binomexp/README | 10 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/binomexp/binomexp.pdf | bin | 0 -> 81921 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/binomexp/binomexp.dtx | 399 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/binomexp/binomexp.ins | 48 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/binomexp/binomexp.sty | 156 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/binomexp.tpm | 30 |
6 files changed, 643 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/binomexp/README b/Master/texmf-dist/doc/latex/binomexp/README new file mode 100644 index 00000000000..7113d672773 --- /dev/null +++ b/Master/texmf-dist/doc/latex/binomexp/README @@ -0,0 +1,10 @@ +Hi, +You will want to create a directory called binomexp attexmf/tex/latex so to keep the binomexp.sty file, which is what Latex reads when it uses the \usepackage{binomexp} command in the premable of your work. +Put the binomexp.sty file inside of the /texmf/tex/latex/binomexp directory. +Now, if you are using Miktex go to start, all programs, miktex, miktex options. Now click on the roots tab. Now select c:\texmf using the mouse. Now click on Refresh FNDB. You've installed it!! + +You might also want to create another directory binomexp at texmf/doc so to keep the documentation at. + +LICENSE +Do what ever you want with this program. Eat it, spend it, sell it, dwell in it. Use it for hamster bedding. +Subject to the Latex Project Public License. diff --git a/Master/texmf-dist/doc/latex/binomexp/binomexp.pdf b/Master/texmf-dist/doc/latex/binomexp/binomexp.pdf Binary files differnew file mode 100644 index 00000000000..b8d112f0eba --- /dev/null +++ b/Master/texmf-dist/doc/latex/binomexp/binomexp.pdf diff --git a/Master/texmf-dist/source/latex/binomexp/binomexp.dtx b/Master/texmf-dist/source/latex/binomexp/binomexp.dtx new file mode 100644 index 00000000000..78c37d37f9f --- /dev/null +++ b/Master/texmf-dist/source/latex/binomexp/binomexp.dtx @@ -0,0 +1,399 @@ +% \iffalse meta-comment +% +% Copyright (C) 2007 by David Roderick % ----------------------------------- +% +% This file may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.2 +% 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.2 or later is part of all distributions of LaTeX +% version 1999/12/01 or later. +% +% \fi +% +% \iffalse +%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01] +%<package>\ProvidesPackage{binomexp} +%<package> [2007/01/07 v1.0 My first attempt] +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{binomexp} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} +\DocInput{binomexp.dtx} +\end{document} +%</driver> +% \fi +% +% \CheckSum{310} +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +% \changes{v1.0}{2007/01/07}{Initial version} +% +% \GetFileInfo{binomexp.sty} +% +% \DoNotIndex{\the,\#} +% +% \title{The \textsf{binomexp} package\thanks{This document +% corresponds to \textsf{binomexp}~\fileversion, dated \filedate.}} +% \author{David Roderick \\ \texttt{angel\_ov\_north at tiscali dot co dot uk}} +% +% \maketitle +% +% \begin{abstract} +% Calculates and prints successive lines of Pascal's triangle.. +% \makeatletter +% \binomexp@putpascal{4}{5}{f}{s}{f}{s} \par +% and also will typset the following proof +% \binomexp@proof{n}{r} +% \end{abstract} +% +% \section{Introduction} +% +% A very simple package with simple usage. Putting `binomexp' (which +% is also typed exactly the same way than \marg{binomexp} inside +% of the argumentative input of the the |\usepackage| commands +% enables the user to do two extra things. +% \begin{itemize} \item +% print any successive rows of Pascal's triangle which will fit on +% the page up until the power as 31, at which point \LaTeX{} runs +% out of brain power. \\ +% \item Use a piece of code which Morten H\o gholm wrote which allows +% the cells inside of an array or a tabular to be repeated in a +% similar way than those may be repeated inside of the initial +% description of said array or tabular. +% \end{itemize} +% +% \section{Usage} +% Binomexp ought to load ifthen and calc by itself. If you have already loaded +% these packages using |\usepackage{calc,ifthen}| unload these therefore. +% You must then use the command as |\makeatletter| so to get the command names with the symbol as @ inside of those to function. +% +% \DescribeMacro{\binomexp@putpascal} +% |\binomexp@putpascal| \marg{number as lower power} +% \marg{number as higher power} \marg{symbol as first variable} +% \marg{symbol as second variable} \marg{symbol again as first variable} +% \marg{symbol again as second variable} +% \par|\binomexp@putpascal{7}{9}{f}{x}{f}{x}| will typset the rows as 7, 8, and 9 of +% Pascal's triangle. The first column will have $(f+x)^{power}$. +% The reason why you have to input the symbol again is because the +% user might like to use a |\cdot| or whatever in the other columns +% except the first column. +% And that's it really. +% \DescribeMacro{\binomexp@proof} +% |\binomexp@proof| \marg{number as row variable} +% \marg{number as column variable} +% will typeset the mathematical proof of Pascal's triangle, which is based upon % the observation that the co-efficient is equal with the number of possible +% combinations of the column variable out of the row variable. +% \StopEventually{\PrintIndex} +% +% \section{How I wrote it.} +% +% \begin{macrocode} +\RequirePackage{calc,ifthen} +% \end{macrocode} +% Morten H\o gholm wrote the following code. +% \begin{macrocode} +\newcommand\binomexp@replicate[2]{% + \ifnum#1>\z@ \expandafter\@firstofone + \else + \expandafter\@gobble + \fi + {#2\expandafter\binomexp@replicate\expandafter{\number\numexpr#1-1\relax}{#2}}% +} +% \end{macrocode} +% Morten's code allows the following. +% \begin{verbatim} +% \begin{document} +% \makeatletter +% \begin{tabular}{|*{6}{|c|}|} +% something1 \binomexp@replicate{4}{& something2}Blah&stuff\\ +% something1 \binomexp@replicate{4}{& something2}Blah&stuff\\ +% Third row with line atop from second to fifth column: +% \cline{2-5}something1 \binomexp@replicate{4}{& something2}Blah&stuff\\ +% \end{tabular} +% \end{document} +% \end{verbatim} +% You can invoke Morten's code either by loading the |\usepackage{binomexp}| +% within the preamble, and then by putting |\makeatletter|, or by including +% the following code somewhere (perhaps a preamble). +% \begin{verbatim} +% \makeatletter +% \newcommand\binomexp@replicate[2]{% +% \ifnum#1>\z@ \expandafter\@firstofone +% \else +% \expandafter\@gobble +% \fi +% {#2\expandafter\binomexp@replicate\expandafter{\number\numexpr#1-1\relax}{#2}}% +% } +% \makeatother +% \end{verbatim} +% \begin{macro}{\binomexp@call} +% the |\newcommand| as |\binomexp@call| makes things nice and pretty within a cell +% \begin{macrocode} +\newcommand{\binomexp@call}[1]{\rule[-0.125cm]{0mm}{0.5cm}\mbox{$#1$}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\binomexp@up} +% the |\newcommand| as |\binomexp@up| is by the power of the series which ascends +% \begin{macrocode} +\newcounter{binomexp@up} +\newcommand{\binomexp@up}{\number\value{binomexp@up} +\addtocounter{binomexp@up}{1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\binomexp@down} +% the |\newcommand| as |\binomexp@down| is by the power of the series which descends +% \begin{macrocode} +\newcounter{binomexp@down} +\newcommand{\binomexp@down}{\number\value{binomexp@down} +\addtocounter{binomexp@down}{-1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\binomexp@columns} +% an array of so many columns +% \begin{macrocode} +\newcounter{binomexp@columns} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\binomexp@power} +% $(f+s)^{power}$ +% \begin{macrocode} +\newcounter{binomexp@power} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\binomexp@pascalstart} +% \begin{macro}{\binomexp@pascalstop} +% \begin{macro}{\binomexp@emptytimes} +% the next 3 counters are used within the |\binomexp@putpascal| command +% \begin{macrocode} +\newcounter{binomexp@pascalstart} +\newcounter{binomexp@pascalstop} +\newcounter{binomexp@emptytimes} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\binomexp@variable1} +% \begin{macro}{\binomexp@variable2} +% \begin{macro}{\binomexp@answervar} +% the following 3 counters are used within the process of calculation as +% |\binomexp@printpascal| +% \begin{macrocode} +\newcounter{binomexp@variable1} +\newcounter{binomexp@variable2} +\newcounter{binomexp@answervar} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\binomexp@sub} +% \begin{macrocode} +\newcounter{binomexp@sub} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\binomexp@printpascal} +% to calculate the coefficients of the Pascal's triangle +% \begin{macrocode} +\protect\newcommand*{\binomexp@printpascal}{ +\addtocounter{binomexp@power}{1} +\expandafter\edef\csname +binomexp@morten\roman{binomexp@power}exporti\endcsname{1} +\setcounter{binomexp@sub}{2} +\setcounter{binomexp@variable1}{\numexpr\number\value{binomexp@power}+1\relax} +\whiledo{\number\numexpr\number\value{binomexp@power}+1\relax> +\value{binomexp@sub}}{ +\setcounter{binomexp@variable1}{\numexpr\number\value{binomexp@sub}-1\relax} +\setcounter{binomexp@variable2}{\value{binomexp@sub}} +\setcounter{binomexp@answervar}{\number\numexpr\csname +binomexp@x\roman{binomexp@variable1}\endcsname\relax+\number\numexpr\csname +binomexp@x\roman{binomexp@variable2}\endcsname\relax} +\expandafter\edef\csname binomexp@y\roman{binomexp@sub}\endcsname +{\number\value{binomexp@answervar}}\relax +\addtocounter{binomexp@sub}{1} +} +% \end{macrocode} +% TRANSFER PART +% set counter as binomexp@sub to 1 +% \begin{macrocode} +\setcounter{binomexp@sub}{2} +% \end{macrocode} +% create a loop which shall get the binomexp@y values and put those into the +% appropriate binomexp@x values. +% Also export the y values by this same corresponding power into a length called +% binomexp@morten|\roman{power}|export|\roman{binomexp@sub}| +% \begin{macrocode} +\whiledo{\numexpr\number\value{binomexp@power}+1\relax>\value{binomexp@sub}}{ +\setcounter{binomexp@answervar}{\number\numexpr\csname +binomexp@y\roman{binomexp@sub}\endcsname\relax} +\expandafter\edef\csname binomexp@x\roman{binomexp@sub}\endcsname +{\number\value{binomexp@answervar}} +% \end{macrocode} +% Here is how I exported the values to the table. +% \begin{macrocode} +\expandafter\edef\csname +binomexp@morten\roman{binomexp@power}export\roman{binomexp@sub}\endcsname +{\number\value{binomexp@answervar}} +% \end{macrocode} +% \begin{macrocode} +\addtocounter{binomexp@sub}{1} +} +\setcounter{binomexp@variable1} +{\numexpr\number\value{binomexp@power}+1\relax} +\expandafter\edef\csname +binomexp@x\roman{binomexp@variable1}\endcsname{1} +\expandafter\edef\csname +binomexp@morten\roman{binomexp@power}export\roman{binomexp@variable1}\endcsname{1} +% \end{macrocode} +% To see what is happening add the following lines at this place. +% \begin{verbatim} +% power is \number\value{binomexp@power}\par +% \setcounter{binomexp@variable2}{1} +% \whiledo{\value{binomexp@variable2}< +% \numexpr\number\value{binomexp@power}+2\relax}{ +% binomexp@morten\roman{binomexp@power}export\roman{binomexp@variable2} is +% \csname binomexp@morten\roman{binomexp@power}export\roman{binomexp@% +% variable2}\endcsname\relax\par\addtocounter{binomexp@variable2}{1}} +% \end{verbatim} +% \begin{macrocode} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\binomexp@putpascal} +% set binomexp@xi as 1 \par +% binomexp@xi never alters +% \begin{macrocode} +\newcommand*\binomexp@putpascal[6]{\par +\expandafter\edef\csname binomexp@xi\endcsname{1} +% \end{macrocode} +% set an eventuality for binomexp@xi by the power as zero +% \begin{macrocode} +\expandafter\edef\csname binomexp@mortenexporti\endcsname{1} +% \end{macrocode} +% we'll need to start power as zero by the way |\binomexp@printpascal| +% is transfigured. +% \begin{macrocode} +\setcounter{binomexp@power}{0} +% \end{macrocode} +% wrap the chipolatas in stringy bacon. +% \begin{macrocode} +\setcounter{binomexp@pascalstart}{#1} +\setcounter{binomexp@pascalstop}{#2+1} +% \end{macrocode} +% now calculate all the co-efficients. +% \begin{macrocode} +\setcounter{binomexp@emptytimes}{\value{binomexp@pascalstop}} +\whiledo{\value{binomexp@emptytimes}>1}{ +\binomexp@printpascal \addtocounter{binomexp@emptytimes}{-1} +} +% \end{macrocode} +% work out the number of columns +% \begin{macrocode} +\setcounter{binomexp@columns} +{\numexpr\number\value{binomexp@pascalstop}+2\relax} +% \end{macrocode} +% now the table +% \begin{macrocode} +\begin{math} \begin{array}{@{}|c|*{\value{binomexp@columns}}{|c}|@{}} +% \end{macrocode} +% repeat the number of rows so many times +% \begin{macrocode} +\whiledo{\value{binomexp@pascalstart}< +\numexpr\number\value{binomexp@pascalstop}-1\relax}{ +% \end{macrocode} +% prime the binomexp@up gun and cock. +% \begin{macrocode} +\setcounter{binomexp@up}{0} +% \end{macrocode} +% prime the binomexp@down gun and cock. +% \begin{macrocode} +\setcounter{binomexp@down}{\value{binomexp@pascalstart}} +\binomexp@call{(#3+#4)^{\number\numexpr\number\value{binomexp@pascalstart}\relax}} +\binomexp@replicate{\numexpr\number\value{binomexp@pascalstart}+1\relax} +{&\binomexp@call{\csname +binomexp@morten\romannumeral\numexpr\value{binomexp@pascalstart}\relax +export\romannumeral\numexpr\value{binomexp@up}+1\relax\endcsname +#5^{\binomexp@down} #6^{\binomexp@up}}}\\ +\addtocounter{binomexp@pascalstart}{1} +} +% \end{macrocode} +% add one more row for luck +% \begin{macrocode} +\setcounter{binomexp@up}{0} +\setcounter{binomexp@down}{\value{binomexp@pascalstart}} +\binomexp@call{(#3+#4)^{\number\numexpr\number\value{binomexp@pascalstart}\relax}} +\binomexp@replicate{\numexpr\number\value{binomexp@pascalstart}+1\relax} +{&\binomexp@call{\csname +binomexp@morten\romannumeral\numexpr\value{binomexp@pascalstart}\relax +export\romannumeral\numexpr\value{binomexp@up}+1\relax\endcsname +#5^{\binomexp@down} #6^{\binomexp@up}}} + \end{array} \end{math} +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\binomexp@proof} +% This command prints a mathematical proof of the +% Pascals's triangle based upon obervation. +% \begin{macrocode} +\newcommand{\binomexp@proof}[2]{ +\[ 7!=7\cdot6\cdot5\cdot4\cdot3\cdot2\cdot1 \hspace*{5em} +{#1 \choose #2} = \frac{#1!}{(#1-#2)!\cdot #2!}= +\frac{#1!}{(#1-#2)!\cdot(#1-(#1-#2))!}={#1 \choose #1-#2} +\] +\begin{eqnarray*} {#1 - 1 \choose #2 - 1} + {#1 - 1 \choose #2} +&=& \frac{(#1 - 1)!}{(#2 - 1)!\cdot[(#1 - 1) - (#2 - 1)]!} + +\frac{(#1 - 1)!}{#2!\cdot[(#1 - 1) - #2)]!}\\ +&=& (#1 - 1)!\cdot\left(\frac{1}{(#2 - 1)!\cdot(#1 - #2)!} + +\frac{1}{#2!\cdot[(#1 - #2) - 1)]!}\right) \\ +&=& (#1 - 1)! \cdot\frac{#2 + (#1 - #2)}{#2! (#1 - #2)!} \\ +&=& \frac{#1!}{#2!(#1 - #2)!} = {#1 \choose #2} + \end{eqnarray*} +\[ \frac{#2}{#2!\cdot(#1-#2)!} = \frac{1}{(#2-1)!\cdot(#1-#2)!} +\hspace*{5em} \mbox{because} \hspace*{5em} \\ + \frac{6}{6!\cdot(#1-#2)!} = \frac{1}{5!\cdot(#1-#2)!} \] +\begin{eqnarray*} +(#2 + 1)\cdot {#1 + 1 \choose #2 + 1} &=& (#2 + 1)\cdot +\frac{(#1 + 1)!}{((#2 + 1)!\cdot ((#1 + 1) - (#2 + 1))!}\\ +&=& (#2 + 1)\cdot \frac{(#1 + 1)!}{(#2 + 1)!\cdot (#1 - #2)!}\\ +&=& (#1 + 1)\cdot \frac{#1!}{#2!\cdot (#1 - #2)!} = (#1 + 1)\cdot +{#1 \choose #2}\\ +\end{eqnarray*} +} +% \end{macrocode} +% \end{macro} +% +% \Finale +% \PrintIndex +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/binomexp/binomexp.ins b/Master/texmf-dist/source/latex/binomexp/binomexp.ins new file mode 100644 index 00000000000..3775fbbb603 --- /dev/null +++ b/Master/texmf-dist/source/latex/binomexp/binomexp.ins @@ -0,0 +1,48 @@ +%% +%% Copyright (C) 2006 by David Roderick %% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.2 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.2 or later is part of all distributions of +%% LaTeX version 1999/12/01 or later. +%% + +\input docstrip.tex + + +\preamble +This is a generated file. +Copyright (C) 2006 by David Roderick +This file may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.2 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.2 or later is part of all distributions of +LaTeX version 1999/12/01 or later. +\endpreamble + +\usedir{tex/latex/binomexp} +\generate{\file{binomexp.sty}{\from{binomexp.dtx}{package}}} + +\obeyspaces +\Msg{****************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the *} +\Msg{* following file into a directory searched by TeX: *} +\Msg{* which might be texmf/tex/latex/binomexp*} +\Msg{* *} +\Msg{* binomexp.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* binomexp.dtx through LaTeX. *} +\Msg{* *} +\Msg{* Disinterested TeXing! *} +\Msg{* *} +\Msg{****************************************************} + +\endbatchfile diff --git a/Master/texmf-dist/tex/latex/binomexp/binomexp.sty b/Master/texmf-dist/tex/latex/binomexp/binomexp.sty new file mode 100644 index 00000000000..1e17b5747ab --- /dev/null +++ b/Master/texmf-dist/tex/latex/binomexp/binomexp.sty @@ -0,0 +1,156 @@ +%% +%% This is file `binomexp.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% binomexp.dtx (with options: `package') +%% This is a generated file. +%% Copyright (C) 2006 by David Roderick +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.2 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.2 or later is part of all distributions of +%% LaTeX version 1999/12/01 or later. +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesPackage{binomexp} + [2007/01/07 v1.0 My first attempt] +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +\RequirePackage{calc,ifthen} +\newcommand\binomexp@replicate[2]{% + \ifnum#1>\z@ \expandafter\@firstofone + \else + \expandafter\@gobble + \fi + {#2\expandafter\binomexp@replicate\expandafter{\number\numexpr#1-1\relax}{#2}}% +} +\newcommand{\binomexp@call}[1]{\rule[-0.125cm]{0mm}{0.5cm}\mbox{$#1$}} +\newcounter{binomexp@up} +\newcommand{\binomexp@up}{\number\value{binomexp@up} +\addtocounter{binomexp@up}{1}} +\newcounter{binomexp@down} +\newcommand{\binomexp@down}{\number\value{binomexp@down} +\addtocounter{binomexp@down}{-1}} +\newcounter{binomexp@columns} +\newcounter{binomexp@power} +\newcounter{binomexp@pascalstart} +\newcounter{binomexp@pascalstop} +\newcounter{binomexp@emptytimes} +\newcounter{binomexp@variable1} +\newcounter{binomexp@variable2} +\newcounter{binomexp@answervar} +\newcounter{binomexp@sub} +\protect\newcommand*{\binomexp@printpascal}{ +\addtocounter{binomexp@power}{1} +\expandafter\edef\csname +binomexp@morten\roman{binomexp@power}exporti\endcsname{1} +\setcounter{binomexp@sub}{2} +\setcounter{binomexp@variable1}{\numexpr\number\value{binomexp@power}+1\relax} +\whiledo{\number\numexpr\number\value{binomexp@power}+1\relax> +\value{binomexp@sub}}{ +\setcounter{binomexp@variable1}{\numexpr\number\value{binomexp@sub}-1\relax} +\setcounter{binomexp@variable2}{\value{binomexp@sub}} +\setcounter{binomexp@answervar}{\number\numexpr\csname +binomexp@x\roman{binomexp@variable1}\endcsname\relax+\number\numexpr\csname +binomexp@x\roman{binomexp@variable2}\endcsname\relax} +\expandafter\edef\csname binomexp@y\roman{binomexp@sub}\endcsname +{\number\value{binomexp@answervar}}\relax +\addtocounter{binomexp@sub}{1} +} +\setcounter{binomexp@sub}{2} +\whiledo{\numexpr\number\value{binomexp@power}+1\relax>\value{binomexp@sub}}{ +\setcounter{binomexp@answervar}{\number\numexpr\csname +binomexp@y\roman{binomexp@sub}\endcsname\relax} +\expandafter\edef\csname binomexp@x\roman{binomexp@sub}\endcsname +{\number\value{binomexp@answervar}} +\expandafter\edef\csname +binomexp@morten\roman{binomexp@power}export\roman{binomexp@sub}\endcsname +{\number\value{binomexp@answervar}} +\addtocounter{binomexp@sub}{1} +} +\setcounter{binomexp@variable1} +{\numexpr\number\value{binomexp@power}+1\relax} +\expandafter\edef\csname +binomexp@x\roman{binomexp@variable1}\endcsname{1} +\expandafter\edef\csname +binomexp@morten\roman{binomexp@power}export\roman{binomexp@variable1}\endcsname{1} +} +\newcommand*\binomexp@putpascal[6]{\par +\expandafter\edef\csname binomexp@xi\endcsname{1} +\expandafter\edef\csname binomexp@mortenexporti\endcsname{1} +\setcounter{binomexp@power}{0} +\setcounter{binomexp@pascalstart}{#1} +\setcounter{binomexp@pascalstop}{#2+1} +\setcounter{binomexp@emptytimes}{\value{binomexp@pascalstop}} +\whiledo{\value{binomexp@emptytimes}>1}{ +\binomexp@printpascal \addtocounter{binomexp@emptytimes}{-1} +} +\setcounter{binomexp@columns} +{\numexpr\number\value{binomexp@pascalstop}+2\relax} +\begin{math} \begin{array}{@{}|c|*{\value{binomexp@columns}}{|c}|@{}} +\whiledo{\value{binomexp@pascalstart}< +\numexpr\number\value{binomexp@pascalstop}-1\relax}{ +\setcounter{binomexp@up}{0} +\setcounter{binomexp@down}{\value{binomexp@pascalstart}} +\binomexp@call{(#3+#4)^{\number\numexpr\number\value{binomexp@pascalstart}\relax}} +\binomexp@replicate{\numexpr\number\value{binomexp@pascalstart}+1\relax} +{&\binomexp@call{\csname +binomexp@morten\romannumeral\numexpr\value{binomexp@pascalstart}\relax +export\romannumeral\numexpr\value{binomexp@up}+1\relax\endcsname +#5^{\binomexp@down} #6^{\binomexp@up}}}\\ +\addtocounter{binomexp@pascalstart}{1} +} +\setcounter{binomexp@up}{0} +\setcounter{binomexp@down}{\value{binomexp@pascalstart}} +\binomexp@call{(#3+#4)^{\number\numexpr\number\value{binomexp@pascalstart}\relax}} +\binomexp@replicate{\numexpr\number\value{binomexp@pascalstart}+1\relax} +{&\binomexp@call{\csname +binomexp@morten\romannumeral\numexpr\value{binomexp@pascalstart}\relax +export\romannumeral\numexpr\value{binomexp@up}+1\relax\endcsname +#5^{\binomexp@down} #6^{\binomexp@up}}} + \end{array} \end{math} +} +\newcommand{\binomexp@proof}[2]{ +\[ 7!=7\cdot6\cdot5\cdot4\cdot3\cdot2\cdot1 \hspace*{5em} +{#1 \choose #2} = \frac{#1!}{(#1-#2)!\cdot #2!}= +\frac{#1!}{(#1-#2)!\cdot(#1-(#1-#2))!}={#1 \choose #1-#2} +\] +\begin{eqnarray*} {#1 - 1 \choose #2 - 1} + {#1 - 1 \choose #2} +&=& \frac{(#1 - 1)!}{(#2 - 1)!\cdot[(#1 - 1) - (#2 - 1)]!} + +\frac{(#1 - 1)!}{#2!\cdot[(#1 - 1) - #2)]!}\\ +&=& (#1 - 1)!\cdot\left(\frac{1}{(#2 - 1)!\cdot(#1 - #2)!} + +\frac{1}{#2!\cdot[(#1 - #2) - 1)]!}\right) \\ +&=& (#1 - 1)! \cdot\frac{#2 + (#1 - #2)}{#2! (#1 - #2)!} \\ +&=& \frac{#1!}{#2!(#1 - #2)!} = {#1 \choose #2} + \end{eqnarray*} +\[ \frac{#2}{#2!\cdot(#1-#2)!} = \frac{1}{(#2-1)!\cdot(#1-#2)!} +\hspace*{5em} \mbox{because} \hspace*{5em} \\ + \frac{6}{6!\cdot(#1-#2)!} = \frac{1}{5!\cdot(#1-#2)!} \] +\begin{eqnarray*} +(#2 + 1)\cdot {#1 + 1 \choose #2 + 1} &=& (#2 + 1)\cdot +\frac{(#1 + 1)!}{((#2 + 1)!\cdot ((#1 + 1) - (#2 + 1))!}\\ +&=& (#2 + 1)\cdot \frac{(#1 + 1)!}{(#2 + 1)!\cdot (#1 - #2)!}\\ +&=& (#1 + 1)\cdot \frac{#1!}{#2!\cdot (#1 - #2)!} = (#1 + 1)\cdot +{#1 \choose #2}\\ +\end{eqnarray*} +} +\endinput +%% +%% End of file `binomexp.sty'. diff --git a/Master/texmf-dist/tpm/binomexp.tpm b/Master/texmf-dist/tpm/binomexp.tpm new file mode 100644 index 00000000000..fa6822f6073 --- /dev/null +++ b/Master/texmf-dist/tpm/binomexp.tpm @@ -0,0 +1,30 @@ +<!DOCTYPE rdf:RDF SYSTEM "../../support/tpm.dtd"> +<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:TPM="http://texlive.dante.de/"> + <rdf:Description about="http://texlive.dante.de/texlive/Package/binomexp.zip"> + <TPM:Name>binomexp</TPM:Name> + <TPM:Type>Package</TPM:Type> + <TPM:Date>2007/01/11 00:59:00</TPM:Date> + <TPM:Version></TPM:Version> + <TPM:Creator>karl</TPM:Creator> + <TPM:Title>The binomexp package.</TPM:Title> + <TPM:Description></TPM:Description> + <TPM:Author></TPM:Author> + <TPM:Size>105312</TPM:Size> + <TPM:License></TPM:License> + <TPM:Build/> + <TPM:RunFiles size="7759"> +texmf-dist/tex/latex/binomexp/binomexp.sty +texmf-dist/tpm/binomexp.tpm + </TPM:RunFiles> + <TPM:DocFiles size="82676"> +texmf-dist/doc/latex/binomexp/README +texmf-dist/doc/latex/binomexp/binomexp.pdf + </TPM:DocFiles> + <TPM:SourceFiles size="15941"> +texmf-dist/source/latex/binomexp/binomexp.dtx +texmf-dist/source/latex/binomexp/binomexp.ins + </TPM:SourceFiles> + <TPM:Provides>Package/binomexp</TPM:Provides> + </rdf:Description> +</rdf:RDF> + |