[OS X TeX] Binomial Expansion
Claus Gerhardt
gerhardt at math.uni-heidelberg.de
Thu Nov 23 19:11:56 CET 2006
Alain,
Here is my little birthday present:
\newcommand{\expand}[2]{\polyprint{#1#2}}
Notice that the polynomials have to be delimited by round brackets like
\expand{(x+1)}{(x+8)^3}
This will gives you the fully expanded polynomial. A reverse long
division scheme is a bit more difficult, and frankly, I can't see its
necessity.
Claus
On Nov 23, 2006, at 18:11, Alain Schremmer wrote:
> Claus Gerhardt wrote:
>
>> Happy Birthday Alain!
>
> Thank you!
>
>> I had a look at the polynom.sty manual. It is only 6 pages and
>> well written. You should give it a try.
>
> I did about a year ago and I have been using \polylongdiv ever
> since. That was not the point of my post. What I wanted to do over
> the Christmas break was to learn a little bit about programming in
> LaTeX. The idea was to write, in the spirit of polylongdiv, a command
>
> \Expand{a}{b}{some degree}
>
> that would expand and typeset (a+b)^n. I am still going, The TeX
> Book in hand, to try.
>
>> If \Expand{a}{b}{some degree} should represent polynomial
>> division, then
>>
>> \polylongdiv[stage=3] {(X-1)(X-1)(X^2+1)^4} {(X-1)(X+1)(X+1)}
>>
>> might be what you want.
>
> Not really since I can expand (a+b)^n in my head and polylongdiv
> gives me the output but no source to copy-paste.
>
> Nevertheless, \polylongdiv{(x+a)^{n}}{1}(with an actual value for
> n) is indeed very neat and I will try to cut some more from
> polynom.sty to get rid of the division (I already got rid of Horner
> but that was a bit of trial and error.)
>
> What I wanted was to learn a bit about LaTeX along the theme of
> writing the command.
>
> But, indeed, I hadn't realized that polylongdiv could multiply
> which of course was dumb since it has to multiply in order to
> divide (not quite as in "we had to destroy the city in order to
> save it" of everlasting fame.)
>
> Of course, what I would kill for is a polylongdiv in ascending
> order. But, as I wrote, Heinz didn't respond to my two requests so
> I think she or he has better things to do.
>
> Very grateful regards
> --schremmer
> ------------------------- Info --------------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
> & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Archive: http://tug.org/pipermail/macostex-archives/
>
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
More information about the macostex-archives
mailing list