next up previous index
Next: Substitutions Up: Algebra Previous: Trigonometry

Fractions

Now  consider the following polynomial fraction:

\begin{displaymath}\frac{x^3-y^3}{x^2+x-y-y^2} = \frac{y^2+xy+x^2}{y+1+x}
\end{displaymath}

The expression on the right  is obtained by extracting the greatest common divider, which in this case is y - x, from both the numerator and the denominator. In Maxima this is done by calling ezgcd:
\begin{figure}
\begin{tex2html_preform}\begin{verbatim}(C81) ezgcd(x^3 - y^3, x^...
...Y - X Y - X , - Y - X - 1]
(C82)\end{verbatim}\end{tex2html_preform}\end{figure}

Function ezgcd returns a list. Members of this list  can be accessed as follows:
\begin{figure}
\begin{tex2html_preform}\begin{verbatim}(C93) a : ezgcd(x^3 - y^3...
... X, - Y - X Y - X , - Y - X - 1]\end{verbatim}\end{tex2html_preform}\end{figure}

There are three terms in the list returned by Maxima. The first term is the greatest common divider, and the second and the third term are the result of dividing the arguments of ezgcd by the greatest common divider. We can verify this as follows:
\begin{figure}
\begin{tex2html_preform}\begin{verbatim}(C94) a[1] * a[2];
2 2
(...
...d(%);
2 2
(D97) - Y - Y + X + X\end{verbatim}\end{tex2html_preform}\end{figure}

We can use the elements of the list returned by ezgcd in order to construct a simplified (or normalised) fraction:
\begin{figure}
\begin{tex2html_preform}\begin{verbatim}(C98) b : -a[2] / -a[3];
...
...) -------------
Y + X + 1
(C99)\end{verbatim}\end{tex2html_preform}\end{figure}

If you are in a hurry you can accomplish  the same simply by saying:
\begin{figure}
\begin{tex2html_preform}\begin{verbatim}(C21) factor((x^3 - y^3) ...
...) -------------
Y + X + 1
(C22)\end{verbatim}\end{tex2html_preform}\end{figure}

Maple has a function, called normal, which  normalises fractions:

\begin{figure}
\begin{tex2html_preform}\begin{verbatim}> normal((x^3 - y^3)/(x^2...
...+ y
-------------
x + 1 + y>\end{verbatim}\end{tex2html_preform}\end{figure}

But factor will work too:
\begin{figure}
\begin{tex2html_preform}\begin{verbatim}> factor((x^3 - y^3) / (x...
...+ y
-------------
x + 1 + y>\end{verbatim}\end{tex2html_preform}\end{figure}

And there is also a similar function in Mathematica, called Factor:

\begin{figure}
\begin{tex2html_preform}\begin{verbatim}In[2]:= Factor [ (x^3 - y...
...------------
1 + x + yIn[3]:=\end{verbatim}\end{tex2html_preform}\end{figure}


next up previous index
Next: Substitutions Up: Algebra Previous: Trigonometry
Zdzislaw Meglicki
2001-02-26