# [OS X TeX] Binomial Expansion

Alain Schremmer Schremmer.Alain at gmail.com
Thu Nov 23 18:56:29 EST 2006

Claus Gerhardt wrote:

>>    \expand{(x+a)}{(x+b)} gives "(1a+1b)" as middle term.
>
> Because polynom can only handle one variable.

Indeed, it's even in the manual, work in progress and all that,  :-[ ,
but then how come the following

>>    \expand{(x+h)^{3}}{1} expands beautifully
>
> This is not my final command

?????

>>    \expand{(x_{0}+h)^{3}}{1} gives an error that I assume is due to
>> polyprint not liking _{0}
>
> It doesn't like "_"

That's too bad! Oh well x_{0}+h doesn't occur that often.

>>    \Expand{(2+h)^{3}} expands but parentheses surround the ascending
>> expansion!
>
No comment on this one? :-)

>>   \begin{equation}
>>    \begin{aligned}
>>    \expb{(x+2)(x+3)}
>>    \end{aligned}
>>    \end{equation}         writes the expansion under (x+2)(x+3)
>> rather than  after =.
>
> Because I placed  & at the front thinking to use only for very large
> expressions.

I see.

> You can set the & after =

That  moves the expansion right of = but leaves it on the lower line.

> If you want \polyprint command as inline command, not in a display
> equation, use
>
> \newcommand{\expd}{#1=\ensuremath\polyprint{#1}}

\begin{align*}
\expd{(x+h)^{3}}
\end{align*}

\expd works beautifully even though I would say there are two variables but

\begin{align*}
\expd{(2+h)^{3}}
\end{align*}

has the expansion still within patentheses.

By the way, each one of

5\Expand{(2+h)^{2}} +4\Expand{(2+h)^{3}}

and

$5\expd{(2+h)^{2}} +4\expd{(2+h)^{3}}$

act funny.

All in all, it seems that polyprint won't accept ascending powers very
gracefully.

In any case, thanks again, both \Expand and \expd are wonderful birthday
presents which I will use a lot.

Very best 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/