File r37/doc/manual2/taylor.tex from the latest check-in


\chapter{TAYLOR: Manipulation of Taylor series}
\label{TAYLOR}
\typeout{{TAYLOR: Manipulation of Taylor series}}

{\footnotesize
\begin{center}
Rainer Sch\"opf\\
Zentrum f\"ur Datenverarbeitung der Universit\"at Mainz\\
Anselm-Franz-von-Bentzel-Weg~12\\
D-55055 Mainz, Germany  \\[0.05in]
e--mail: Schoepf@Uni-Mainz.DE
\end{center}
}
\ttindex{TAYLOR}\index{Taylor Series}\index{TAYLOR package}
\index{Laurent series}

The TAYLOR package of \REDUCE\ allow Taylor expansion in one or
several variables, and efficient manipulation of the resulting Taylor
series. Capabilities include basic operations (addition, subtraction,
multiplication and division), and also application of certain
algebraic and transcendental functions. To a certain extent, Laurent
and Puiseux expansions can be performed as well.  In many cases,
separable singularities are detected and factored out.

\noindent {\tt TAYLOR}(EXP:{\em exprn}[,VAR:{\em kernel},
            VAR$_0$:{\em exprn},ORDER:{\em integer}]\ldots):{\em exprn}

where EXP is the expression to be expanded.  It can be any \REDUCE\ 
object, even an expression containing other Taylor kernels.  VAR is
the kernel with respect to which EXP is to be expanded.  VAR$_0$
denotes the point about which and ORDER the order up to which
expansion is to take place.  If more than one (VAR, VAR0, ORDER) triple
is specified {\tt TAYLOR} will expand its first argument independently
with respect to each variable in turn.  For example,

\begin{verbatim}
  taylor(e^(x^2+y^2),x,0,2,y,0,2);
\end{verbatim}

will calculate the Taylor expansion up to order $X^{2}*Y^{2}$.
Note that once the expansion has been done it is not possible to 
calculate higher orders.
Instead of a kernel, VAR may also
be a list of kernels. In this case expansion will take place in a way
so that the {\em sum\/} of the degrees of the kernels does not exceed
ORDER.
If VAR$_0$ evaluates to the special identifier \verb|INFINITY|
{\tt TAYLOR} tries to expand EXP in a series in 1/VAR.

The expansion is performed variable per variable, {\em i.e.\ }in the
example above by first expanding $\exp(x^{2}+y^{2})$ with respect 
to $x$ and then expanding every coefficient with respect to $y$.

\index{IMPLICIT\_TAYLOR operator}\index{INVERSE\_TAYLOR} There are two
extra operators to compute the Taylor expansions of implicit and
inverse functions:

