File r38/doc/manual2/trigsimp.tex from the latest check-in


\chapter[TRIGSIMP: Trigonometric simplification]%
        {TRIGSIMP: Simplification and factorisation of trigonometric
and hyperbolic functions}
\label{TRIGSIMP}
\typeout{{TRIGSIMP: Simplification and factorisation of trigonometric
and hyperbolic functions}}

{\footnotesize
\begin{center}
Wolfram Koepf, Andreas Bernig and Herbert Melenk\\
Konrad--Zuse--Zentrum f\"ur Informationstechnik Berlin \\
Takustra\"se 7 \\
D--14195 Berlin--Dahlem, Germany \\[0.05in]
e--mail: Koepf@zib.de
\end{center}
}
\ttindex{TRIGSIMP}

There are three
procedures included in TRIGSIMP: trigsimp, trigfactorize and triggcd. 
The first is for finding simplifications of trigonometric or 
hyperbolic expressions with many options, the second for factorising 
them and the third 
for finding the greatest common divisor of two trigonometric or 
hyperbolic polynomials.

\section{Simplifiying trigonometric expressions}

As there is no normal form for trigonometric and hyperbolic functions,
the same function can convert in many different directions, {\em e.g. }
$\sin(2x) \leftrightarrow 2\sin(x)\cos(x)$. 
The user has the possibility to give several parameters to the 
procedure {\tt trigsimp} in order to influence the direction of
transformations.  The decision whether a rational expression in
trigonometric  and hyperbolic functions vanishes or not is possible.

\ttindex{trigsimp}
To simplify a function {\tt f}, one uses {\tt trigsimp(f[,options])}. Example:

\begin{verbatim}
2: trigsimp(sin(x)^2+cos(x)^2);

1
\end{verbatim}


Possible options are (* denotes the default):
\begin{enumerate}
\item {\tt sin} (*) or {\tt cos}\index{trigsimp ! sin}\index{trigsimp ! cos}
\item {\tt sinh} (*) or {\tt cosh}\index{trigsimp ! sinh}\index{trigsimp ! cosh}
\item {\tt expand} (*) or {\tt combine} or {\tt compact}\index{trigsimp ! expand}\index{trigsimp ! combine}\index{trigsimp ! compact}
\item {\tt hyp} or {\tt trig} or {\tt expon}\index{trigsimp ! hyp}\index{trigsimp ! trig}\index{trigsimp ! expon}
\item {\tt keepalltrig}\index{trigsimp ! keepalltrig}
\end{enumerate}

From each group one can use at most one option, otherwise an error 
message will occur. The first group fixes the preference used while 
transforming a trigonometric expression.
The second group is the equivalent for the hyperbolic functions. 
The third group determines the type of transformations. With 
the default {\tt expand}, an expression is written in a form only using 
single arguments and no sums of arguments.  With {\tt combine},
products of trigonometric functions are transformed to trigonometric
functions involving sums of arguments.


\begin{verbatim}
trigsimp(sin(x)^2,cos);

         2
 - cos(x)  + 1

trigsimp(sin(x)*cos(y),combine);

        
 sin(x - y) + sin(x + y)
-------------------------
            2
\end{verbatim}

With {\tt compact}, the \REDUCE\ operator {\tt compact} (see
chapter~\ref{COMPACT}) is applied to {\tt f}. 
This leads often to a simple form, but in contrast to {\tt expand} one 
doesn't get a normal form.

\begin{verbatim}
trigsimp((1-sin(x)**2)**20*(1-cos(x)**2)**20,compact);

      40       40
cos(x)  *sin(x)
\end{verbatim}

With the fourth group each expression is transformed to a
trigonometric, hyperbolic or exponential form:

\begin{verbatim}
trigsimp(sin(x),hyp);

 - sinh(i*x)*i

trigsimp(e^x,trig);

     x          x
cos(---) + sin(---)*i
     i          i
\end{verbatim}


Usually, {\tt tan}, {\tt cot}, {\tt sec}, {\tt csc} are expressed in terms of
{\tt sin} and {\tt cos}.  It can 
be sometimes useful to avoid this, which is handled by the option 
{\tt keepalltrig}:

\begin{verbatim}
trigsimp(tan(x+y),keepalltrig);

  - (tan(x) + tan(y))
----------------------
  tan(x)*tan(y) - 1
\end{verbatim}


It is possible to use the options of different groups simultaneously.



\section{Factorising trigonometric expressions}

With {\tt trigfactorize(p,x)} one can factorise the trigonometric or 
hyperbolic polynomial {\tt p} with respect to the argument x. Example:
\ttindex{trigfactorize}

\begin{verbatim}
trigfactorize(sin(x),x/2); 

        x        x
{2,cos(---),sin(---)}
        2        2
\end{verbatim}

If the polynomial is not coordinated or balanced the output will equal
the input.  In this case, changing the value for x can help to find a
factorisation: 

\begin{verbatim}
trigfactorize(1+cos(x),x);

{cos(x) + 1}

trigfactorize(1+cos(x),x/2); 

        x        x
{2,cos(---),cos(---)}
        2        2
\end{verbatim}


\section{GCDs of trigonometric expressions}

The operator {\tt triggcd}\ttindex{triggcd} is an application of {\tt
trigfactorize}.  With its help the user can find the greatest common
divisor of two trigonometric or hyperbolic polynomials. The syntax is: {\tt
triggcd(p,q,x)}, where p and q  are the polynomials and x is the
smallest unit to use. Example:

\begin{verbatim}
triggcd(sin(x),1+cos(x),x/2);

     x
cos(---)
     2 

triggcd(sin(x),1+cos(x),x);

1
\end{verbatim}

See also the ASSIST package (chapter~\ref{ASSIST}).



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