\noindent {\tt IMPLICIT\_TAYLOR}(F:{\em exprn},VAR1,VAR2:{\em kernel},\\
\hphantom{{\tt IMPLICIT\_TAYLOR}(}VAR1$_0$,VAR2$_0$:{\em exprn},
                                 ORDER:{\em integer}):{\em exprn}

takes a function F depending on two variables VAR1 and VAR2 and
computes the Taylor series of the implicit function VAR2(VAR1)
given by the equation F(VAR1,VAR2) = 0.  For example,

\begin{verbatim}
  implicit_taylor(x^2 + y^2 - 1,x,y,0,1,5);
\end{verbatim}

\noindent {\tt INVERSE\_TAYLOR}(F:{\em exprn},VAR1,VAR2:{\em kernel},\\
\hphantom{{\tt INVERSE\_TAYLOR}(}VAR1$_0$:{\em exprn},
                                 ORDER:{\em integer}):{\em exprn}

takes a function F depending on VAR1 and computes the Taylor series of
the inverse of F with respect to VAR2.  For example,

\begin{verbatim}
  inverse_taylor(exp(x)-1,x,y,0,8);
\end{verbatim}


\index{TAYLORPRINTTERMS variable} 
When a Taylor kernel is printed, only a certain number of (non-zero)
coefficients are shown.  If there are more, an expression of the form
\verb|(|$n$\verb| terms)| is printed to indicate how many non-zero
terms have been suppressed.  The number of terms printed is given by
the value of the shared algebraic variable \verb|TAYLORPRINTTERMS|.
Allowed values are integers and the special identifier \verb|ALL|.  The
latter setting specifies that all terms are to be printed.  The default
setting is $5$.


\index{TAYLORKEEPORIGINAL switch}
If the switch \verb|TAYLORKEEPORIGINAL| is set to \verb|ON| the
original expression EXP is kept for later reference.
It can be recovered by means of the operator

\hspace*{2em} {\tt TAYLORORIGINAL}(EXP:{\em exprn}):{\em exprn}

An error is signalled if EXP is not a Taylor kernel or if the original
expression was not kept, {\em i.e.\ }if \verb|TAYLORKEEPORIGINAL| was
\verb|OFF| during expansion.  The template of a Taylor kernel, {\em i.e.\ }
the list of all variables with respect to which expansion took place
together with expansion point and order can be extracted using
\ttindex{TAYLORTEMPLATE}

\hspace*{2em} {\tt TAYLORTEMPLATE}(EXP:{\em exprn}):{\em list}

This returns a list of lists with the three elements (VAR,VAR0,ORDER).
As with \verb|TAYLORORIGINAL|, an error is signalled if EXP is not a
Taylor kernel. 

\hspace*{2em} {\tt TAYLORTOSTANDARD}(EXP:{\em exprn}):{\em exprn}

converts all Taylor kernels in EXP into standard form and
\ttindex{TAYLORTOSTANDARD} resimplifies the result.

\hspace*{2em} {\tt TAYLORSERIESP}(EXP:{\em exprn}):{\em boolean}

may be used to determine if EXP is a Taylor kernel.
\ttindex{TAYLORSERIESP} Note that this operator is subject to the same
restrictions as, {\em e.g.}, ORDP or NUMBERP, {\em i.e.\ }it may only be used in
boolean expressions in \verb|IF| or \verb|LET| statements.  Finally
there is

\hspace*{2em} {\tt TAYLORCOMBINE}(EXP:{\em exprn}):{\em exprn}

which tries to combine all Taylor kernels found in EXP into one.
\ttindex{TAYLORCOMBINE}
Operations currently possible are:
\index{Taylor series ! arithmetic} 
\begin{itemize}
  \item Addition, subtraction, multiplication, and division.
  \item Roots, exponentials, and logarithms.
  \item Trigonometric and hyperbolic functions and their inverses.
\end{itemize}
Application of unary operators like \verb|LOG| and \verb|ATAN| will
nearly always succeed.  For binary operations their arguments have to be
Taylor kernels with the same template.  This means that the expansion
variable and the expansion point must match. Expansion order is not so
important, different order usually means that one of them is truncated
before doing the operation.

\ttindex{TAYLORKEEPORIGINAL}\ttindex{TAYLORCOMBINE}
If \verb|TAYLORKEEPORIGINAL| is set to \verb|ON| and if all Taylor
kernels in \verb|exp| have their original expressions kept
\verb|TAYLORCOMBINE| will also combine these and store the result
as the original expression of the resulting Taylor kernel.
\index{TAYLORAUTOEXPAND switch}
There is also the switch \verb|TAYLORAUTOEXPAND| (see below).

There are a few restrictions to avoid mathematically undefined
expressions: it is not possible to take the logarithm of a Taylor
kernel which has no terms ({\em i.e.\ }is zero), or to divide by such a
beast.  There are some provisions made to detect singularities during
expansion: poles that arise because the denominator has zeros at the
expansion point are detected and properly treated, {\em i.e.\ }the Taylor
kernel will start with a negative power.  (This is accomplished by
expanding numerator and denominator separately and combining the
results.)  Essential singularities of the known functions (see above)
are handled correctly.

\index{Taylor series ! differentiation}
Differentiation of a Taylor expression is possible.  Differentiating
with respect to one of the Taylor variables will decrease the order by one. 

\index{Taylor series ! substitution}
Substitution is a bit restricted: Taylor variables can only be replaced
by other kernels.  There is one exception to this rule: one can always
substitute a Taylor variable by an expression that evaluates to a
constant.  Note that \REDUCE\ will not always be able to determine
that an expression is constant.

\index{Taylor series ! integration}
Only simple Taylor kernels can be integrated. More complicated
expressions that contain Taylor kernels as parts of themselves are
automatically converted into a standard representation by means of the
TAYLORTOSTANDARD operator.  In this case a suitable warning is printed.

\index{Taylor series ! reversion} It is possible to revert a Taylor
series of a function $f$, {\em i.e.}, to compute the first terms of the
expansion of the inverse of $f$ from the expansion of $f$. This is
done by the operator

\hspace*{2em} {\tt TAYLORREVERT}(EXP:{\em exprn},OLDVAR:{\em kernel},
                                 NEWVAR:{\em kernel}):{\em exprn}

EXP must evaluate to a Taylor kernel with OLDVAR being one of its
expansion variables. Example:

\begin{verbatim}
  taylor (u - u**2, u, 0, 5);
  taylorrevert (ws, u, x);
\end{verbatim}

This package introduces a number of new switches:
\begin{itemize}

\index{TAYLORAUTOCOMBINE switch}
\item If \verb|TAYLORAUTOCOMBINE| is set to \verb|ON| \REDUCE\
    automatically combines Taylor expressions during the simplification
    process.  This is equivalent to applying \verb|TAYLORCOMBINE| to
    every expression that contains Taylor kernels.
    Default is \verb|ON|.

\index{TAYLORAUTOEXPAND switch}
\item \verb|TAYLORAUTOEXPAND| makes Taylor expressions ``contagious''
    in the sense that \verb|TAYLORCOMBINE| tries to Taylor expand
    all non-Taylor subexpressions and to combine the result with the
    rest. Default is \verb|OFF|.

\index{TAYLORKEEPORIGINAL switch}
\item \verb|TAYLORKEEPORIGINAL|, if set to \verb|ON|, forces the
    package to keep the original expression, {\em i.e.\ }the expression
    that was Taylor expanded.  All operations performed on the
    Taylor kernels are also applied to this expression  which can
    be recovered using the operator \verb|TAYLORORIGINAL|.
    Default is \verb|OFF|.

\index{TAYLORPRINTORDER switch}
\item \verb|TAYLORPRINTORDER|, if set to \verb|ON|, causes the
    remainder to be printed in big-$O$ notation.  Otherwise, three
    dots are printed. Default is \verb|ON|.

\end{itemize}



REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]