\documentclass[a4paper,10pt]{book}
\textwidth 10,5 cm
%\textwidth 11,8 cm
\textheight 17 cm
%\documentclass[twocolumn,10pt]{book}
%dvips -t landscape -O 0,-0.9 jean2.dvi 
\if@twoside \oddsidemargin 44pt \evensidemargin 82pt \marginparwidth 107pt
\else \oddsidemargin -0.29cm \evensidemargin -0.29cm
 \marginparwidth 0cm
\fi
\marginparsep 0cm
\topmargin 0.26cm 
\headheight 10pt \headsep 10pt \footskip 30pt
%\topmargin 0.36cm
%\baselineskip = 15pt
%\textheight 24.5cm
%\textwidth 17cm 
%\columnsep 30pt \columnseprule 0pt
%\textwidth 25 cm
%\textheight 18 cm
%\def\@evenhead{\thepage\hfill{\footnotesize\textit{\leftmark}}}
%\def\@oddhead{\footnotesize{\textit{\rightmark}}\hfill\thepage}
%\usepackage{hp}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage[francais]{babel}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{times}
\usepackage[ps2pdf,breaklinks=true,colorlinks=true,linkcolor=red,citecolor=green]{hyperref}%\usepackage[colorlinks,pdftex]{hyperref}
\title {Computer Algebra \\and \\ Mathematics\\ with\\ the {\tt HP40GS}}
\author{Renée De Graeve\\   Version 3.0}
%corrections MarK Howell
\makeindex
\begin{document}
\newcommand{\asinh}{\,\,\mbox{asinh\,}}
\newcommand{\atanh}{\,\,\mbox{atanh\,}}
\maketitle
{\bf \centerline{Acknowledgments}}
\vspace{1cm}
It was not believed possible to write an efficient program for computer algebra
 all on one's own. But one bright person by the name of Bernard Parisse didn't 
know that...and did it!!!\\
This is his program for computer algebra (called {\tt ERABLE}), built for the second time into an {\tt HP} calculator.\\
The development of this calculator has led Bernard Parisse to modify his program somewhat so that the computer algebra functions could be edited and cause the appropriate results to be displayed in the Equation Editor.\\
Explore all the capabilities of this calculator, as set out in the following 
pages.\\
\vspace{0.2cm}

I would like to thank:
\begin{itemize}
\item Bernard Parisse for his invaluable counsel, his remarks on the text, 
his reviews, and for his ability to provide functions on demand both 
efficiently and graciously.
\item Jean Tavenas for the concern shown towards the completion of 
the first version of this guide.
%\item Jean Yves Avenard for taking on board our requests, and for writing the {\tt PROMPT} command in the very spirit of promptness and with no advance warning... (cf \ref{sec:prompt}).
\end{itemize}
\vspace{1cm}


\vfill







%\copyright\ 2000, Hewlett-Packard, http://www.hp.com/calculators\\
\copyright\ 2005, Renée De Graeve \\
The reproduction, distribution and/or the modification of this document is 
authorised according to the terms of the {\tt GNU Free Documentation License}, 
Version 1.1 or later, published by the Free Software Foundation,
with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover 
Texts.\\
A copy of this license exists under the section entitled :\\
{\tt GNU Free Documentation License} (chapter \ref{sec:fdl}, 
p. \pageref{sec:fdl}).


\newpage 
{\bf \centerline{Preface}}

\vspace{0.2cm}

The {\tt HP40G} marked a new stage in the democratisation of the use of 
symbolic calculation, on the one hand by its competitive price, and on the
other hand by making it possible to execute, step-by-step, the principle 
algorithms taught in mathematics at secondary schools and in the first years of
University. 

But it was still necessary to add adequate documentation, preferably written 
by a teacher of mathematics. That is what you find in this guide, written by 
Renée De Graeve. 
%Lecturer at the University of Grenoble I and founder of the Grenoble IREM. 
It contains, naturally, a complete reference of the functions 
for symbolic calculation, but also demonstrates, using examples taken from 
study for both certificate and diploma, how to take smart advantage of the 
calculating power of the {\tt HP40GS}. 
The guide ends with two chapters dedicated to 
programming: the first for learning to program, and the second to illustrate 
the application of algorithmic language to arithmetic programs as taught in 
French tertiary schools.

This guide is an update for the {\tt HP40GS} calculator, with some
documentation improvements in addition to the {\tt HP40GS} software
and speed improvements.

{ \flushright
Bernard Parisse\\
\flushright Lecturer at the University of Grenoble I\\
}

\vfill

\chapter{To Begin}
\section{General Information}
\subsection{Starting the Calculator}
Press the {\tt ON} button.\\
The {\tt HOME} screen is displayed.\\
As you work, you can use the {\tt ON} button to cancel the current operation. In other words, it has the same function as {\tt CANCEL}.\\
To turn the calculator off, press {\tt SHIFT} plus {\tt ON (OFF)}.\\
If the calculator fails to respond after several presses of the 
{\tt ON ( CANCEL)} button, you can press {\tt ON} and {\tt F3} simultaneously 
to reinitialise the calculator.
\subsection{What You See}
>From top to bottom:\\
1.The {\tt HOME} screen

 1.a The calculator's status

 1.b A horizontal line

 1.c A menu bar of commands\\
2. The keyboard\\

\noindent 1. The {\tt HOME} screen :

1.a The calculator's status gives the {\tt HOME} screen's current mode:
\begin{itemize}
\item {\tt RAD}, {\tt DEG}, or {\tt GRD} when you are working with radians, 
degrees, or gradians.
\item {\tt \{FUNCTION\}} to indicate the name of the {\tt Aplet} currently 
selected here, the {\tt Function Aplet}.
\item $\blacktriangle$ to indicate that you can use the up-arrow to move back 
through the history.
\end{itemize}
1.b Horizontal line :\\
- Above the horizontal line is found an overview of the calculations carried 
out in the {\tt HOME} screen.\\
{\sc Principle} : On the screen, the requested calculation is written on the 
left, and the result is written on the right.\\
- Beneath the horizontal line is the command line.\\
Using the up-arrow, you can move back through the history and, using {\tt COPY}
 on the menu bar, copy a command or a preceding result into the command line.\\
1.c Menu Bar:\\
The commands on the menu bar are accessible through the six unlabelled grey 
keys, which we refer to here as :\\
{\tt F1 F2 F3 F4 F5 F6}.\\
The menu bar can contain items consisting of groups of commands; they are 
marked by a folder icon.\\
To activate a command on the menu bar, it's enough to press the corresponding 
{\tt Fi} key.\\
In the {\tt HOME} screen, the menu bar contains two commands:\\
- ${\tt STO \triangleright}$ which enables you to store a value in a variable, 
and\\
- {\tt CAS}, which enables you to open the Equation Editor to perform computer 
algebra.\\
2. The keyboard :\\
You have already been introduced to:\\
The {\tt ON} key for starting the calculator or for cancelling the current 
operation, and {\tt SHIFT} {\tt  ON} for turning the calculator off.\\
Other keys you must know include:
\begin{itemize}
\item The four arrow keys (left, right, up, down), which enable you to move the
 cursor while you're in the Equation Editor, in a menu, and so on,
\item The {\tt SHIFT} key, which enables you to access two functions with one
 key,
\item The {\tt ALPHA} key for typing text in upper case, and the 
{\tt SHIFT ALPHA} keys for typing text in lower case.
To remain in alphabetic mode, you must press and hold the {\tt ALPHA} key.
\item ${\tt X\ T\ \theta}$ which enable you to type ${\tt X,\ T,\ \theta, N}$
 directly, depending on the active aplet.
\item The {\tt ENTER} key, which is used to confirm a command.
\end{itemize}
\section{Notations}
The four arrow keys are represented by four triangles:\\
$$\vartriangle\  \lhd \  \rhd \ \triangledown  $$ \index{\tt $ \vartriangle\  \lhd \  \rhd \ \triangledown$}
The ${\tt STO\triangleright}$ on the {\tt HOME} menu is represented in the 
program by:\\
$$ {\tt STO\triangleright \mbox{ or }\triangleright} \mbox{ or }->$$\index{$\triangleright$}\index{STO$\triangleright$}\index{->}
In the Equation Editor, the position of the cursor is represented by:
$$\blacktriangleleft$$\index{$\blacktriangleleft$}

\section{Online Help}\index{HELP}
With this calculator, you're able to get practical and efficient online
help in either French or English (cf \ref{sec:cfg}).\\
You are shown an alphabetised list of computer algebra functions. As with the 
drop-down menus, you are able to access the functions by pressing the 
corresponding letter-keys without having to worry about pressing {\tt ALPHA}.\\
The help consists of a succinct description of the command, as well as an 
example and its result. Each example can be tested with {\tt ECHO} (on the 
menu) and can be either used as is or modified.  You can view help for related 
commands by means of {\tt SEE1 SEE2}... on the menu. You have to use
{\tt EXIT} to return,  without change, in the Equation Editor.\\ 
For more details, refer 
to the description of {\tt SHIFT 2 (SYNTAX)}, sections \ref{sec:syntaxe} and 
\ref{sec:syntax}.

\chapter{Aplets}
\section{{\tt APLET} Key}
The {\tt APLET} key gives you access to the list of available {\tt Aplets}.\\
This calculator in effect enables you to work with {\tt Aplets}.\\
But what is an {\tt Aplet} ?\\
An {\tt Aplet} is a program stored in the calculator, which enables you to 
easily obtain three views of a mathematical object (a symbolic view, a numeric 
view, and a graphic view) and all this is pre-programmed !\\
The various {\tt Aplets} enable you to work with mathematical objects such as: 
functions, sequences, statistical data, and so on...\\
Certain {\tt Aplets} illustrate particular classroom lessons.
\section{The Various aplets}
While you're in {\tt HOME}, you can see the name of the selected aplet by 
looking at the status line.\\
Here are the possible choices for the {\tt APLET} key:
\begin{itemize}
\item {\tt Sequence}\\
This {\tt Aplet} enables you to define sequences having the names:\\
{\tt U1, U2 .. U9, U0}\\
One defines {\tt U1(N)}:\\
- To be a function of {\tt N},\\
- To be a function of {\tt U1(N-1)},\\
- To be a function of {\tt U1(N-1)} and {\tt U1(N-2)}.\\
You define (for example):\\
{\tt U1(N) = N*N+1}\\
and then the values of {\tt U1(1)} and {\tt U1(2)} are automatically calculated
 and displayed.\\
To display the values of {\tt U1(N)}, choose {\tt U1}, then press {\tt NUM}.\\
You can find other examples that use the {\tt Sequence Aplet} in the following 
section, such as the calculation of the {\tt GCD} of two numbers 
(cf \ref{sec:pgcd}), and the calculation of the coefficients of Bézout's 
Identity (cf \ref{sec:bezout}).
\item {\tt Function}\\
This {\tt Aplet} enables you to define functions having the names:\\
{\tt F1(X), F2(X) .. F9(X), F0(X)}\\
One defines {\tt F1(X)} :\\
- To be an expression of a function of {\tt X}:\\
For example, the formula:\\
{\tt F1(X) = X*LN(X)} defines the function: \\
$f1(x) = x.\ln(x)$\\
- To use Booleans ({\tt X(0} etc.) if the function is defined in parts :\\
For example, a formula of the form:\\
{\tt F1(X) = X((X(0)+2(X((X>0)} defines the function:\\
$f_1(x) = x$ if $x< 0$ and\\
$f_1(x) = 2 \cdot x$ if $x \geq 0$
\item {\tt Parametric} for tracing curves in parametric coordinates.
\item {\tt Polar} for tracing curves in polar coordinates.
\item {\tt Solve} for solving numeric equations.
\item {\tt Statistics} for working with statistics.
\item {\tt Inference} for working with inferential statistics.
\item {\tt Quad Explorer} for exploring quadratic functions.
\item {\tt Trig Explorer} for exploring trigonometric functions.
\end{itemize}
\section{Examples using the {\tt Sequence Aplet}}
\subsection{Notation in Base $b$}
Given $a$ and $b$, produce the series $q_n$ ($  n \geq 1$) and $r_n$  
($n \geq 2$) from the quotients and the remainders of the division of $q_i$ by 
$b$, defined by:\\
$q_1=a$\\
$q_1=b \cdot q_2+r_2 \ (0 \leq r_2 < b)$\\
$q_2=b \cdot q_3+r_3 \ (0 \leq r_3 < b)$\\
 ......\\
$q_{n-1}=b \cdot q_n+r_n \ (0 \leq r_n < b)$\\
Note that if $r_{n+1}=0$, the number $r_n r_{n-1} .....r_3r_2$ is notated in 
base $b$ of $a$, while one assumes $2 \leq b \leq 10$.\\
Put into {\tt B} the value of the base, for example:\\
 ${\tt 7\ STO\triangleright\ B}$ \\
Put into {\tt A} the number to write in base {\tt B} (for example, 
${\tt 1789\ STO\triangleright\ A}$ )\\
Define the following two series:\\
{\tt U1(1)=A}\\
{\tt U1(2)=FLOOR(A/B)}\\
{\tt U1(N)=FLOOR(U1(N-1)/B)}\\
and\\
{\tt U2(1)=0}\\
{\tt U2(2)=A MOD B}\\
{\tt U2(N)=U1(N-1) MOD B }\\
Therefore, $q_n$={\tt U1(N)} and $r_n $={\tt U2(N)}.\\
We obtain :\\
{\tt U2(2)=4 U2(3)=3 U2(4)=1 U2(5)=5 U2(6)=0}\\
 and so the notation in base 7 of 1789 is: 5134.
\subsection{Calculating the GCD} \label{sec:pgcd}
This is an application of Euclid's Algorithm on the {\tt HP40GS}.\\
Here is the description of this algorithm:\\
If one performs the successive Euclidean divisions:
\begin{eqnarray*}
A = &  B \times Q_1+R_1   &  0 \leq R_1 < B \\
B  = & R_1 \times Q_2+R_2  & 0 \leq R_2 < R_1 \\
R_1  = & R_2 \times Q_3+R_3 & 0 \leq R_3 < R_2 \\
.......\\
R_{n-2}  = & R_{n-1} \times Q_n+R_n & 0 \leq R_n < R_{n-1} 
\end{eqnarray*}
then after a finite number of steps (in excess of $B$), there exists a whole 
number $n$ such that: $R_n = 0.$ \\
We have then:\\
$GCD (A,B) = GCD (B, R_1) =...$\\
$GCD (R_{n-1}, R_n) = GCD (R_{n-1},0) = R_{n-1}$\\
Using a sequence, one then writes the sequences of remainders.\\
With the {\tt HP40GS}, you use the {\tt Sequence Aplet} ({\tt APLET} key, then 
select {\tt Sequence}, then {\tt START} on the menu bar).\\
To determine the GCD(78,56), you define the sequence:\\

${\tt U1(1)=78} $ 

${\tt  U1(2)=56} $ 

${\tt  U1(N)=U1(N-2)\  MOD \  U1(N-1)}$

Press {\tt NUM} to get the numerical list of {\tt U1(N)} that is, the list of 
the remainders of the successive divisions...\\
The final non-zero remainder is 2, so the $GCD(78,56)=2$.\\
{\sc Remark}:\\
In {\tt HOME}, you can use the variables {\tt A} and {\tt B} to store the two 
numbers, and then make {\tt U1(1)=A} and {\tt U1(2)=B}.\\
It's also important to note that {\tt A MOD 0 = A}.
\subsection{Calculating the Coefficients of Bézout's Identity}\label{sec:bezout}
Euclid's Algorithm enables you to find a pair $U$, $V$ such that:

$ A \times U + B \times V= PGCD(A,B) $\\
Using the idea of sequence:\\
Define "the sequence of remainder" $R_n$ and two sequences $U_n$ and $V_n$,
 such that at each step one has:\\
$R_n=U_n \times A+V_n \times B$.

Seeing that one has:\\
$R_n=R_{n-2}-Q_n \times R_{n-1}$ , $U_n$ and  $V_n$ serve to satisfy the same 
recurrence relation (where $Q_n$ is the whole-number quotient of $R_{n-2}$
 divided by $R_{n-1}$).

One then has (from the beginning):

$R_1=A \  R_2=B$

$U_1=1 \ U_2=0$ since $A=1 \times A+0 \times B$

$V_1=0 \ V_2=1$ since $B=0 \times A+1 \times B$

With the {\tt HP40GS}, using the {\tt Sequence Aplet}, you then define the 
sequence of remainders {\tt U1} and the sequences {\tt U2} and {\tt U3}
 such that for all {\tt N} one has: \\
{\tt U1(N)=A*U2(N)+B*U3(N)}.\\
For this, you need the sequence of quotients, which you put into {\tt U4}.\\
The sequences {\tt U1}, {\tt U2} and {\tt U3} satisfy the same recurrence 
relation:\\
$U_n=U_{n-2}-Q_n \times U_{n-1} $
 with

$Q_n={\tt U4(N)=FLOOR(U1(N-2)/U1(N-1))}$

On définit donc :

${\tt U1(1)=A} $ 

${\tt U1(2)=B} $ 

${\tt U1(N)=U1(N-2)-U4(N)* U1(N-1)}$

${\tt U2(1)=1} $

${\tt U2(2)=0} $ 

${\tt U2(N)=U2(N-2)-U4(N)* U2(N-1)}$

${\tt U3(1)=0}$

${\tt U3(2)=1 }$

${\tt U3(N)=U3(N-2)-U4(N)* U3(N-1)}$

${\tt U4(1)=0} $


${\tt U4(2)=0} $

${\tt U4(N)=FLOOR(U1(N-2)/U1(N-1))}$

It's important to note that you use {\tt U4(N)} only for {\tt N > 2}; you have 
therefore defined the two first values (which are useless!) as zero.\\
{\tt NUM} then displays the values of these various sequences, and on the line of the final non-zero remainder you can read the GCD and the coefficients of Bézout's Identity.
\section{The {\tt SYMB, NUM, PLOT} and {\tt MODES} Keys}
In general, an {\tt Aplet} can be viewed in three different ways:\\
A symbolic view, which corresponds to the {\tt SYMB} key\\
A numeric view, which corresponds to the {\tt NUM} key\\
A graphic view, which corresponds to the {\tt PLOT} key\\
When these keys are  SHIFTed ({\tt SETUP}), this corresponds to choosing the 
various available parameters (choosing the parameters of the graphic window, 
the step size for the table etc...).\\
The {\tt SHIFT HOME (MODES)} key pressed in {\tt HOME} screen or in 
{\tt Aplets}, corresponds to the choice between Radians, 
Degrees or Grads.

%%%% HP40GS BEGIN CAS %%%%%

%%%% CAS INTRO %%%%

\chapter{{\tt CAS} user's guide}

\section{Terms and Conditions}

{\bf
Use of the CAS Software requires from the user an appropriate mathematical 
knowledge. There is no warranty for the CAS Software, to the extent 
permitted by applicable law. Except when otherwise stated in writing 
the copyright holder provides the CAS Software As Is without warranty of 
any kind, either expressed or implied, including, but not limited to, 
the implied warranties of merchantability and fitness for a particular purpose.
The entire risk as to the quality and performance of the CAS Software is 
with you. Should the CAS Software prove defective, you assume the cost 
of all necessary servicing, repair or correction.

In no event unless required by applicable law will any copyright holder 
be liable to you for damages, including any general, special, incidental 
or consequential damages arising out of the use or inability to use the 
CAS Software (including but not limited to loss of data or data being 
rendered inaccurate or losses sustained by you or third parties or a 
failure of the CAS Software to operate with any other programs), even if 
such holder or other party has been advised of the possibility of such 
damages. If required by applicable law the maximum amount payable for 
damages by the copyright holder shall not exceed the royalty amount 
paid by Hewlett-Packard to the copyright holder for the CAS Software
}

Note that a large part of the HP40GS CAS is 
(c) Bernard Parisse, Institut Fourier, Université de Grenoble I, France.
This part is also licensed under the LGPL License as published by the 
Free Software Foundation; either version 2 of the License, or 
(at your option) any later version.\\
For more details, see\\
\verb|http://www-fourier.ujf-grenoble.fr/~parisse|

\section{Introduction}
The word {\tt CAS} is a shortcut for Computer Algebra System.
This chapter gives a brief overview on the HP40GS CAS.

\subsection{What is {\tt CAS}?}\label{sec:exarg}
The {\tt CAS} enables you to perform exact or symbolic calculations. 
Make sure you understand the difference between:
\begin{itemize}
\item 
exact or symbolic calculations, which are performed by means of the {\tt CAS}
functions.  You work in {\tt exact mode}, with infinite precision, and
\item numeric calculations, which are performed by means of the 
{\tt MATH} key's {\tt MTH} menu, either in the {\tt HOME} screen 
or in {\tt Aplets} or programs. You work in {\tt approximate mode}, 
with a precision of $10^{-12}$.
\end{itemize}
Example:  \\
If you're working in the {\tt HOME} screen:\\
{\tt 1/2+1/6} returns 0.6666666666667\\
whereas in {\tt CAS}:\\
{\tt 1/2+1/6} will return  {\tt 2/3}.

Each mode has advantages and drawbacks, in exact mode there is
no round-off error, but some computations require much more time
and memory than in numeric mode. For example computing the factorial
of 300 is slightly faster in numeric mode than in exact mode.

\subsection{How do you perform a symbolic calculation?}
The {\tt HP40GS} has been designed to use computer algebra functions 
from a special environment: the Equation Editor. 
You can, however, perform computer algebra 
in the {\tt HOME} screen, as long as you take certain precautions 
(cf \ref{sec:cashome}), and it is mandatory if you want do
symbolic linear algebra, since the Equation Editor does
not handle vectors and matrices.

To open the Equation Editor, press {\tt CAS} on the menu bar 
of the {\tt HOME} screen.\\
To leave the Equation Editor, press {\tt HOME} to return to the {\tt HOME}
screen.

Section \ref{sec:eqw} describes how to use the {\tt CAS} functions
from the Equation Editor, section \ref{sec:cashome} how to use
the {\tt CAS} functions from the {\tt HOME}
screen and chapter \ref{sec:cas} describes the {\tt CAS} functions.

\subsection{Variables}
When you use the symbolic calculation functions, you are working with symbolic 
variables (variables that do not contain a permanent value).
In the {\tt HOME} screen, a variable of this kind must have a 
name like {\tt S1..S5,s1.. s5,n1..n5}, but not {\tt X} which is assigned
to a real value (by default {\tt X} is assigned to 0) and to store for
 symbolic expressions, the variables are {\tt E0,E1..E9}. In the Equation 
Editor, all variables may, or may not be,
assigned: for example {\tt X} is not assigned to a real value by
default, computing {\tt X+X} will return {\tt 2X}. Moreover,
Equation Editor variables may have long names, like {\tt XY} or
{\tt ABC}, unlike in {\tt HOME} where implied multiplication
is assumed (for example {\tt ABC} becomes {\tt A*B*C} in {\tt HOME}). 
For these reasons,variables used in the Equation Editor cannot be used in 
{\tt HOME}, and vice versa.
Using the command {\tt PUSH}, you can transfer expressions 
from the {\tt HOME} screen history to the {\tt CAS} history (cf section 
\ref{sec:push}) and using the command {\tt POP}, you can also transfer 
expressions from the {\tt CAS} history to the {\tt HOME} screen  history 
(cf section \ref{sec:pop}).
\subsection{The current variable}
In the Equation Editor, the current variable is the
name of the symbolic variable contained in {\tt VX},
it is almost always {\tt X}.\\
The current variable is always {\tt S1} in the {\tt HOME} screen.\\
Some {\tt CAS} functions depend on a current variable, for example, 
the function {\tt DERVX} calculates the derivative with respect to the 
current variable.

Hence in the Equation Editor,\\
{\tt DERVX(2*X+Y)} returns 2 if {\tt VX=X}, but\\
{\tt DERVX(2*X+Y)} returns 1 if {\tt VX=Y} and\\
in the {\tt HOME} screen,\\ 
{\tt DERVX(2*S1+S2)=2}, but\\
{\tt DERIV(2*S1+S2,S2)=1}.


%%%% EQW CHAPTER %%%%%%
\section{Using the CAS in the Equation Editor} \label{sec:eqw}
The Equation Editor enables you to type expressions that you want to simplify, 
factor, differentiate, integrate, and so on, and then work them through as if 
on paper.

The {\tt CAS} key on the {\tt HOME}
menu bar takes you into the Equation Editor, and the 
{\tt HOME} key takes you back out.

This section tells you how to write an expression in the Equation Editor
using the menus (section \ref{sec:eqwmenu}) and the keyboard
(section \ref{sec:eqwkbd}), 
how to select a sub-expression (section \ref{sec:eqwsub}), 
how to call the {\tt CAS} functions on a sub-expression (section
\ref{sec:eqwsub}) and how to store values in the
Equation Editor variables (section \ref{sec:eqwvar}).
Chapter \ref{sec:cas} 
explains all the symbolic calculation functions contained in 
the various menus, together with examples of use.\\
You can consult the online help with {\tt SHIFT 2 (SYNTAX)} 
(cf \ref{sec:syntaxe}), to get help for the other available functions, and you 
can use {\tt SHIFT {\tt MATH} (CMDS)} (cf \ref{sec:cmds}), to type them.

\subsection{The Equation editor menu}\label{sec:eqwmenu} 
The editor is supplied with a menu bar of menus:
\begin{enumerate}
\item The {\tt TOOL} menu contains the commands:
\begin{itemize}
\item {\tt Cursor mode} \index{Cursor mode} enables you to go into cursor mode 
(cf \ref{sec:curseur}).
\item {\tt Edit expr.} \index{Edit expr.} enables you to edit (modify) the 
highlighted expression.
\item {\tt Change font} \index{Change font} enables you to choose to type using
 large or small 
characters (you can make this choice at any time).
\item {\tt Cut} \index{Cut} copies the selection into the buffer, then erases 
the selection.
\item {\tt Copy} \index{Copy} copies the selection into the buffer.
\item {\tt Paste} \index{Paste} copies the buffer to the location of the 
cursor. The buffer contains, either whatever {\tt Copy} or {\tt Cut} has 
selected the last time, or the highlighted level when you hit {\tt COPY} in the CAS history toolbar.
\end{itemize}
\item The ALGB menu contains functions that enable you to perform algebra: factoring, expansion, simplification, substitution...
\item The DIFF menu contains functions that enable you to perform differential calculus: differentiation, integration, series expansion, limits...
\item The REWRI menu contains functions that enable you to rewrite an expression in another form.
\item The SOLV menu contains functions that enable you to solve equations, linear systems, and differential equations.
\item The TRIG menu contains functions that enable you to transform trigonometric expressions.
\end{enumerate}

\subsection{The keyboard in the Equation Editor} \label{sec:eqwkbd}
The keys mentioned in this section have different functions depending on 
whether they are pressed in the {\tt Equation Editor} or in the {\tt HOME} 
screen. For the functionality of these keys outside the Equation Editor, refer 
to section  \ref{sec:thome}, or consult the User's Guide.

\subsubsection{{\tt MATH} key}\label{sec:tmath}
The {\tt MATH} key, if pressed in the Equation Editor, displays the functions 
used in symbolic calculation. These functions are contained in menus:
\begin{itemize}
\item The five preceding menus (cf \ref{sec:eqwmenu}) :\\
{\tt Algebra\,(ALGB)},~  {\tt Diff\&Int\,(DIFF)}, ~ {\tt Rewrite\,(REWRI)},\\
{\tt Solve\,(SOLV)},~{\tt Trig.\,(TRIG)}.
\item The {\tt Complex} menu containing functions that enable you to work with complex numbers
\item The {\tt Constant} menu containing${\tt e\ i \ \infty \ \ pi}$.
\item The {\tt Hyperb.} menu containing hyperbolic functions 
\item The {\tt Integer} menu containing functions that enable you to perform 
integer arithmetic.
\item The {\tt Modular} menu containing functions that enable you to perform
 calculations in $Z/pZ$ or $Z/pZ[X]$,  $p$ being the value contained in the 
variable {\tt MODULO}.
\item The {\tt Polynom.} menu containing functions that enable you to perform calculations with polynomials.
\item The {\tt Tests} menu containing:\\
{\tt ASSUME}\index{ASSUME}
{\tt UNASSUME }\index{UNASSUME} (to make hypotheses about the parameters, and to modify the variable  {\tt REALASSUME}\index{REALASSUME}  
cf \ref{sec:realassume})\\
${\tt  > \ \geq \ < \ \leq \  == \  \neq}$ {\tt  AND \ OR \ NOT}\\
{\tt IFTE}\index{IFTE} (to write an algebraic function having the same result as an IF THEN ELSE)
\end{itemize}
Refer to section \ref{sec:math}, for the list of the functions contained in the various menus.

\subsubsection{{\tt SHIFT {\tt MATH} (CMDS)} keys}\label{sec:cmds}
This key combination opens the list of all the {\tt CAS} commands available 
in the {\tt Equation Editor}.\\
In this way, functions that are not presented elsewhere can be called from this
menu, so you don't have to type them in {\tt ALPHA} mode.

\subsubsection{{\tt VARS} key}\label{sec:vars}
This key, if pressed while you're in the {\tt Equation Editor}, displays the 
names of the variables defined in {\tt CAS}.\\
Take special note of {\tt namVX}, which contains the name of the current 
variable.\\
To see the contents of a variable, all you have to do is highlight its name 
and press {\tt F2} for {\tt VIEW} on the menu bar.\\
To change the contents of a variable, highlight its name and press {\tt F3} for
 {\tt EDIT} on the menu bar.\\
Note also on the menu bar:\\
{\tt PURGE}, which enables you to destroy an existing variable,\\
{\tt RENAME}, which enables you to change the name of an existing variable,\\
{\tt NEW}, which enables you to define a new variable: just enter the contents
({\tt object}), then the ({\tt name}).\\
For more details, refer to section \ref{sec:eqwvar}.
\subsubsection{{\tt SHIFT 2 (SYNTAX)} keys}\label{sec:syntaxe}\index{HELP}
While you're in the Equation Editor, the key combination {\tt SHIFT 2 (SYNTAX)}
opens the  {\tt CAS HELP ON} menu.\\
To get help in French, choose Français on the  {\tt CFG} menu, which enables 
you to change your configuration (cf \ref{sec:cfg}).\\
If there is no {\tt CAS} function selected in the editor, the menu shows a list
of functions available in the {\tt Equation Editor}. Just highlight a function
and press {\tt OK} to see the help for that function.\\
If there is a {\tt CAS} function selected in the editor, for example: \\
{\tt FACTOR(45)}, the {\tt CAS HELP ON} menu directly opens the help topic for 
{\tt FACTOR}. The help consists of a short description of the command, as well 
as an example and its result. Each example can be copied into the 
{\tt Equation Editor} by means of {\tt ECHO} on the menu bar, where it can be 
used as is or modified.\\
Note that in the help examples, {\tt VX=X} is used as the current variable. If
that is not the case for you, the example will be automatically transformed, 
taking your value of {\tt VX} into account , when you transfer it with 
{\tt ECHO}.\\
You can also go directly to see the help of a command pointed to by {\tt See:}
 with {\tt SEE1, SEE2...} on the menu bar.

\subsubsection{{\tt SYMB} key}\label{sec:history}
Pressing the {\tt SYMB} key in the Equation Editor enables you to access the 
{\tt CAS} history.\\
The history of the calculations performed in {\tt CAS} differs from the 
history of the calculations performed in {\tt HOME}.\\
As in the {\tt HOME} screen history, the requested calculations are written on 
the left, and the results are written on the right. Using the up-arrow, you 
can move back through the history.\\
Press {\tt COPY} to copy the current CAS history level in the buffer in 
order to paste it later with {\tt TOOL->Paste} in the Equation Editor.\\
Press {\tt ENTER}, or {\tt ECHO} on the menu bar, to replace the
current Equation Editor selection by the current CAS history level.\\
Press {\tt ON} to leave the CAS history without any changes.

\subsubsection{{\tt SHIFT SYMB} or {\tt SHIFT HOME} keys}\label{sec:config}
While you are working in the Equation Editor, the key combination:\\
{\tt SHIFT SYMB (SETUP)} or {\tt SHIFT HOME (MODES)} open the 
{\tt CAS MODES} screen to define the CAS  configuration and it is similar to
 {\tt CFG} menu (the first item in the {\tt ALGB} menu on the menu bar,
 cf \ref{sec:cfg}).\\
This enables you to specify:\\
- The name of the variable contained in {\tt VX}, by typing its name next to 
{\tt Indep var.},\\
- The value of {\tt MODULO}, by typing its value next to {\tt Modulo},\\
- Whether you want to work in {\tt exact mode} (or in {\tt approximate mode}, 
if you've chosen {\tt Approx} with {\tt CHK} on the menu bar)\\
- Whether you want to work in real mode (or in complex mode, if you've chosen 
{\tt Complex} with {\tt CHK} on the menu bar)\\
- Whether you want to work in {\tt Direct} mode (or in {\tt Step by Step} mode,
 if you've chosen {\tt Step/Step} with {\tt CHK} on the menu bar)\\
- Whether you want polynomials to be written in decreasing order according to 
exponent (or increasing order, if you've chosen {\tt Incr Pow} with {\tt CHK}
 on the menu bar)\\
- Whether you want numerical factors suppressed (or not, if you've chosen 
{\tt Num.Factor} with {\tt CHK} on the menu bar)\\
- Whether you want to work in {\tt non-rigorous} mode (or in {\tt rigorous} 
mode, if you've chosen {\tt Rigorous} with {\tt CHK} on the menu bar so as not
 to neglect the absolute values!)\\
- Whether you want to simplify non-rational expressions if you've chosen 
{\tt Simp Non-Rational} (or not, if you clear the selection by pressing 
{\tt CHK} on the menu bar).\\
Use {\tt OK} or {\tt ENTER} to confirm your choices.
\subsubsection{{\tt SHIFT ,} key}\label{sec:undo}
While you are working in the Equation Editor, the key combination:\\
{\tt SHIFT ,(MEMORY)} plays the role of an "undo" key.\\
This is very useful when you've made a mistake, because it enables you to cancel the last command.

\subsubsection{{\tt PLOT} key}
When you press {\tt PLOT} in the Equation Editor, a dialog box asks you if you want to graph a function, a parametric curve, or a polar curve.\\
Depending on what you choose, the highlighted expression is copied into the 
appropriate aplet, to the location that you have specified as the destination.\\
{\sc Note} : This supposes that the current variable is also the variable of 
the function or curve you want to graph: when the expression is copied,
 it is evaluated, and the current variable (variable contained in {\tt VX}) is 
changed to {\tt X, T}, or ${\tt \theta}$, depending on the type of plot.\\
{\sc Note} : If the function depends on a parameter, it is preferable to give 
the  parameter a value before pressing {\tt PLOT}. If, however, you want the 
parameterised expression to be copied with its parameter, then the name of 
the parameter must consist of a single letter other than {\tt X, T}, or
 ${\tt \theta}$, so that there is no confusion.\\
If the highlighted expression has real values :\\
the {\tt Function Aplet} or {\tt Polar Aplet} can be chosen, and the graph
will be of {\tt Function} or {\tt Polar} type.\\
If the highlighted expression has complex values :\\
the {\tt Parametric Aplet} must be chosen, and the graph
will be of {\tt Parametric} type.\\
If you choose:
\begin{itemize}
\item the {\tt Function Aplet}, the highlighted expression is copied into the 
chosen function {\tt Fi}, and the current variable is changed to {\tt X} 
during the copy.
\item the {\tt Parametric Aplet}, the real part and the imaginary part of the 
highlighted expression are copied into the chosen functions {\tt Xi, Yi}, and 
the current variable is changed to {\tt T} during the copy.
\item the {\tt Polar Aplet}, the highlighted expression is copied into the 
chosen function {\tt Ri}, and the current variable is changed to ${\tt \theta}$ during the copy.
\end{itemize}

\subsubsection{{\tt NUM} key}
Pressing the {\tt NUM} key in the Equation Editor causes the highlighted 
expression to be replaced by a numeric approximation.\\
{\tt NUM} puts the calculator into approximate mode.
\subsubsection{{\tt SHIFT NUM} key} 
Pressing the {\tt SHIFT NUM} key in the Equation Editor causes the highlighted 
expression to be replaced by a rationnal number.\\
{\tt SHIFT NUM} puts the calculator into exact mode.
\subsubsection{{\tt VIEWS} key}
Pressing the {\tt VIEWS} key in the Equation Editor enables you to move 
the cursor with the $\rhd$  and $\lhd$ arrows to see the entire highlighted 
expression.\\
Then press {\tt OK} on the menu bar to return in the Equation Editor.

\subsubsection{Short-cut keys}
Note:  In the Equation Editor, the following short-cut keys are available on 
the keyboard:\\
{\tt SHIFT 0} for ${\tt \infty}$\\
{\tt SHIFT 1} for ${\tt i}$\\
{\tt SHIFT 2} to open the {\tt CAS HELP ON}\\
{\tt SHIFT 3} for ${\tt \pi}$\\
{\tt SHIFT 5} for ${\tt <}$\\
{\tt SHIFT 6} for ${\tt >}$\\
{\tt SHIFT 8} for ${\tt \leq}$\\
{\tt SHIFT 9} for ${\tt \geq}$\\
{\tt SHIFT NUM} to put the calculator into exact mode\\
{\tt NUM} to put the calculator into approximate mode. 
\subsection{Expressions, subexpressions, selection} \label{sec:eqwsub}
When you type expressions in the Equation Editor, the operator that you are 
typing always carries over to the adjacent or selected expression.\\
You don't have to preoccupy yourself with where the parentheses go... just select!\\
You need to view a mathematical expression as a binary tree, and the four arrow keys as enabling you move through the tree in a natural fashion:\\
The right and left arrow keys enable you to move from one branch to another,\\
The up and down arrow keys enable you to go up and down a particular tree,\\
The SHIFT-up and SHIFT-down arrow keys enable you to make multiple selection 
(cf page \pageref{sec:exemple3} example 3).

\subsubsection{How do you select?}\label{sec:exemple2}
There are two ways of going into selection mode :
\begin{itemize}
\item
The up-arrow $\vartriangle$ takes you into selection mode and selects the element 
adjacent to the cursor.\\
Example:
$$1+2+3+4 \ \vartriangle$$
selects 4, then $\vartriangle$ selects the entire tree 1+2+3+4.\\
\item
The right-arrow $\rhd$ takes you into selection mode and selects the branch 
adjacent to the cursor.\\
Pressing $\rhd$ again augments the selection, adding the next branch to the 
right.\\
Example:\\
$$1+2+3+4 \ \rhd$$
selects 3 + 4, then $\rhd$ selects 2+3+4, then $\rhd$ selects 1+2+3+4.
\item {\sc Note}:  If you are typing a templated function with multiple 
arguments (such as $\sum$, $\int$, SUBST, or the like), the right arrow $\rhd$
enables you to move through the template by changing the location of the 
cursor.  In effect, the left and right arrow, keys $\lhd$ and $\rhd$ enable 
you to move from one argument to another. In this case, you always use the up 
arrow $\vartriangle$ to select (cf \ref{sec:sum}).\\
\end{itemize}
Examples of the way this Equation Editor works:\\
Press {\tt CAS} on the menu bar to open the Equation Editor, then type the 
expressions in the examples.\\
\begin{itemize}
\item Example 1\\
Typing: 
 $${\tt 2\ +\ X\  \times \ 3 \ -\ X }$$
returns:
$${\tt 2+X \cdot 3-X}$$
Press $\rhd$ $\rhd$ $\rhd$ to select the expression,\\
then the {\tt ENTER} key to produce:
$${\tt 2+2 \cdot X}$$
Typing:
$${\tt 2\ +\ X \ \rhd\  \times  \ 3 \ -\ X}$$    
returns:
$${\tt (2+X) \cdot 3-X}$$
Press $\rhd$ $\rhd$ to select the expression,\\
then the {\tt ENTER} key to produce:
$${\tt 6+2 \cdot X}$$
Typing:
$${\tt 2\ +\ X\  \rhd\  \times \ 3\  \vartriangle\  -\ X }$$
returns:
$${\tt (2+X) \cdot (3-X)}$$
Press $\rhd$ $\rhd$ $\rhd$ to select the expression,\\
then the {\tt ENTER} key to produce:
$${\tt-(X^2-X-6)}$$
\item Example 2 \\
To express:\\
$${\tt X^2-3 \cdot X+1}$$
type:
$${\tt X \ x^y \ 2 \ \rhd \ - \ 3 \ X \  + \ 1 }$$
To express:
$${\tt -X^2-3 \cdot X+1}$$
type:
$${\tt (-)\ X \ x^y \ 2 \ \rhd \rhd\ - \ 3 \ X \ + \ 1 }$$ 
In effect, you must select ${\tt -X^2}$ before typing the rest.
\item Example 3\label{sec:exemple3}\\
To express:
$$\frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\frac{1}{5}$$
Here, the tree ends in a $+$, and there are four branches; each of these 
branches ends in a $\div$ and has two leaves. 

Press {\tt CAS} on the menu bar to open the Equation Editor, then type the 
first branch:
$${\tt1 \div 2} $$
then select this branch with
$$ \rhd$$
Then, type
$$+$$
and the second branch:
$${\tt 1 \div 3}$$ 
then select this branch with
$$ \rhd$$
Then, type
$$+$$
and the third branch:
$${\tt 1 \div 4}$$
then select this branch with
$$ \rhd$$
Then, type
$$+$$
and the fourth branch:
$${\tt 1 \div 5}$$ 
then select this branch with
$$ \rhd$$
At this point, the desired expression :
 $${\tt \frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\frac{1}{5}}$$
is in the Equation Editor, and 
${\tt \frac{1}{5}}$ is selected.

To move back through the tree and select:
$${\tt\frac{1}{3}+\frac{1}{4}}$$
 type
$$ \lhd \ \lhd$$
to select the ${\tt \frac{1}{3}}$, then press
$${\tt SHIFT  \rhd}$$ 
which enables you to select two contiguous branches, the one already selected 
and the one to the right of it, like this:
$${\tt \frac{1}{3}+\frac{1}{4}}$$
Advantage : If you want, you can calculate the selected part by pressing 
{\tt ENTER}.\\
This produces:
$${\tt \frac{1}{2}+\frac{7}{12}+\frac{1}{5}}$$
with the $\frac{7}{12}$ selected.\\
If you want to perform the partial calculation
$$\frac{1}{2}+\frac{1}{5}$$
you must first perform a permutation so that the ${\tt \frac{1}{2}}$
and the ${\tt \frac{1}{5}}$ are side by side. To do this, type:
$${\tt SHIFT \lhd} $$
which exchanges the selected element with its neighbour to the left. This 
produces:
$$ {\tt \frac{7}{12}+\frac{1}{2}+\frac{1}{5}}$$
with the  ${\tt \frac{7}{12}}$ still selected. Press :
$${\tt \rhd SHIFT  \rhd}$$
to select :
$${\tt \frac{1}{2}+\frac{1}{5}}$$
Pressing {\tt ENTER} then produces the result.\\
\item Summing up:  ${\tt SHIFT \rhd}$ enables you to select the selected 
element and its neighbour to the right.
${\tt SHIFT \lhd}$ enables you to exchange the selected element with its
 neighbour to the left.
The selected element remains selected, even if you move it.
\end{itemize}

\subsubsection{How to modify an expression}
If you're typing an expression, the {\tt DEL} key enables you to erase what 
you've typed.

If you're selecting, you can:\\
- Cancel the selection without deleting the expression, by typing :
$${\tt DEL}$$
The cursor moves to the end of the deselected portion.\\
- Replace the selection with an expression, just by typing the desired expression\\
- Transform the selected expression by applying a {\tt CAS} function to it: 
you call the function via one of the {\tt CAS} menu options.\\
- Delete the selected expression by typing:
$${\tt ALPHA\ SHIFT\ DEL \ \ (ALPHA\ CLEAR)}$$
- Delete a selected unary operator "the top of the tree" by typing:
$${\tt  SHIFT\ DEL \ \ (CLEAR)} $$ 
For example, to replace {\tt SIN(expr)} with {\tt COS(expr)}, select 
{\tt SIN(expr)}, then press {\tt  SHIFT\ DEL} and press {\tt COS}.\\
- Delete a binary infix operator and one of its argument by selecting the 
argument you want delete and typing:
$${\tt SHIFT\ DEL \ \ (CLEAR)}$$
For example :
if you have the expression 1+2, you select 1, then
{\tt SHIFT DEL} deletes 1+ and it leaves only 2.\\
So, to delete {\tt F(X)=} of the expression {\tt F(X)=}${\tt X^2-X+1}$ you
select  {\tt F(X)}, then press {\tt SHIFT DEL}, and this produces  
${\tt X=X^2-X+1}$ (you have deleted the unary operatora {\tt F}), 
then {\tt  SHIFT DEL}, produces ${\tt X^2-X+1}$ (you have deleted {\tt X} and
the operator {\tt =}).\\
- Delete a binary operator by editing the expression, you select :
$${\tt Edit\ expr.}$$
from the {\tt TOOL} menu on the menu bar, and then make the correction.\\
- Copy an element from the CAS history. You access to the CAS history by 
pressing {\tt SYMB}. In the history, 
pressing {\tt ENTER} or selecting {\tt ECHO} on the menu bar inserts the 
copy where the cursor is, or in place of the selection.
You can also use {\tt COPY}, on the history menu bar, to copy the selection in 
the buffer, or the commands {\tt Cut, Copy and Paste} from the {\tt TOOL} menu 
on the Equation Editor menu bar to delete, copy and paste expressions as you 
would with any text editor 
(cf.\ref{sec:eqwmenu}).

\subsubsection{The cursor mode}\label{sec:curseur}
The cursor mode enables you to select a large expression quickly. To go into 
cursor mode, select:\\
Cursor mode in the {\tt TOOL} menu,\\
then use the arrow keys to include your selection in a box (when you release 
the arrow key, the expression pointed to by the cursor is enclosed).\\
Then, press {\tt ENTER} to select the contents of the box.

\subsubsection{To see everything}
By selecting {\tt Change font} from the {\tt TOOL} menu on the menu bar, you 
can increase or decrease the font size of the expression. 
This enables you to view a large expression in its entirety when you need to.\\
If this is insufficient to see the whole expression, then you'll need to go 
into cursor mode:\\
select {\tt Cursor mode} in the {\tt TOOL} menu, then use the arrow key $\rhd$,
 and then  use {\tt ENTER} to quit cursor mode,\\
or you can also press:\\
the {\tt VIEWS} key, then use the arrow key $\rhd$, and press {\tt OK} on the
menu bar to quit {\tt VIEWS} screen.

\subsection{Accessing the {\tt CAS} functions} \label{sec:eqwfun}
While you are in the Equation Editor, you can access all {\tt CAS} functions, and you can access them in various ways.

General principle:\\
When you have written an expression in the Equation Editor, all you have to do is press {\tt ENTER} to evaluate the selection (or the entire expression, if nothing is selected).

\subsubsection{How to type  $\int$ and $\sum$}\label{sec:sum}
 $\sum$ is found on the keyboard, all you have to do is type:
$${\tt SHIFT +\ (\sum)}$$
The symbol $\int$ is also found on the keyboard, it can be produced by typing:
$${\tt SHIFT \ d/dX \ (\int) }$$
The symbols ${\tt \int}$ and ${\tt \sum}$ are treated as prefix functions with 
multiple arguments.\\
 ${\tt \int}$ and ${\tt \sum}$ are automatically placed before the selected 
element, if there is one  (hence "prefix functions").\\
You can move the cursor with the arrow keys:
$${\tt \rhd \ \lhd} $$
Enter the expressions according to the rules of selection explained earlier,
 but you must first go into selection mode by pressing $\vartriangle$.\\
{\sc Note}: Do not use the index $i$ to define a summation, because $i$
 designates the complex-number solution of $x^2+1=0$.\\
$\sum $ performs exact calculations if its argument has a dicrete 
primitive else $\sum $ performs approximate calculations, even in
exact mode. For example in exact, or numeric mode : 
$$\sum_{k=0}^4 \frac{1}{k!}=2.70833333334$$ 
whereas in exact mode :
$$1+\frac{1}{1!}+\frac{1}{2!}+\frac{1}{3!}+\frac{1}{4!}=\frac{65}{24}$$
the symbol \ $!$ \  is obtained by typing ${\tt SHIFT\ \times}$.\\
Note that $\sum $ can symbolically calculate summations of rational 
fractions and hypergeometric series that allow a discrete primitive.\\
Example :\\
If you type:
$${\tt \sum_{K=1}^4 \frac{1}{K \cdot (K+1)}}$$
then select the entire expression and press {\tt ENTER}, you obtain:
$${\tt \frac{4}{5}}$$
If you type:
$${\tt \sum_{K=1}^\infty \frac{1}{K \cdot (K+1)}}$$
then select the entire expression and press {\tt ENTER}, you obtain:
$${\tt 1}$$

\subsubsection{How to call infix functions}\label{sec:and} 
These functions are typed between their arguments, for example :\\
{\tt AND | MOD ,} are infix functions.\\
You can either:\\
- type them in {\tt Alpha} mode (using {\tt AND MOD}), then type the 
arguments, or\\
- call them by selecting a {\tt CAS} menu option or by pressing a key, provided
 you have already written and selected the first argument.\\
You move from one argument to the other by using the arrow keys $\rhd\ \lhd$.\\
The comma {\tt ,} enables you to write a complex number:\\
when you type ${\tt 1+2 \cdot i}$ or {\tt (1,2)}, the parentheses are automatically 
placed when you type the comma.\\
If you want to type (-1,2), you must of course select -1 before you type the 
comma.

\subsubsection{How to call prefix functions}\label{sec:prefixe}
These functions are typed before their arguments (which is the usual case). 
To call a prefix function:\\
you can type the first argument, select it, then call the function using a 
menu,\\
or, you can call the function using a menu or a keystroke in {\tt Alpha} mode,
 then type the arguments.\\
The following example illustrates the different ways of calling a prefix 
function.\\
Example:\\
Say you want to factor the expression $x^2-4$, then find its value for $x=4$.
 You know that {\tt FACTOR} is the function for factoring, and that this 
function is found in the {\tt ALGB} menu.\\
You also know that {\tt SUBST} is the function for substituting a value for a 
variable in an expression, and that this function is found in the {\tt ALGB} 
menu as well.

{\bf First possibility: Function call, then arguments}\\
Press the {\tt F2} key to activate the {\tt ALGB} on the menu bar, then 
highlight {\tt FACTOR} and press {\tt ENTER}.\\
${\tt FACTOR(\ \blacktriangleleft )}$ is displayed in the editor, with the 
cursor between the parentheses.\\
 Type your expression, using the rules of selection given earlier:
$${\tt X \  X^y\  2\ \rhd - \ 4 \rhd \ \rhd \ \rhd} $$
The following is now selected:
$${\tt FACTOR (X^2-4 )}$$
Pressing {\tt ENTER} then produces the result:
$${\tt (X+2) \cdot (X-2)}$$
The result is selected, and replaces the command.\\
You do not see this, but after each {\tt ENTER}, the display is written to the history, so in this case, ${\tt \ FACTOR (X^2-4) \ }$ and the answer
${\tt \ (X+2) \cdot (X-2) \ } $ are written to the history (press {\tt SYMB}
to see the history and then press {\tt ON} to return to the Equation Editor).\\
At this point, you can erase the preceding result with 
{\tt ALPHA SHIFT DEL (CLEAR)}, because the result is selected.\\
Press the key that activates {\tt ALGB} on the menu bar, then highlight 
{\tt SUBST} and press {\tt ENTER}.
$${\tt SUBST (\blacktriangleleft  ,\bullet)}$$
is displayed in the editor, with the cursor between the parentheses at the l
ocation of the first argument.\\
Type your expression, using the rules of 
selection given earlier:\\
{\sc Note}:  Here, {\tt SUBST} has two arguments, so you must 
go into selection mode using $\vartriangle$ :
$${\tt X \  X^y\  2\ \vartriangle \ \vartriangle\ - \ 4 \rhd X=4\ \rhd \ \rhd} $$
The following is now selected:
$${\tt SUBST (X^2-4,X=4 )}$$
Pressing {\tt ENTER} then produces the result:
 $${\tt 4^2-4}$$
The result is selected, and replaces the command. 
Pressing {\tt ENTER} then yields the simplified result:
$${\tt 12}$$
Naturally, ${\tt \  SUBST (X^2-4,X=4)\ }$, ${\tt \  4^2-4 \ }$ and ${\tt \ 12}$
 are all written to the history.\\
{\sc Remark}:\\
When you call a {\tt CAS} function that has arguments, you can type it in 
{\tt Alpha} mode with its parentheses.

{\bf Second possibility: Arguments, then function call}\\
First of all, type the expression and select it using the rules of selection given earlier.\\
In this case, type:
$${\tt X \  X^y\  2\ \rhd - \ 4 \rhd \  \rhd } $$
Then call {\tt FACTOR}:\\
press the key {\tt F2} that activates {\tt  ALGB} on the menu bar, then 
highlight {\tt FACTOR} and press {\tt ENTER}.\\
This produces:
$${\tt FACTOR (X^2-4 )}$$
Pressing {\tt ENTER} then yields the result:
$${\tt (X+2) \cdot (X-2)}$$
The result is selected, and replaces the command.\\
Naturally, ${\tt\  FACTOR (X^2-4)\ }$ and ${\tt \ (X+2) \cdot (X-2)\ }$
 are both written to the history.\\
Recall now that because your result is selected, you can apply another 
command to it.\\
At this point, then, call {\tt SUBST}:  press the key {\tt F2} that activates 
{\tt ALGB} on the menu bar, then highlight {\tt SUBST} and press 
{\tt ENTER}.\\
$${\tt SUBST ((X+2) \cdot (X-2) , \blacktriangleleft )}$$
is displayed in the editor, with your expression as the first argument between 
the parentheses, and with the cursor at the location of the second argument.\\
All you have to do then is type:\\
${\tt X=4}$ then, $\rhd \ \rhd$, followed by {\tt ENTER}.\\
This produces:
$${\tt (4+2) \cdot (4-2)}$$
Pressing {\tt ENTER} then yields:
$${\tt 12}$$
Naturally, ${\tt SUBST (X^2-4,X=4 )}$, ${\tt \  (4+2) \cdot (4-2) \ }$ and
 ${\tt \ 12}$ are all written to the history.\\
{\sc Remark}:\\
If you call a {\tt CAS} function while you're writing an expression, whatever 
is currently selected is copied into the function's first or "main" argument. 
If nothing is selected, the cursor is placed at the appropriate location for 
completing the arguments.

\subsection{Equation editor variables} \label{sec:eqwvar}
You can store objects in variables, then access an object by using the name 
of its variable.\\
{\sc Notes}:\\
1- Variables used in {\tt CAS} cannot be used in {\tt HOME}, and vice versa.\\
2- In {\tt HOME} or in the program editor, use ${\tt STO\triangleright}$  
(represented here as ${\tt STO\triangleright}$ or ${\tt \triangleright}$ or ->)
 to store an object in a variable.\\
3- In {\tt CAS}, use the {\tt STORE} command (cf. \ref{sec:store}) to store a value in a variable.\\
4- The {\tt VARS} key displays a menu that contains all the available 
variables.\\
Pressing this key while you are in {\tt HOME} displays the names of the 
variables defined in {\tt HOME} and in the {\tt Aplets}.\\
Pressing this key while you are in the Equation Editor displays the names of 
the variables defined in {\tt CAS}.


\subsubsection{To store an object in a {\tt CAS} variable : {\tt STORE}}\index{STORE}\label{sec:store}
In {\tt CAS}, it is necessary to use the {\tt STORE} command to store an object 
in a variable, or to use the {\tt VARS} key in the Equation Editor (and then 
choose {\tt NEW} or {\tt EDIT} on the menu bar; cf. \ref{sec:vars}).\\
All you need to provide is the name of the variable.\\
{\tt STORE} is found in the {\tt ALGB} menu on the Equation Editor menu bar.\\
Example:\\
Type:
$${\tt STORE (X^2-4,ABC)}$$
Or, type:
$${\tt X^2-4}$$
then select it and call {\tt STORE}, \\
then type {\tt ABC}, then, {\tt ENTER} confirms the definition of the variable 
{\tt ABC}.\\
To destroy the variable, use the {\tt VARS} key in the Equation Editor (then 
choose {\tt PURGE} on the menu bar; cf. \ref{sec:vars}), or invoke the 
{\tt UNASSIGN} \index{UNASSIGN} command on the {\tt ALGB} menu by typing 
(for example):\\
$${\tt UNASSIGN(ABC)}$$
\subsubsection{Predefined {\tt CAS} variables}\label{sec:realassume}
{\tt VX} contains the name of the current symbolic variable.\\
Generally this is {\tt X}, so you should not use {\tt X} as the name of a 
numeric variable, or erase the contents of {\tt X} with the {\tt UNASSIGN}
 command in the {\tt ALGB} menu after having done a symbolic calculation by 
typing, for example, {\tt UNASSIGN(X)}.

{\tt EPS} contains the value of epsilon used in the {\tt EPSX0} command 
(cf. \ref{sec:epsx0}).

{\tt MODULO} contains the value of $p$ for performing symbolic calculations in 
$Z/pZ$ or in $Z/pZ[X]$. You can change the value of $p$ either with the 
{\tt MODSTO} command in the {\tt MODULAR} menu, (by typing, for example, 
{\tt MODSTO(13)}\index{MODSTO} to give $p$ a value of 13), or use 
{\tt SHIFT SYMB} to open the {\tt CAS MODES} screen and change {\tt Modulo}.

{\tt PERIOD} must contain the period of a function before you can find its 
Fourier coefficients (cf. \ref{sec:fourier}).

{\tt PRIMIT} contains the primitive of the last integrated function.

{\tt REALASSUME}\index{REALASSUME} contains a list of the names of the symbolic
 variables that are considered reals. If you've chosen the {\tt Cmplx vars}
 option on the {\tt CFG} configuration menu, these are by default:\\
{\tt X, Y, t, S1, S2}, as well as any integration variables that are in use.\\
Of course, if you've chosen the {\tt Real vars} option on the {\tt CFG} 
configuration menu, all symbolic variables are considered reals 
(cf. \ref{sec:cfg}).
You can also use an assumption to define a variable such as {\tt X>1}.\\
In a case like this, you use the {\tt ASSUME(X>1)}\index{ASSUME} command to 
make {\tt REALASSUME} contain {\tt X>1}.
The command {\tt UNASSUME(X)}\index{UNASSUME} destroys all the assumptions 
we've previously made about  {\tt X}.

To see or to modify all these variables, as well as those that you've defined 
in {\tt CAS}, press  {\tt VARS} in the Equation Editor, then on {\tt EDIT} on
the menu bar (cf. \ref{sec:vars}).

%%% CAS FROM HOME %%%

\section{{\tt CAS} in the {\tt HOME} screen}\label{sec:cashome}
You can use many computer algebra functions directly in the {\tt HOME}
screen, as long as you take certain precautions. CAS functions that
take matrices arguments work only from {\tt HOME}. For the description of these
functions see chapter \ref{sec:mtrcas}.
\subsection{{\tt HOME} variables}
You can not use the same variable names in {\tt HOME} as in the
Equation Editor. For example {\tt X} can not be used as a symbolic
variable, since the {\tt A..Z} variables names are numeric variables, 
and always contain a real value (0 by default).\\
The names of the symbolic {\tt HOME} variables are :\\
{\tt S1..S5, s1..s5, n1..n5}.\\
Unlike with Equation Editor variables,
it is not possible to assign a value to a {\tt HOME} symbolic
variable:  note that {\tt s1..s5} and {\tt n1..n5}
are sometimes returned by {\tt QUAD} and {\tt ISOLATE} respectively
instead of a sign (it should be replaced by 
$\pm 1$ to get both solutions in {\tt QUAD}, for instance, 
{\tt QUAD(S1*S1-9,S1)}  returns 
{\tt s1*6/2}) or instead of an integer 
(e.g. for isolation inside
a trigonometric function, for instance, {\tt ISOLATE(SIN(S1),S1)} returns 
{\tt 3.14..+n1}).\\
%note that {\tt s1..s5} and {\tt n1..n5}are sometimes returned by {\tt QUAD} and {\tt ISOLATE} respectivelyinstead of a sign (it should be replaced by $\pm 1$) or instead of an integer (for instance, {\tt QUAD(S1*S1-9,S1)}  returns {\tt s1*6/2} and {\tt ISOLATE(SIN(S1),S1)} returns {\tt 3.14..+n1}).\\
If you want to store symbolic expressions in {\tt HOME} 
you must use the symbolic expression variables {\tt E0..E9}.
If you want to store lists of symbolic expressions in {\tt HOME} 
you must use the variables {\tt L0..L9}.

\subsection{Storing an object in a {\tt HOME} variable : ${\tt STO\triangleright}$}\index{STO}
${\tt STO\triangleright}$ enables you to store an object in a {\tt HOME} 
variable. ${\tt STO\triangleright}$ is obtained by pressing {\tt F1} on the {\tt HOME} menu bar or on program 
editor menu bar,.
A variable can store only one kind of object, this kind is determined
by the variable name (see above).\\
For example, type:\\
${\tt S1^2+2 \times S1\ STO\triangleright E1}$, then,\\ 
 ${\tt DERIV(E1,S1)}$ \\
you get : \\
${\tt 2*S1+2}$. 
\subsection{Some tricks and examples.} 
CAS functions may be accessed from {\tt HOME}, either
from the {\tt CAS} submenu of the {\tt MATH} key's menu bar ({\tt F4} key),
or directly (type the function name in alpha mode).
Note that: 
\begin{itemize}
\item  Certain calculations  will be performed in approximate mode because 
numbers are interpreted as reals instead of integers in {\tt HOME}. 
To do exact calculations, you should use the command 
{\tt XQ}, it converts an approximate argument into an exact argument.
For example, if you work with {\tt Radians}:
$${\tt  ARG(XQ(1+i))= \frac{\pi}{4}}$$
$${\tt  ARG(1+i)=0.7853...}$$
$${\tt FACTOR(XQ(45))=3^2*5}$$
$${\tt FACTOR(45)=45}$$
\item The symbolic {\tt HOME} variable {\tt S1} serves as the current variable 
for the relevant {\tt CAS} functions in {\tt HOME}.
For example :
$${\tt DERVX(S1^2+2 \times S1)= 2*S1+2}$$ 
The result ${\tt 2*S1+2}$ does not depend on the 
Equation Editor variable {\tt VX}). Note that a few {\tt CAS} function can not
work inside {\tt HOME} because they require to change the current
variable.
\item  Remember that you must use :\\
{\tt S1,S2,..S5,s1,s2,..s5,n1,n2,..n5} for symbolic variables and 
{\tt E0,E1,..E9}  to store symbolic expressions.
For example, if you type :
$${\tt S1^2-4\times S2\ STO\triangleright E1}$$
then you have :
$${\tt DERVX(E1)=S1*2}$$
$${\tt DERIV(E1,S2)=-4}$$
$${\tt INTVX(E1)=1/3*S1^3-4*(S2*S1)}$$

\item If you want to work with symbolic matrices, you must store them in 
{\tt L0, L1..L9}, because symbolic matrices are interpreted in the same 
these matrices are interpreted in the same 
way as lists of lists (whereas numeric matrices are stored in 
{\tt M0, M1..M9}). 
The CAS linear algebra instructions accept list of lists as input.\\
For example, if you type in {\tt HOME}:
$${\tt XQ(\{ \{ S2+1, 1 \}, \{ \sqrt2,1 \} \}) \ STO\triangleright\ L1}$$
then you have :
$${\tt TRAN(L1)=\{\{S2+1,\sqrt2\},\{1,1\}\}}$$ 
Some numeric linear algebra instructions do not work on list of
lists, but will after a conversion by {\tt AXL}, like:\\
${\tt DET(AXL(L1)) ) \ STO\triangleright\ E1}$\\
 you get :\\
${\tt S2-(-1+\sqrt2)}$

Section \ref{sec:mtrcas} describes CAS instructions that work only from
HOME, including some CAS symbolic linear algebra instructions.
For more information you can also use the on-line help 
({\tt HELP} or e.g. {\tt HELPWITH TRAN})
or look at the HP49G, HP49G+
or HP48GII CAS documentation available from:\\
\verb|http://www-fourier.ujf-grenoble.fr/~parisse|\\
\end{itemize}

\subsection{Send expressions from {\tt HOME} into the {\tt CAS}  history : {\tt PUSH}}\index{PUSH}\label{sec:push}
In the {\tt HOME} screen, you can use the {\tt PUSH} command to send expressions into the {\tt CAS} history.\\
In the {\tt HOME} screen, you type:\\
{\tt PUSH(S1+1)}\\
and {\tt S1+1} is written to the {\tt CAS} history.
\subsection{Retrieve expressions written to the {\tt CAS} history in {\tt HOME} : {\tt POP}}\index{POP}\label{sec:pop}
In the {\tt HOME} screen, you can use the {\tt POP} command to retrieve the 
last expression written to the {\tt CAS} history.\\
In the {\tt HOME} screen, you type:\\
{\tt POP}\\
and, for example, {\tt S1+1} is written to the {\tt HOME} screen history and
{\tt S1+1} is removed from the {\tt CAS} history.

\subsection{The keyboard in the {\tt HOME} screen} \label{sec:thome}
\subsubsection{{\tt MATH} key}\label{sec:tmathh}
This opens the menu of mathematical functions.\\
This key, if pressed in the {\tt HOME} screen, open a window containing the 
mathematical (numeric) functions grouped by theme, since the MTH option on the
 menu bar ({\tt F1} key) is selected by default.\\
If you choose {\tt CAS} on this window's menu bar ({\tt F4} key), you'll find 
the same menus as when you press the {\tt MATH} key in the Equation Editor:
 this gives you access to all available computer algebra functions, grouped by 
theme, from the {\tt HOME} screen.
\subsubsection{{\tt SHIFT F6} keys}
The key combination {\tt SHIFT F6(CAS on the menu bar)} opens {\tt CAS MODES} 
screen, which enables you change the {\tt CAS} 
configuration from the {\tt HOME} screen (cf \ref{sec:config}).
\subsubsection{{\tt SHIFT 2 (SYNTAX)} keys}\label{sec:syntax}\index{HELP}\index{HELPWITH}
The key combination {\tt SHIFT 2 (SYNTAX)} places {\tt HELPWITH} in the command
 line. All you need to do then is complete the line with the name of the
 command or {\tt CAS} function for which you want help. You can enter the name
 of a {\tt CAS} function with {\tt MATH} and {\tt CAS} on this window's menu 
bar ({\tt F4} key), but take care to omit the parentheses.\\
For example: {\tt HELPWITH DERVX} opens the {\tt CAS} help topic
 on {\tt DERVX}.\\
If you want general {\tt CAS} help in the {\tt HOME} screen, press {\tt HELP},
 then {\tt ENTER}. This gives you help on the {\tt CAS} functions available in
 the {\tt HOME} screen.\\
To get help in French, choose Français in the {\tt CFG} menu, which enables 
you to change your configuration (cf \ref{sec:cfg}).\\
Each example can be copied into the {\tt HOME} screen history by means of 
{\tt ECHO} on the menu bar, where it can be used as is or modified, and 
naturally, the variable {\tt X} of the example is replaced automatically by
 {\tt S1}.\\
In addition, the examples are sometimes modified automatically
to change in {\tt HOME} screen, reals to integers using the {\tt XQ} 
function.\\
For example, you type in the {\tt HOME} screen:
$${\tt HELPWITH\  PROPFRAC}$$
or 
$${\tt HELP} \mbox{ then you select } {\tt PROPFRAC} \mbox{ in } {\tt CAS\ HELP\ ON}$$
%and select {\tt PROPFRAC} on the {\tt CAS HELP ON}\\
You obtain the example  for {\tt PROPFRAC} :
$${\tt PROPFRAC(XQ(\frac{43}{12}))=3+\frac{7}{12}}$$
whereas if, in the equation editor, you select {\tt PROPFRAC} on the 
{\tt CAS HELP ON}, the example is :
$${\tt PROPFRAC(\frac{43}{12})}$$
but typing in {\tt HOME} : 
$${\tt PROPFRAC(\frac{43}{12})}$$
gives
$${\tt 3.5833..}$$ 
\chapter{The {\tt CAS} functions only valid in HOME screen}\label{sec:mtrcas}
These functions have as arguments matrix or vectors and return matrix or 
vectors.
\section{Linear systems}
In this paragraph, we call "augmented matrix" of the system
$A \cdot X=B$ (or matrix "representing" the system $A \cdot X=B$),
the matrix obtained augmenting the matrix $A$ to the right
with the column vector $B$.

\subsection{Resolution of a linear system of equations : {\tt REF}}\index{REF}
{\tt REF} solves a linear system of equations written in
matrix form:
$${\tt A\cdot X=B}$$
The argument of {\tt REF} is the augmented matrix of the system
(the matrix obtained augmenting matrix {\tt A} to the right with
the column vector {\tt B}).\\
The result is a matrix {\tt [A1,B1]} : {\tt A1} has zeros
under its principal diagonal, and the solutions of:
$${\tt A1\cdot X=B1}$$ are the same as:
$${\tt A\cdot X=B}$$
For example, solve the system:
$$\left \{\begin{array}{lcr} 3 \cdot x + y & = &-2 \\3 \cdot x +2 \cdot
 y & =& 2 \end{array}\right.$$\\
Typing:
$${\tt REF([[3,  1, -2] [3, 2, 2]])}$$
gives:
$$\left [ \begin{array}{rrr} 1 & \frac{1}{3} & \frac{-2}{3}\\0 & 1 & 4 
\end{array} \right]$$
So, $y=4$ and $x=-2/3-4/3=-2$
\subsection{Resolution of a linear system of equations : {\tt rref}}\index{rref}
{\tt rref} solves a linear system of equations written in
matrix form:
$${\tt A\cdot X=B}$$
TThe argument of {\tt rref} is the augmented matrix of the system
(the matrix obtained augmenting matrix {\tt A} to the right with
the column vector {\tt B}).\\
The result is a list containing the list of pivot elements used
by the command and a matrix {\tt [A1,B1]} : {\tt A1} has zeros
both above and under its principal diagonal, and the solutions of:
$${\tt A1\cdot X=B1}$$ are the same as:
$${\tt A\cdot X=B}$$
It is interesting to use {\tt rref} in step-by-step mode.\\
For example, to solve the system:
$$\left \{
\begin{array}{lcr} 3 \cdot x + y & = &-2 \\3 \cdot x +2 \cdot y & =& 
2 \end{array}\right.$$

Typing
$${\tt rref([[3,  1, -2][3, 2, 2]])}$$
gives :
$${\tt \left\{\{1\  1\}\left [ \begin{array}{rrr}3 & 0 & -6\\0 & 1 & 4 \end{array} \right]\right\}}$$
Typing
$${\tt rref([[1,  S1][S1, 1]])}$$
gives :
$${\tt \left\{\{S1^2-1 ,1\}\left [ \begin{array}{rr} S1^2-1 & 0\\0
& -(S1^2-1) \end{array} \right]\right\}}$$

\section{Polynomials}
\subsection{List of factors : {\tt FACTORS}}\index{FACTORS}
{\tt FACTORS} has either a polynomial or a list of polynomials as argument.\\
{\tt FACTORS} returns a list containing the factors of the polynomial
and their exponents.\\
Typing:
 $${\tt FACTORS(S1^2-2*S1+1)}$$
gives:
$${\tt \{S1-1,2.\}}$$
Typing:
 $${\tt FACTORS(S1^4-2*S1^2+1)}$$
gives:
$${\tt \{S1-1,2\ ,\ S1+1 ,2\}}$$
Typing:
 $${\tt FACTORS(\{S1^3-2*S1^2+1,S1^2-S1\})}$$
gives:
$${\tt \{\{S1-1,1\ ,\ 2*S1+-1+\sqrt5 ,1\ ,
\ 2*S1-(1+\sqrt5) ,1\ ,\ 4, -1\},}$$
$${\tt \{S1, 1\ ,\ S1-1,1\}\}}$$
\subsection{Rational function given by its roots and poles :{\tt FCOEF}}\index{FCOEF}
{\tt FCOEF} has as argument a vector
whose components are the roots and poles of a rational function
$F[x]$, followed by their multiplicity.\\
{\tt FCOEF} returns the rational function $F[x]$.\\
Typing:
$${\tt FCOEF([1,2,0,3,2,-1]) }$$
gives:
$${\tt S1^3*(S1-1)^2/(S1-2)}$$
\subsection{Roots and poles ofa rational function : {\tt FROOTS}}\index{FROOTS}
{\tt FROOTS} has a rational function $F[x]$ as argument.\\
{\tt FROOTS} returns a vector whose components are the roots and the poles
of $F[x]$, followed by their multiplicity.\\
Typing:
$${\tt FROOTS(\frac{S1^5-2 \cdot S1^4+S1^3}{S1-2}) }$$
gives:
$${\tt [2,-1,0,3,1,2]}$$
The result means that: $2$ is a pole of order 1, $0$ is a triple root,
and $1$ is a double root of $F[x]=\frac{x^5-2 \cdot x^4+x^3}{x-2}$
since  $(x-1)^2 \cdot x^3=x^5-2 \cdot x^4+x^3$.
\subsection{Gr{\oe}bner basis : {\tt GBASIS}}\index{GBASIS}
{\tt GBASIS} has two  arguments :  a vector of polynomials with several 
variables and the vector of names of these variables.\\
{\tt GBASIS} returns a Gr{\oe}bner basis of the polynomial ideal built
by the polynomials which are in the first argument.\\
We choose to write the polynomial variables  with the order of the last 
argument and to write the polynomials in decreasing power. If $I$ is an ideal 
and if $(G_k)_{k \in K}$ is a Gr{\oe}bner basis of this ideal $I$ then if $F$ 
is a non zero polynomial in $I$, the greatest power term of $F$ is divisible by
the greatest power term of a $G_k$. \\
Property : If you do an euclidian  division of $F$ by its correspondant $G_k$,
then if you continue with the remainder of this division, we have at end, a 
null remainder.\\  
Typing :
$${\tt GBASIS([2\cdot S1\cdot S2-S2^2,S1^2-2\cdot S1\cdot S2],[S1,S2])}$$
gives :
$${\tt [S1^2-S2^2,2\cdot S1\cdot S2-S2^2,S2^3]}$$

\subsection{Gr{\oe}bner reduction : {\tt GREDUCE}}\index{GREDUCE}
{\tt GREDUCE} has three arguments : a  polynomial with several variables, a
 vector made with polynomials which are a
 Gr{\oe}bner basis  and a vector of names of these variables.\\
{\tt GREDUCE} returns the reduction (+ a constant) of the 
polynomial given in the first argument
with respect to the Gr{\oe}bner basis given in the second argument.\\
Typing :
$${\tt GREDUCE(S1*S2-1,[S1^2-S2^2,2*S1*S2-S2^2,S2^3],[S1,S2])}$$
gives :
$${\tt (S2^2-2)/2}$$
that is to say ${\tt Y^2-2}$ is the reduce polynomial of
${\tt 2\cdot X\cdot Y-2}$ (${\tt Y^2-2}$ is the remainder of
 ${\tt 2\cdot (X\cdot Y-1)}$ by ${\tt G_2=2\cdot X\cdot Y-Y^2}$).
\subsection{Lagrange's polynomial : {\tt LAGRANGE}}\index{LAGRANGE}
{\tt LAGRANGE} has as argument a matrix with two rows and
$n$ columns:\\
the first row corresponds to the abscissa values $x_i$, and the second row
corresponds to ordinate values $y_i$ ($i=1..n$).\\
{\tt LAGRANGE} returns the polynomial $P$ of degree $n-1$,
so that $P(x_i)=y_i$.\\
Typing:
$${\tt LAGRANGE([[1,3],[0,1]])}$$
gives:
$${\tt \frac{S1-1}{2}}$$
in fact $\frac{x-1}{2}=0 $ for $x=1$ and $\frac{x-1}{2}=1$ for $x=3$
\subsection{GCD of a list : {\tt LGCD}}\index{LGCD}
{\tt LGCD} denotes the gcd (greatest common divisor)
of a list of whole numbers or of a list of polynomials.\\
{\tt LGCD} returns the {\tt GCD} of all whole numbers of the list or
the {\tt GCD} of all polynomials of the list.\\
Typing:
$${\tt LGCD(\{125,45,35 \})}$$
gives:
$${\tt 5}$$
Typing:
$${\tt LGCD(\{S1^2+2*S1+1,S1^3+1 ,S1^2-1,S1^2+S1 \})}$$
gives :
$${\tt S1+1}$$
\subsection{resultant of two polynomials: {\tt RESULTANT}}\index{RESULTANT}
{\tt RESULTANT} has two polynomials as arguments.\\
{\tt RESULTANT} returns the resultant of the two polynomials.
The resultant of two polynomials is non zero if and only if the
polynomials are prime together. It is the determinant of their
Sylvester matrix $S$.\\
The Sylvester matrix $S$ of two polynomials $A[X]=\sum_{i=0}^{i=n} a_iX^i$
and $B[X]=\sum_{i=0}^{i=m} a_iX^i$
is a square matrix with $m+n$ rows and columns; its first $m$ rows
are made from the coefficients of $A[X]$:
$$\left(\begin{array}{ccccccc}
s_{11}=a_n & s_{12}=a_{n-1}& \cdots & s_{1(n+1)}=a_0 & 0 & \cdots & 0\\
s_{21}=0 & s_{22}=a_{n}& \cdots & s_{2(n+1)}=a_1 & s_{2(n+2)}=a_0 & \cdots & 0\\
\vdots &\vdots &\vdots &\ddots &\vdots &\ddots &\vdots\\
s_{m1}=0 & s_{m2}=0& \cdots & s_{m(n+1)}=a_{m-1} & s_{m(n+2)}=a_{m-2} & \cdots&a_0 
\end{array}\right)$$
and the following $n$ rows are made in the same way from the
coefficients of $B[X]$:
$$\left(\begin{array}{ccccccc}
s_{(m+1)1}=b_m & s_{(m+1)2}=b_{m-1}& \cdots & s_{(m+1)(m+1)}=b_0 & 0 & \cdots & 0\\
\vdots &\vdots &\vdots &\ddots &\vdots &\ddots &\vdots\\
\end{array}\right)$$
For example, typing:
$${\tt RESULTANT(S1^3-S2*S1+S3,3*S1^2-S2)}$$
gives:
$${\tt -(4*S2^3-27*S3^2)}$$
\subsection{Division by the PGCD  :{\tt SIMP2}}\index{SIMP2}
{\tt SIMP2} has two whole numbers (or two lists of whole numbers
with the same length) as arguments.
These two  whole numbers are considered as representing a 
fraction.\\
 {\tt SIMP2} returns the simplified  fraction, represented
as a list of two whole numbers.\\
Typing:
$${\tt SIMP2(18,15) }$$
gives:
$${\tt \{6,5\}}$$ 
Typing:
$${\tt SIMP2(\{18,28\},\{15,21\}) }$$
gives:
$${\tt \{6,5,4,3\}}$$ 
{\tt SIMP2} has two polynomials (or two lists of polynomials
with the same length) as arguments.
These two polynomials are considered as representing a rational
fraction.\\
 {\tt SIMP2} returns the simplified rational fraction, represented
as a list of two polynomials.\\
Typing:
$${\tt SIMP2(S1^3-1,S1^2-1) }$$
gives:
$${\tt \{S1^2+S1+1,S1+1\}}$$
\subsection{Sturm's sequences : {\tt STURM}}\index{STURM}
{\tt STURM} has a polynomial $P$ as argument.\\
{\tt STURM} returns a list containing the Sturm's sequences of $P$ and their
multiplicities.\\
The Sturm sequence $R_1,R_2,...$ can be obtained from a square-free
factor $F$ of $P$ as follows:\\
$R_1$ is the opposite of the remainder of the euclidean division of
$F$ by $F'$;\\
then, $R_2$ is the opposite of the remainder of the euclidean division of
$F'$ by $R_1$,\\
and so on, until $R_k=0$.\\
For example, type:
$${\tt STURM(S1^3+1)}$$
You obtain:
$${\tt \{[1],\ -1,\ [S1^3+1,\ -3\cdot S1^2 -1],\ 1.\}}$$
The first element of the list denotes that the denominator of $P$
(that is, the element with $-1$ power), is 1.

\subsection{Zeros of a polynomial : {\tt ZEROS}}\index{ZEROS}
{\tt ZEROS} has two arguments: a polynomial $P$ and a variable name.\\
{\tt ZEROS} returns a list containing the zeros of $P$ with respect
to the given variable, {\sc without} their multiplicity.\\
Type:
$${\tt ZEROS(S1^4-1,S1)}$$
gives:\\
- in real mode (change the mode with {\tt SHIFT F6} and {\tt UNCHK Complex})
$${\tt \{-1,1\}}$$
- in complex mode (change the mode with {\tt SHIFT F6} and {\tt CHK Complex}) 
$${\tt \{ i,-1, -i ,1\}}$$
\section{Rational fractions}
\subsection{Numerator and denominator of a fraction : {\tt FXND}}\index{FXND}
{\tt FXND} has a rational fraction as argument, and returns a list
containing the simplified numerator and denominator of this fraction.\\
Typing:
$${\tt FXND(3/6)}$$
gives :
$${\tt \{1,2\}}$$
%bug ne simplifie pas
Type:
$${\tt FXND((S1^2-1)/(S1-1)) }$$
You obtain:
%$${\tt \{S1+1,1\}}$$
$${\tt \{S1^2-1,S1-1\}}$$
\section{Modular calculations}
\subsection{Resolution of a linear system of equations : {\tt RREFMOD}}\index{RREFMOD}
{\tt RREFMOD} solves a system of linear equations
$AX=B$ in $Z/pZ$.\\
The argument is the matrix $A$ augmented with the vector $B$ as
its rightmost column.  The result is a matrix composed of $A1$ and $B1$,
where $A1$ has zeros both above and under its principal diagonal,
and the system $A1X=B1$ is equivalent to $AX=B$.\\
To solve, in $Z/13Z$ :
$$\left\{ \begin{array}{lcr}\ \  x\ +\ \  2 \cdot y & = &9 \\3 \cdot x+10
\cdot y & =& 0 \end{array}\right. $$
Typing :
$${\tt MODSTO(13)}$$
$${\tt RREFMOD([[1, 2, 9][3,10,0]])}$$
gives :
$${\tt [[2, 0, 6],[0, 4, -1 ]]}$$
that is, ${\tt 2.X=6} $ and ${\tt 4.Y=-1}$ or, which is the same,
${\tt X=3 \ \ Y=3}$ (since $-4*3=1 \ (\bmod 13)$).
\section{Variables}

\subsection{The symbolic variables of an expression : {\tt LNAME}}\index{LNAME}
{\tt LNAME} has an expression as argument, and returns a
vector whose components are the symbolic variable names
the expression contains.\\
Typing :
$${\tt LNAME(S1*S2*SIN(S1))}$$
gives :
$${\tt [S1,S2]}$$
\subsection{The variables of an expression : {\tt LVAR}}\index{LVAR}\label{sec:lvar}
{\tt LVAR} has an expression as argument, and returns a vector such
that the original expression is a rational fraction with
respect to the components of this vector.\\
Typing :
$${\tt LVAR(S1*S2*SIN(S1))}$$
gives :
$${\tt [SIN(S1),S1,S2]}$$
\section{Numeric calculus}
\subsection{Omit the values smaller than EPS : {\tt EPSX0}}\index{EPSX0}\label{sec:epsx0_}
{\tt EPSX0} has as argument an expression; in the expression, it
replaces all numeric values whose magnitude is smaller than {\tt EPS}
with zero and returns the result.\\
Type:
$${\tt EPSX0(0.001+S1)}$$
You obtain (when {\tt EPS=0.01}) :
$${\tt 0+S1}$$
You obtain (when {\tt EPS=0.0001}) :
$${\tt .001+S1}$$
\subsection{Solve numerically a system : {\tt MSLV}}\index{MSLV}
{\tt MSLV} solves numerically a system of non-polynomial equations.\\
{\tt MSLV} has three vectors as arguments: a vector containing the equations,
a vector containing the system's variables, and a vector containing
an initial guess for the solution.\\
{\tt MSLV} returns a vector containing an approximate solution
of the given system of equations.\\
While the command is running, the first display line shows the
last estimate $\overrightarrow V$, and the second line shows the
modulo of $\Delta \overrightarrow V$\\
For example, type:
$${\tt MSLV([SIN(S1)+S2,S1+SIN(S2)-1],[S1,S2],[0,0])}$$
You obtain:
$${\tt [1.82384112611,\  -.968154636174]}$$


\subsubsection{List of values : {\tt TABVAL}}\index{TABVAL}
{\tt TABVAL} has an expression and a list of numbers as arguments.\\
{\tt TABVAL} returns a list.  This list holds two lists : the list of numbers
 given as input and the list of the value the expression where the variable 
{\tt S1} is replaced by the list of numbers given as input.\\
For example, typing:
$${\tt TABVAL(S1^2+S1,\{1,2,3,XQ(\sqrt5\})}$$
gives: 
$${\tt \{\{1,2,3,\sqrt5\},\{2,6,12,5+\sqrt5\}\}}$$
\subsection{Time for evaluation of the answer : {\tt TEVAL}}\index{TEVAL}
{\tt TEVAL} has a command as argument.\\
{\tt TEVAL} returns the list of the answer and the time for the 
evaluation of this answer (unit=second).\\
For example, typing:
$${\tt TEVAL(FACTOR(S1^2-1))}$$
gives: 
$${\tt \{(S1-1)*(S1+1),0.2991\}}$$
\subsection{Numeric approximation : {\tt XNUM}}\index{XNUM}
{\tt XNUM} has either an expression or an array as argument.\\
{\tt XNUM} enables approximate mode and returns the numeric approximation
of its argument.\\
Type:
$${\tt XNUM(\sqrt2)}$$
You obtain:
$${\tt 1.41421356237}$$

\subsection{Exact value : {\tt XQ}}\index{XQ}
{\tt XQ} has a real numeric expression as argument.\\
{\tt XQ} enables exact mode and returns either a rational or
a real approximation of the expression.\\
Typing:
$${\tt XQ(1.41421)}$$
gives:
$${\tt \frac{66441}{46981}}$$
Typing:
$${\tt XQ(1.414213562)}$$
gives:
$${\tt \sqrt2}$$


\section{The lists}
\subsection{Concatenation : {\tt AUGMENT}}\index{AUGMENT}
{\tt AUGMENT} has as arguments two vectors, or two lists, or a list
and an element.\\
{\tt AUGMENT} concatenates its arguments.\\
Typing:
$${\tt AUGMENT(\{1,2\},3)}$$
gives:
$${\tt \{ 1,2,3 \}}$$
Typing:
$${\tt AUGMENT(\{1,2\},\{3,4\})}$$
gives:
$${\tt \{ 1,2,3,4 \}}$$
\subsection{Map a function to a list : {\tt MAP}}\index{MAP}
{\tt MAP} has two arguments: a list and
a function defining an holomorphic operator.\\
{\tt MAP} applies the operator to the list, and returns the result.\\
Typing:
$${\tt MAP({1,0,2},EXP(S1)}$$
gives:
$${\tt \{EXP(1),EXP(0),EXP(2)\}}$$

\section{Quadratic forms}

\subsection{Matrice to quadratic form : {\tt AXQ}}\index{AXQ}
{\tt AXQ} has two arguments:
a symmetric matrix $A$ representing a quadratic form  $q$
and a vector whose components are the quadratic form's variables.\\
{\tt AXQ} returns the quadratic form $q$.\\
Typing :
$${\tt AXQ([[0,1],[1,0]]\ ,\ [S1,S2])}$$
gives :
$${\tt 2*S2*S1}$$

\subsection{Gauss decompsition : {\tt GAUSS}}\index{GAUSS}
{\tt GAUSS} has two arguments: a quadratic form $q$
and a vector whose components are the quadratic form's variables.\\
{\tt GAUSS} returns $q$ expressed as a sum of squares.\\
Typing:
$${\tt GAUSS(2 \cdot S1 \cdot S2\ ,\ [S1,S2])}$$
gives:
$${\tt  -2\cdot(\frac{S2-S1}{2})^2+\frac{1}{2}\cdot (S2+S1)^2}$$

\subsection{Matrix of a quadratic form : {\tt QXA}}\index{QXA}
{\tt QXA} has two arguments: a quadratic form $q$
and a vector whose components are the form's variables.\\
{\tt QXA} returns 
the matrix $A$ associated with $q$.\\
Typing :
$${\tt QXA(2*S1*S2\ ,\ [S1,S2])}$$
gives :
$${\tt[[0,1],[1,0]]}$$
and with {\tt SHOW}
$${\tt  \left[\begin{array}{cc} 0& 1\\ 1&0 \end{array}\right]}$$
\subsection{Sylvester decomposition : {\tt SYLVESTER}}\index{SYLVESTER}
{\tt SYLVESTER} has one argument: a symmetric matrix representing
a quadratic form $q$.\\
{\tt  SYLVESTER} returns a list of two elements:
the diagonal elements of the diagonal matrix $B$
(obtained expressing $q$ as a sum of squares)
and the matrix of change of base $Q$.\\
We have:
 $$ ^tQ \cdot B \cdot Q=A$$
Typing:
$${\tt SYLVESTER([[0,1],[1,0]])}$$
gives :
$${\tt \{[\frac{1}{2},-2]\ ,\ \left[\begin{array}{cc} 1& 1\\\frac{-1}{2} 
&\frac{1}{2} \end{array}\right]\}}$$


\section{Functions of multiple variables}
\subsection{The rotor : {\tt CURL}}\index{CURL}
Here $n=3$.\\
{\tt CURL} has two arguments: the value [$E1,E2,E3$] of a vectorial function
(application
from $R^3 $ in $R^3$) and a vector of $R^3$ denoting the variable names.\\
{\tt CURL} returns the rotor of [$E1,E2,E3$].
$${\tt CURL([E1,E2,E3],[S1,S2,S3])=[\frac{\partial E3}{\partial S2}-\frac{
\partial E2}{\partial S3},\frac{\partial E1}{\partial S3}-\frac{\partial E3}
{\partial S1},\frac{\partial E2}{\partial S1}-\frac{\partial E1}{\partial S2}]}$$
Type:
$${\tt CURL([S1*S3,-S2^2,2*S1*S2],[S1,S2,S3])}$$
You obtain:
$${\tt [2*S1,S1-S2*2,0]}$$
\subsection{The gradient : {\tt DERIV}}\index{DERIV}\label{sec:deriv}
{\tt DERIV} has two arguments: the value of an application $E1$ from $R^n $ in 
$R$ and a vector of $R^n$ denoting the variable names.\\
{\tt DERIV} returns the gradient of $E1$ ($[\frac{\partial E1}{\partial S1},
\frac{\partial E1}{\partial S2},\frac{\partial E1}{\partial S3}]$ if $n=3$).\\
Type:
$${\tt DERIV(2*S1^2*S2-S1*S3^3,[S1,S2,S3])}$$
After simplification, you obtain:
$${\tt [4 \cdot S2 \cdot S1-S3^3,2 \cdot S1^2,-(3 \cdot S1\cdot S3^2 )]}$$
\subsection{The divergence : {\tt DIV}}\index{DIV}
{\tt DIV} has two arguments: the value [$E1,E2,E3$] of a vectorial function 
(application
from $R^n $ in $R^n$) and a vector of $R^n$ denoting the variable names.\\
{\tt DIV} returns the divergence of [$E1,E2,E3$].
 $${\tt DIV([E1,E2,E3],[S1,S2,S3])=\frac{\partial E1}{\partial S1}+\frac{
\partial E2}{\partial S2}+\frac{\partial E3}{\partial S3}} \mbox{  
(here } n=3)$$\\
Typing:
$${\tt DIV([S1* S3,-S2^2,2*S1*S2],[S1,S2,S3])}$$
gives:
$${\tt S3-2*S2}$$
\subsection{The hessian : {\tt HESS}}\index{HESS}
{\tt HESS} has two arguments: the value of an application $E1$ from $R^n $ in 
$R$ and a vector of $R^n$ denoting the variable names.\\
{\tt HESS} returns a list containing the hessian of $E1$, the
gradient of $E1$ and the vector of the variable names.\\
Typing :
$${\tt HESS(2*S1^2*S2-S1*S3\ ,\ [S1,S2,S3])}$$
gives :
$$ \{ \left[\begin{array}{ccc} 
{\tt 2 \cdot2\cdot S2}& {\tt 2 \cdot2\cdot S1}&-1 \\  
{\tt2\cdot2\cdot S1}&0&0 \\
-1&0&0 \end{array}\right]{\tt \ ,\ [4\cdot S1\cdot S2-S3,2\cdot S1^2,-S1]\ ,
\ [S1,S2,S3]\}}$$
Now, to obtain the critical points of $E1$,
you must type:
$${\tt SOLVE( [4.S1.S2-S3,2.S1^2,-S1]\ ,\  [S1,S2,S3])}$$

\subsection{The laplacian : {\tt LAPL}}\index{LAPL}
{\tt LAPL} has two arguments: the value of an application $E1$ from $R^n $ in 
$R$ and a vector of $R^n$ denoting the variable names.\\
{\tt LAPL} returns the laplacian of $E1$ ($\frac{\partial^2 E1}{\partial S1^2}+
\frac{\partial^2 E1}{\partial S2^2}+\frac{\partial^2 E1}{\partial S3^2}$
if $n=3$).\\
Type:
$${\tt LAPL(2*S1^2*S2-S1*S3^3\ ,\ [S1,S2,S3])}$$
You obtain:
$${\tt 4*S2-6*S1*S3}$$


\section{Equations}
\subsection{Members of an equation : {\tt EXLR}}\index{EXLR}
{\tt EXLR} has an equation as argument (you have to type {\tt ==}).\\
{\tt EXLR} returns a list containing the left and right hand sides
of the equation.\\
Type:\\
$${\tt EXLR(XQ(2\cdot S1+1==3/2))}$$
You obtain:
$${\tt \{2\cdot S1+1 ,3/2\}}$$

\section{Matrices}
\subsection{Matrix to list : {\tt AXL}}\index{AXL}
When {\tt AXL} is given a matrix as argument,
it returns the same matrix rewritten as a list of lists.
Vice versa, {\tt AXL} transforms a list of lists into a matrix.\\
Typing:
$${\tt AXL(XQ([[1,1/2],[3,4]]))}$$
gives:
$${\tt \{\{1,1/2\},\{3,4\}\}}$$
Typing:
$${\tt AXL(XQ(\{\{1,1/2\},\{3,4\}\}))}$$
gives:
$${\tt [[1,1/2],[3,4]]}$$
But typing:
$${\tt AXL([[1,1/2],[3,4]])}$$
gives:
$${\tt \{\{1,0.5\},\{3,4\}\}}$$
and typing
$${\tt AXL(\{\{1,1/2\},\{3,4\}\})}$$
gives:
$${\tt [[1,0.5,[3,4]]}$$
\subsection{Symbolic matrix to numeric matrix : {\tt AXM}}\index{AXM}
If given a symbolic matrix as argument,
{\tt AXM} returns an equivalent (but approximate) numeric matrix.\\
%and vice versa.\\
Type:
$${\tt AXM([[1/2,2],[3,4]])}$$
You obtain:
$${\tt[[0.5,2],[3,4]]}$$
\subsection{Basis vectors : {\tt BASIS}}\index{BASIS}
{\tt BASIS} has as argument a list of vectors, defining a vectorial
subspace of $R^n$.\\
{\tt BASIS} returns a list containing the vectors of a basis
of the vectorial subspace.\\
For example, type:
$${\tt BASIS(\{[1,2,3],[1,1,1],[2,3,4]\})}$$
You obtain:
$${\tt \{[1,0,-1],\ [0,1,2]\}}$$

\subsection{Cholesky matrix : {\tt CHOLESKY}}\index{CHOLESKY}
{\tt CHOLESKY} has as argument a square matrix {\tt M}, positive
by definition.\\
{\tt CHOLESKY} returns an upper triangular matrix {\tt P} so that:\\
${\tt ^tP*P=M}$\\
Typing:
$${\tt CHOLESKY([[1,1],[1,5]])}$$
gives :
$${\tt \left[\begin{array}{rr}1 & 1\\0&2\end{array}\right]}$$

\subsection{Map an operator to a diagonalizable matrix : {\tt DIAGMAP}}\index{DIAGMAP}
{\tt DIAGMAP} has two arguments: a diagonalizable matrix and
an  expression defining an holomorphic operator.\\
{\tt DIAGMAP} applies the operator to the matrix, and returns the result.\\
Typing:
$${\tt DIAGMAP([[1,1],[0,2]], EXP(S1))}$$
gives:
$${\tt \left[\begin{array}{cc}{\tt EXP}(1)& {\tt EXP}(2)-{\tt EXP}(1)\\0&{\tt EXP}(2)\end{array}\right]}$$
\subsection{Hadamard product : {\tt HADAMARD}}\index{HADAMARD}
{\tt HADAMARD} has two matrices $A$ and $B$, with the same size,
as arguments.\\
{\tt HADAMARD} returns the element-by-element product between
$A$ and $B$.\\
Type:
$${\tt HADAMARD(XQ([[ 1/2, 2],[3,4]]),XQ([[ 5, 6],[7,8]]))}$$
or
$${\tt HADAMARD(XQ(\{\{ 1/2, 2\},\{3,4\}\}),XQ(\{\{ 5, 6\},\{7,8\}\})}$$
You obtain:
$${\tt [[ 5/2, 12],[21,32]]}$$
but
$${\tt HADAMARD([[ 1/2, 2],[3,4]],[[ 5, 6],[7,8]])}$$
or
$${\tt HADAMARD(\{\{ 1/2, 2\},\{3,4\}\},\{\{ 5, 6\},\{7,8\}\}}$$
You obtain:
$${\tt [[ 2.5, 12],[21,32]]}$$

\subsection{Hilbert matrix : {\tt HILBERT}}\index{HILBERT}
{\tt HILBERT} has an integer $n$ as argument.\\
{\tt HILBERT} returns the square Hilbert matrix of order $n$
whose elements are given by:\\
 $$a_{i,j}=\frac{1}{i+j-1}$$
Type:
$${\tt HILBERT(4)}$$
You obtain, pressing {\tt ENTER}, then $\uparrow$, and then {\tt SHOW} :
$${\tt \left[\begin{array}{cccc} 1&\frac{1}{2}&\frac{1}{3} &\frac{1}{4}\\
\frac{1}{2}&\frac{1}{3}&\frac{1}{4} &\frac{1}{5}\\\frac{1}{3}&\frac{1}{4}
&\frac{1}{5} &\frac{1}{6}\\\frac{1}{4}&\frac{1}{5}&\frac{1}{6} &\frac{1}{7}\\ 
\end{array}\right] }$$
\subsection{Basis of an  intersection : {\tt IBASIS}}\index{IBASIS}
{\tt IBASIS} has as arguments two lists of vectors, defining two vectorial
spaces.\\
{\tt IBASIS} returns a list containing the vectors of a basis of
the intersection between these two vectorial spaces.\\
Typing:
$${\tt IBASIS(\{[1,2]\},\{[2,4]\})}$$
gives:
$${\tt \{[1,2]\}}$$
\subsection{basis of the image : {\tt IMAGE}}\index{IMAGE}
{\tt IMAGE} has as argument a matrix representing a linear application $f$
in terms of the standard basis.\\
{\tt IMAGE} returns a list of vectors; they are a basis of
the image of $f$.\\
Typing:
$${\tt IMAGE([[1,2,3],[2,1,3],[3,1,4]])}$$
gives :
$${\tt \{[1,0,-1/3],[0,1,5/3] \}}$$
\subsection{Jordan matrix : {\tt JORDAN}}\index{JORDAN}
{\tt JORDAN} has a matrix $A$, of order $n$, as argument.\\
{\tt JORDAN} returns a list composed by the minimal polynomial $M $
of $A$, the characteristic polynomial $P $ of $A$,
the list of the eigenvectors and characteristic vectors
(each vector is preceded by its characteristic value),
and the vector of the $n$ eigenvalues of $A$.\\
Type:
$${\tt JORDAN([[4,1,-2],[1,2,-1],[2,1,0]])}$$
or
$${\tt JORDAN(\{\{4,1,-2\},\{1,2,-1\},\{2,1,0\}\})}$$
You obtain pressing {\tt ENTER}, then $\uparrow$, and then {\tt SHOW} :
\begin{eqnarray*}
{\tt \{S1^3-6\cdot S1^2+12\cdot S1-8, S1^3-6\cdot S1^2+12\cdot S1-8,}\\
{\tt \{[1,0,0],[2,1,2],[1,0,1]\}, [2,2,2]\} }
\end{eqnarray*}
\subsection{Basis of the kernel : {\tt KER}}\index{KER}
{\tt KER} has as argument a matrix representing a linear application $f$
in terms of the standard basis.\\
{\tt KER} returns a list of vectors; they are a basis of
the kernel of $f$.\\
Typing:
$${\tt KER([[1,2,3],[2,1,3],[3,1,4]])}$$
gives:
$${\tt \{[1,1,-1] \}}$$

\subsection{Make a matrix : {\tt LCXM}}\index{LCXM}
{\tt LCXM} has as arguments two integers, $n$ and $p$,
and an expression of {\tt S1} (a row number)
and og {\tt S2} (a column number) and yielding the value of $a_{i,j}$.\\
{\tt LCXM} returns a $n \cdot p$ matrix having coefficients $a_{i,j}$.
Type:
$${\tt LCXM(2,3, S1+S2 )}$$
You obtain:
$${\tt [[1+1,1+2,1+3],[2+1,2+2,2+3]]}$$
and then after simplification : 
$${\tt [[2,3,4],[3,4,5]]}$$
\subsection{List of several elements : {\tt MAD}}\index{MAD}
{\tt MAD } has a square matrix $A$, of order $n$, as argument.\\
{\tt MAD } returns a list containing
the determinant of $A$,
the inverse of $A$, 
a list containing the matrix coefficients of a polynomial $Q$,
and of the characteristic poloynomial $P$ of $A$.\\
We have:
$$P(x)=(-1)^n \cdot \det(A-x \cdot I)$$
The polynomial with matrix coefficients $P(A)-P(x) \cdot I$
is divisible by $A-x \cdot I$ (since its value is zero for $x=A$).
Let $Q(x)$ be their quotient.\\
Since $P(A)=0$, we have $\ P(A)-P(x) \cdot I\ =\ -P(x) \cdot I\ =\ 
(A-x \cdot I) \cdot Q(x)$.\\
Therefore, $Q(x)$ is also the co-matrix of $A-x \cdot I$
and the following holds:\\
$Q(x)\ =\ I \cdot x^{n-1}+...+B_0 $, where $B_0$ is the co-matrix of $A$
(with the sign exchanged if $n$ is even!).\\
Type:
$${\tt MAD([[ 1, 1/2],[1,3]])}$$
or
$${\tt MAD(\{\{ 1, 1/2\},\{1,3\}\})}$$
You obtain:
$${\tt \{5/2,[[6/5,-1/5],[-2/5,2/5]],\{[[1,0],[0,1]],[[-3,1/2],[1,-1]]\},S1^2-4*S1+5/2\}}$$
or pressing {\tt ENTER}, then $\uparrow$, and then {\tt SHOW} gives:
$${\tt \left\{\frac{5}{2}, 
\left[
\begin{array}{cc} 
\frac{6}{5}&-\frac{-1}{5}\\
\frac{-2}{5}&\frac{2}{5}\\ 
\end{array}
\right],
\{\left[
\begin{array}{cc} 
1&0\\0&1 
\end{array}
\right], 
\left[\begin{array}{cc} 
-3&1/2\\1&-1 \end{array}\right]
\right\},S1^2-4 \cdot S1+\frac{5}{2}\}}$$

\subsection{Characteristic polynomial : {\tt PCAR}}\index{PCAR}
{\tt PCAR} has a matrix $A$, of order $n$, as argument.\\
{\tt PCAR} returns the characteristic polynomial $P $ of $A$
($P[x]=(-1)^n \cdot \det(A-x \cdot I))$
Type:
$${\tt PCAR([[4,1,-2],[1,2,-1],[2,1,0]])}$$
or
$${\tt PCAR(\{\{4,1,-2\},\{1,2,-1\},\{2,1,0\}\})}$$
You obtain:
$${\tt S1^3-6*S1^2+12*S1-8}$$

\subsection{Minimal polynomial : {\tt PMINI}}\index{PMINI}
{\tt PMINI} has a matrix $A$ as argument.\\
{\tt PMINI} returns another matrix, whose first "zero row"
is ended by the minimal polynomial of $A$.\\
For example, type:
$${\tt PMINI([[1,0],[0,1]])}$$
In step-by-step mode, you obtain:\\
{\tt L2=L2-L1}\\
$\left[\begin{array}{rrrrr}1&0&0&1&1\\1&0&0 & 1&S1\\1&0&0&1&S1^2\end{array}\right]$\\

{\tt L3=L3-L1}\\
$\left[\begin{array}{rrrrr}1&0&0&1&1\\0&0&0 & 0&S1-1\\1&0&0&1&S1^2\end{array}\right]$\\

{\tt Reduction result}\\
$\left[\begin{array}{rrrrr}1&0&0&1&1\\0&0&0 & 0&S1-1\\0&0&0&0&S1^2-1\end{array}\right]$\\
The row :\\
{\tt 0,0,0,0,S1-1} gives the  minimal polynomial of $A$.
So, the minimal polynomial of $A$:
$\left[\begin{array}{rr}1&0\\0 & 1\end{array}\right]$
is:
$${\tt S1-1}$$
\subsection{Q*R decomposition : {\tt qr}}\index{qr}
{\tt qr} has a square matrix as argument.\\
{\tt qr} factors the matrix as Q*R, where Q is an orthogonal matrix
and R is a triangular matrix.\\
Typing:
$${\tt qr([[3, 5],[4,5]])}$$
gives:
$${\tt \{\left[\begin{array}{rr}\frac{3}{5} & \frac{4}{5}\\\frac{4}{5}&-\frac{3}{5}\end{array}\right],\left[\begin{array}{rr}5 & 7\\0&1\end{array}\right]\}}$$
\subsection{System to matrix : {\tt SYST2MAT}}\index{SYST2MAT}
{\tt SYST2MAT} has two arguments: a vector containing a system of
linear equations ({\tt =} or {\tt ==} is not allowed and so {\tt =0} is omitted), and a 
vector whose elements are the system's
variables.\\
{\tt SYST2MAT} rewrites the system in matrix notation, and returns
the matrix.\\
For example, type:\\
$${\tt SYST2MAT([S1+S2,S1-S2-2],[S1,S2])}$$
You obtain:
$${\tt \left[\begin{array}{rrr}1 & 1&0\\1&-1&-2\end{array}\right]}$$
\subsection{Transposed matrix : {\tt TRAN}}\index{TRAN}
{\tt TRAN} has a matrix $A$ as argument.\\
{\tt TRAN} returns the input matrix $A$ transposed.\\
Typing :
$${\tt TRAN(XQ([[ 1, 1/2],[3,4]]))}$$
gives:
$${\tt [[ 1, 3],[1/2,4]]}$$
Typing :
$${\tt TRAN(XQ(\{\{ 1, 1/2\},\{3,4\}\}))}$$
gives:
$${\tt \{\{ 1, 3\},\{1/2,4\}\}}$$
But typing :
$${\tt TRAN([[ 1, 1/2],[3,4]]))}$$
gives:
$${\tt [[ 1, 3],[0.5,4]]}$$

\subsection{Vandermonde matrix : {\tt VANDERMONDE}}\index{VANDERMONDE}
{\tt VANDERMONDE} has as argument a vector whose components are
denoted by $x_i$ for $i=0..n-1$.\\
{\tt VANDERMONDE} returns the corresponding Vandermonde matrix
(the $k$-th row of the matrix is the vector whose components are
$x_i^{k}$ for $i=0..n-1$ and $k=0..n-1$).\\
Type:
$${\tt VANDERMONDE([1,2,3])}$$
You obtain:
$${\tt  [[1,1,1],[1,2,4],[1,3,9]] }$$
Suppose that {\tt E1=6},  {\tt E2=2*S1+S1*S2} and then type:
$${\tt VANDERMONDE([E1,E2,E3])}$$
You obtain pressing {\tt ENTER}, then $\uparrow$, and then  {\tt SHOW}:
$${\tt  \left[\begin{array}{ccc} 1& 6&36\\ {\tt 1}&{\tt 2\cdot S1+S1\cdot S2}&{\tt (2\cdot S1+S1\cdot S2)^2}\\{\tt 1}&{\tt E3}&{\tt E3^2} \end{array}\right]}$$



%\section{Other matrix functions}


\section{The permutations}
Permutations are defined with the image list $\{P(1),P(2)...P(n)\}$.\\
For example, definining the permutation $P$ as $P =\{3,2,1\}$ means that:\\
$P(1)=3,\ P(2)=2,\  P(3)=1$.\\
A cycle is denoted with a list containing the images of an element through
the cycle; for example, defining a cycle $C$ as $C=\{3,2,1\}$ means that:\\ 
$C(3)=2,\ C(2)=1,\ C(1)=3$.\\ 
Accordingly, a decomposition into cycles is denoted with
a list of lists.\\
\subsection{Cycles to permutation : {\tt C2P}}\index{C2P}
{\tt C2P} has a list of cycles as argument.\\
{\tt C2P} returns the permutation having the input list as
decomposition into cycles (see also {\tt P2C}).\\
Typing:
$${\tt C2P(\{\{1,3,5\},\{2,4\}\})}$$
gives:
$${\tt\{3,4,5,2,1\}}$$

\subsection{Composition : {\tt CIRC}}\index{CIRC}
{\tt CIRC} has two permutations as arguments.\\
{\tt CIRC} returns the permutation obtained by composition:
($1^{\mbox{st}}\mbox{argument} \circ 2^{\mbox{nd}} \mbox{argument}$).\\ 
Typing:
$${\tt CIRC(\{3,4,5,2,1\},\{2,1,4,3,5\})}$$
gives :
$${\tt \{4,3,2,5,1\}}$$

\subsection{Decomposition into cycles\tt P2C}\index{P2C}
{\tt P2C} has a permutation as argument.\\
{\tt P2C} returns its decomposition into cycles and its signature.\\
Typing:
$${\tt P2C(\{3,4,5,2,1\})}$$
gives :
$${\tt \{\{\{1,3,5\},\{2,4\}\},-1\}}$$

\section{The isometries}
\subsection{Isometry's characteristics elements : {\tt ISOM}}\index{ISOM}
{\tt ISOM} has as argument a matrix representing a two or three-dimensional
linear isometry.\\
{\tt ISOM} returns the list of the isometry's characteristics elements
and either {\tt +1} (for direct isometries) or {\tt -1} (for
indirect isometries).\\
For example, type:
$${\tt ISOM([[0,0,1],[0,1,0],[1,0,0]])}$$
You obtain:
$${\tt \{[1,0,-1], -1\}}$$
This result means that the isometry is a simmetry with respect to
the plane $x\ -\ z\ =\ 0$.\\ 
If you type:
$${\tt ISOM(\frac{\sqrt2}{2}\cdot \left[\begin{array}{rr}1 & -1\\1&1\end{array}\right])}$$
You obtain:
$${\tt  \{ACOS(\sqrt(1/2),1\}}$$
therefore, this isometry is a rotation of $ \displaystyle \frac{\pi}{4}$
radians.

\subsection{Isometry's matrix : {\tt MKISOM}}\index{MKISOM}
In a three-dimensional space,
{\tt MKISOM} has the list of the characteristics elements
of an isometry, and either {\tt +1} (denoting a direct isometry)
or {\tt -1} (denoting an indirect isometry) as arguments,\\
In a two-dimensional space,
{\tt MKISOM} has the characteristic element of an isometry
(either an angle or a vector) and either {\tt +1} (denoting a direct isometry)
or {\tt -1} (denoting an indirect isometry) as arguments.\\
{\tt MKISOM} returns the matrix representing the given isometry.\\
For example, type:
$${\tt MKISOM(\{[-1,2,-1],\pi \},1)}$$
You simplify the answer typing :\\
{\tt XQ(} then $\uparrow$ and {\tt COPY}, then {\tt ) ENTER}\\
this gives  the matrix of a rotation with axis $[-1,2,-1]$ and angle $\pi$ :
$${\tt \left[\begin{array}{rrr}\frac{-2}{3} & \frac{-2}{3}&\frac{1}{3}\\\frac{-2}{3}&\frac{1}{3}&\frac{-2}{3}\\\frac{1}{3}&\frac{-2}{3}&\frac{-2}{3}\end{array}\right]}$$
For example, type:
$${\tt MKISOM(\{\pi \},-1)}$$
You obtain the matrix of a symmetry with respect to the origin:
$${\tt [[-1,0,0],[0,-1,0],[0,0,-1]]}$$
Type:
$${\tt MKISOM(\{[1,1,1],\frac{\pi}{3} \},-1)}$$
You obtain (after simplification) the matrix of a rotation with axis $[1,1,1]$ 
and angle
$\frac{\pi}{3}$ combined with a symmetry with respect to the plane $x+y+z=0$:
$${\tt \left[\begin{array}{rrr}0 & -1&0\\0&0&-1\\-1&0&0\end{array}\right]}$$
Type:
$${\tt MKISOM( \frac{\pi}{2},1)}$$
You obtain the matrix of a rotation
of $\frac{\pi}{2}$ radians in two dimensions:
$${\tt [[0, -1],[1,0]]}$$
(because  ${\tt COS(1/2*\pi)=0}$ and ${\tt SIN(1/2*\pi)=1}$)\\
Type:
$${\tt MKISOM([1,1],-1)}$$
You obtain the matrix of a symmetry with respect to $y=x$ in two dimensions:
$${\tt [[0, -1],[-1,0]]}$$

%%% CAS FUNCTIONS %%%

\chapter{{\tt CAS} Reference from the Equation Editor}\label{sec:cas}
When you press on {\tt CAS} in the {\tt HOME} menu bar, you open the Equation 
Editor in wich you can do symbolic calculus. 
In this chapter, we describe the computer algebra functions as used
from the Equation Editor (see section \ref{sec:cashome} and chapter
\ref{sec:mtrcas} if you want
to use {\tt CAS} functions from {\tt HOME}).

\section{{\tt CAS} menu bar}
The Equation Editor has a  menu bar : it is the {\tt CAS} menu bar.\\
{\tt TOOL}, {\tt ALGB}, {\tt DIFF}, {\tt REWRI}, {\tt SOLV} and {\tt TRIG} 
compose the {\tt CAS} menu bar.\\
Only the {\tt TOOL} menu contains commands, the other menus contain the 
algebraic functions that can be written in {\tt Alpha} mode and have on its 
first line the sub-menu {\tt CFG} enable you to change your configuration.

\subsection{Change your configuration : {\tt CFG}}\index{CFG}\label{sec:cfg}
All the menus, except {\tt TOOL} display the state of your configuration and 
enable you to change it.\\
For example, say that you see the following on the first line of a menu:
$${\tt CFG :\ R\ =\ X \  S}$$
This means that :\\
(1) you are in exact-real mode,\\ 
(2) {\tt X} is the current variable, and \\
(3) you are working in Step by step mode ({\tt S}).\\
If you highlight {\tt CFG} and press {\tt OK}, a menu is displayed with this at
 its head:
$${\tt CFG :\ R\ =\ STEP\ \uparrow\ X \ 13\ ||}$$
This means that :\\
 (1) you are in exact-real mode,\\
 (2) Step by step mode is selected,\\
 (3) polynomials are written with their terms in ascending order by exponent,\\
 (4) {\tt X} is the current variable,\\
 (5) modular calculations are carried out in {\tt Z/13Z} ($p = 13$), and\\
 (6) you are working in Rigorous mode (that is, using absolute values).\\
You can change this configuration by selecting any of the following:\\
{\tt Quit cfg} (when you're finished making changes)\\
{\tt Complex} (or {\tt Real})\\
{\tt Approx} (or {\tt Exact})\\
{\tt Direct} (or {\tt Step/Step} if you want to work in Step by Step mode)\\
${\tt 1 + x + x^2...}$ (or ${\tt ...x^2 + x +1}$) how polynomials will appear,\\
{\tt Sloppy} (or {\tt Rigorous}, if you want to work in absolute values)\\
{\tt Num. factor} (or {\tt Symb factor})\\
{\tt Cmplx vars} (or {\tt Real vars} if you want all symbolic variables to be 
treated as reals cf. \ref{sec:realassume})\\
{\tt English} (or {\tt Français} if you want the line-based help to be in 
French)\\
{\tt Default cfg} (configuration  ${\tt R\ =\ STEP\ \downarrow\ X \ 13\ ||}$.\\
Press {\tt OK} to validate each of your choices.\\
Pressing {\tt CANCEL} takes you out of the {\tt CFG} menu (as does choosing 
{\tt quit cfg} and confirming it with {\tt OK}).\\
The name of the current variable contained in {\tt VX}, as well as the value 
of the variable {\tt MODULO}, can be changed by means of the 
{\tt SHIFT SYMB (SETUP)} keystroke, or by using the {\tt VARS} key 
(see \ref{sec:config} and \ref{sec:vars}).\\
{\sc Remarks} :\\
- You can also change your configuration with the
{\tt SHIFT SYMB (SETUP)} (or {\tt SHIFT HOME (MODES)}) keystrokes pressed in 
the Equation Editor (see section \ref{sec:config}).\\
- In {\tt CAS}, angles are always expressed in {\tt Radians}.\\ 
When you are in {\tt HOME} screen, you can use the {\tt MODES} menu
(the {\tt SHIFT HOME} keystrokes) to open the 
{\tt HOME MODES} screen and to change {\tt ANGLE MEASURE} or open the 
{\tt CAS MODES} screen with the
{\tt SHIFT F6(CAS on the menu bar)} to change your CAS configuration.

\subsection{{\tt Step/Step} Mode}
You choose Step by Step mode ({\tt Step/Step}, abbreviated {\tt S}) when you
 want to see the details of the calculations.\\
The details of the calculations are displayed on the screen and you can view 
the next step by pressing {\tt OK}.\\
When the screen is not big enough to display all the information, directional 
arrows $\blacktriangledown$ and  $\blacktriangle$ appear on the edge of the 
screen. You can then scroll the screen to see more information by using the 
arrow keys $\triangledown \ \vartriangle$.\\
If you do not need to see the details of the calculations, choose {\tt Direct}
 mode (abbreviated {\tt D}).

\subsection{{\tt TOOL} menu}
The functions contained in the {\tt TOOL} menu are described in section 
\ref{sec:eqwmenu}.\\
{\tt Cursor mode}\index{Cursor mode}\\
{\tt Edit expr.}\index{Edit expr.}\\
{\tt Change font}\index{Change font}\\
{\tt Cut}\index{Cut}\\
{\tt Copy}\index{Copy}\\
{\tt Paste}\index{Paste}

\subsection{{\tt ALGB} menu}
\noindent{\tt COLLECT}\index{COLLECT}\\
{\tt DEF}\index{DEF}\\
{\tt EXPAND}\index{EXPAND}\\
{\tt FACTOR}\index{FACTOR}\\
{\tt PARTFRAC}\index{PARTFRAC}\\
{\tt QUOTE}\index{QUOTE}\\
{\tt STORE}\index{STORE}\\
{\tt |}\index{$\mid$}\\
{\tt SUBST}\index{SUBST}\\
{\tt TEXPAND}\index{TEXPAND}\\
{\tt UNASSIGN}\index{UNASSIGN}

\subsection{{\tt DIFF} menu}
\noindent{\tt DERIV}\index{DERIV}\\
{\tt DERVX}\index{DERVX}\\
{\tt DIVPC}\index{DIVPC}\\
{\tt FOURIER}\index{FOURIER}\\
{\tt IBP}\index{IBP}\\
{\tt INTVX}\index{INTVX}\\
{\tt lim}\index{LIMIT}\\
{\tt PREVAL}\index{PREVAL}\\
{\tt RISCH}\index{RISCH}\\
{\tt SERIES}\index{SERIES}\\
%\tt SIGNTAB}\index{SIGNTAB}\\
{\tt TABVAR}\index{TABVAR}\\
{\tt TAYLOR0}\index{TAYLOR0}\\
{\tt TRUNC}\index{TRUNC}

\subsection{{\tt REWRI} menu}
\noindent{\tt DISTRIB}\index{DISTRIB}\\
{\tt EPSX0}\index{EPSX0}\\
{\tt EXPLN}\index{EXPLN}\\
{\tt EXP2POW}\index{EXP2POW}\\
{\tt FDISTRIB}\index{FDISTRIB}\\
{\tt LIN}\index{LIN}\\
{\tt LNCOLLECT}\index{LNCOLLECT}\\
{\tt POWEXPAND}\index{POWEXPAND}\\
{\tt SINCOS}\index{SINCOS}\\
{\tt SIMPLIFY}\index{SIMPLIFY}\\
{\tt XNUM}\index{XNUM}\\
{\tt XQ}\index{XQ}

\subsection{{\tt SOLV} menu}
\noindent{\tt DESOLVE}\index{DESOLVE}\\
{\tt ISOLATE}\index{ISOLATE}\\
{\tt LDEC}\index{LDEC}\\
{\tt LINSOLVE}\index{LINSOLVE}\\
{\tt SOLVE}\index{SOLVE}\\
{\tt SOLVEVX}\index{SOLVEVX}

\subsection{{\tt TRIG} menu}
\noindent{\tt ACOS2S}\index{ACOS2S}\\
{\tt ASIN2C}\index{ASIN2C}\\
{\tt ASIN2T}\index{ASIN2T}\\
{\tt ATAN2S}\index{ATAN2S}\\
{\tt HALFTAN}\index{HALFTAN}\\
{\tt SINCOS}\index{SINCOS}\\
{\tt TAN2CS2}\index{TAN2CS2}\\
{\tt TAN2SC}\index{TAN2SC}\\
{\tt TAN2SC2}\index{TAN2SC2}\\
{\tt TCOLLECT}\index{TCOLLECT}\\
{\tt TEXPAND}\index{TEXPAND}\\
{\tt TLIN}\index{TLIN}\\
{\tt TRIG}\index{TRIG}\\
{\tt TRIGCOS}\index{TRIGCOS}\\
{\tt TRIGSIN}\index{TRIGSIN}\\
{\tt TRIGTAN}\index{TRIGTAN}

\subsection{{\tt The MATH} key}\label{sec:math}
It contains, in addition to the previously described menus ({\tt Algebra}, 
{\tt Diff\&Int}, {\tt Rewrite}, 
{\tt Trig.}, {\tt Solve}) we have :\\ 
{\tt Complex}
({\tt i}\index{i}
{\tt ABS}\index{ABS}
{\tt ARG}\index{ARG}
{\tt CONJ}\index{CONJ}
{\tt DROITE}\index{DROITE}
{\tt IM}\index{IM}
{\tt -}\index{-}
{\tt RE }\index{RE}
{\tt SIGN}\index{SIGN})\\
{\tt Constant} 
(${\tt e\ i \ \infty \pi}$)\\
 {\tt Hyperb.} 
({\tt ACOSH ASINH ATANH COSH SINH TANH})\\
{\tt Integer}
({\tt DIVIS}\index{DIVIS}
{\tt EULER}\index{EULER}
{\tt FACTOR}\index{FACTOR}
{\tt GCD}\index{GCD}
{\tt IDIV2}\index{IDIV2}
{\tt IEGCD}\index{IEGCD}
{\tt IQUOT}\index{IQUOT}
{\tt IREMAINDER}\index{IREMAINDER}
{\tt ISPRIME?}\index{ISPRIME?}
{\tt LCM}\index{LCM}
{\tt MOD}\index{MOD}
{\tt NEXTPRIME}\index{NEXTPRIME}
{\tt PREVPRIME}\index{PREVPRIME})\\
{\tt Modular}
({\tt ADDTMOD}\index{ADDTMOD}
{\tt DIVMOD}\index{DIVMOD}
{\tt EXPANDMOD}\index{EXPANDMOD}
{\tt FACTORMOD}\index{FACTORMOD}
{\tt GCDMOD}\index{GCDMOD}
{\tt INVMOD}\index{INVMOD}
{\tt MODSTO}\index{MODSTO}
{\tt MULTMOD}\index{MULTMOD}
{\tt POWMOD}\index{POWMOD}
{\tt SUBTMOD}\index{SUBTMOD})\\
{\tt Polynom.}
({\tt EGCD}\index{EGCD}
{\tt FACTOR}\index{FACTOR}
{\tt GCD}\index{GCD}
{\tt HERMITE}\index{HERMITE}
{\tt LCM}\index{LCM}
{\tt LEGENDRE}\index{LEGENDRE}
{\tt PARTFRAC}\index{PARTFRAC}
{\tt PROPFRAC}\index{PROPFRAC}
{\tt PTAYL}\index{PTAYL}
{\tt QUOT}\index{QUOT}
{\tt REMAINDER}\index{REMAINDER}
{\tt TCHEBYCHEFF}\index{TCHEBYCHEFF})\\
{\tt Reals}
({\tt CEILING}\index{CEILING}
{\tt FLOOR}\index{FLOOR}
{\tt FRAC}\index{FRAC}
{\tt INT}\index{INT}
{\tt MAX}\index{MAX}
{\tt MIN}\index{MIN})\\
{\tt Tests} 
({\tt ASSUME}\index{ASSUME}
{\tt UNASSUME}\index{UNASSUME}
${\tt  > \ \geq \ < \ \leq \  == \  \neq}$ {\tt AND OR  NOT}
{\tt IFTE}\index{IFTE})\\
Refer to sections \ref{sec:eqwmenu} and \ref{sec:tmath} for 
descriptions of these menus.


\section{Integers (and Gaussian Integers)}
All the functions in this section are found in the {\tt MATH} key's 
{\tt Integer} menu, except {\tt IABCUV ICHINREM PA2B2}, which is in the 
{\tt SHIFT MATH (CMDS)} key's menu.\\
For certain functions, you can use Gaussian integers (numbers of the form 
 $a+ib$, where $a$ and $b$ are integers) in the place of integers.

\subsection{Unlimited precision}
The calculator can manage integers with unlimited precision, such as the 
following:
$$100!$$
\indent The symbol  \ $!$ \  is obtained by typing ${\tt SHIFT\ \times}$\\
The decimal value of $100!$ is very large, but you can view it by using the 
{\tt VIEWS} key.

\subsection{The divisors of a number : {\tt DIVIS}}\index{DIVIS}
{\tt DIVIS} gives the divisors of a number.\\
Typing :
$${\tt DIVIS(12) }$$
gives:
$${\tt 12 \ OR\  6\ OR\ 3\ OR\  4\ OR\  2\ OR\ 1 }$$
{\sc Note} : ${\tt DIVIS(0)=0  \ OR\  1}$
\subsection{The Euler index : {\tt EULER}}\index{EULER}
{\tt EULER} returns the Euler index for a whole number.\\
{\tt EULER(n)} is equal to the number of  whole numbers less than $n$ and 
prime with $n$.\\
Typing:
$${\tt EULER(21)}$$
gives:
$${\tt 12}$$
In other words:\\
E=\{2,4,5,7,8,10,11,13,15,16,17,19\} is the set of whole numbers less than 21 
and prime with 21. There are 12 members of the set, so Cardinal(E)=12.
\subsection{Decomposition into prime factors : {\tt FACTOR }}\index{FACTOR}
{\tt FACTOR} decomposes an integer into its prime factors.\\
Typing:
$${\tt FACTOR(90)}$$
gives:
$${\tt 2\cdot3^2\cdot5}$$
\subsection{The greatest common divisor : {\tt  GCD}}\index{GCD}
{\tt GCD} returns the greatest common divisor of two integers.\\
Typing:
$${\tt GCD(18,15) }$$
gives:
$${\tt 3}$$
In Step by step mode, typing:
$${\tt GCD(78,24) }$$
gives: \\
${\tt 78\ \bmod \ 24 \ = \ 6}$\\
${\tt 24\ \bmod \ 6 \ = \ 0}$\\
{\tt Result 6}\\
Pressing {\tt ENTER} then causes {\tt 6} to be written to the Equation Editor.
%Nouveau
\subsection{Resolution of $au+bv=c$ : {\tt IABCUV}}\index{IABCUV}
{\tt IABCUV(A,B,C)} returns {\tt U \ AND \ V} so that {\tt AU+BV=C}.\\
It is of course necessary that {\tt C} must be a multiple of {\tt GCD(A,B)} to 
obtain a solution.\\
Typing :
$${\tt IABCUV(48,30,18) }$$
gives :
$${\tt 6 \ AND\  -9}$$

%Nouveau
\subsection{Chinese remainders :{\tt ICHINREM}}\index{ICHINREM}
{\tt ICHINREM(A AND  P,B AND Q)} returns {\tt C AND R}.\\
The numbers ${\tt X=C+k \cdot R}$ where ${\tt k}\in \mathbb Z$ are such that :\\
${\tt X=A \bmod P}$ and ${\tt X=B \bmod Q}$.\\
A solution {\tt X} always exists when  {\tt P} and {\tt Q} are mutually prime,
({\tt GCD(P,Q)=1}) and in this case, all
 the solutions are congruent modulo ${\tt R=P \cdot Q}$.\\
Typing :
$${\tt ICHINREM(7 \ AND\  10,12 \ AND\  15)}$$
gives :
$${\tt -3 \ AND\  30}$$
that is to say that the solutions are such that :\\
${\tt X=-3 \bmod 30}$\\
{\sc Example} : \\
Gives the solutions of :
$${\tt \left \{ \begin{array}{rl} X=&3\ (\bmod\ 5)\\ X=&9\ (\bmod\ 13) \end{array}\right.}$$
Typing :
$${\tt ICHINREM(3 \ AND\  5,9 \ AND\  13)}$$
gives :
$${\tt -147 \ AND\  65}$$
that is to say that the solutions are such that :\\
${\tt X=-147 \bmod 65}$
%Nouveau
\subsection{Quotient and remainder of two integers : {\tt IDIV2}}\index{IDIV2}
{\tt IDIV2} returns the quotient {\tt  AND} the remainder of the Euclidean division between two integers.\\
Typing:
$${\tt IDIV2(148,5) }$$
gives:
$${\tt 29\ AND\ 3}$$
In step-by-step mode, the calculator shows the division process
like it is taught at school. The division is carried out as if in longhand, 
using the so-called "gallows"  algorithm.


\subsection{Bézout's Identity : {\tt IEGCD}}\index{IEGCD}
{\tt IEGCD(A,B)} returns the value of Bézout's Identity for two integers.\\
In other words, {\tt IEGCD(A,B)} returns {\tt U AND V = D}, with {\tt U, V, D}
 such that:\\
 {\tt AU+BV=D} and {\tt D=GCD(A,B)}.\\
Typing:
$${\tt IEGCD(48,30) }$$
gives
$${\tt 2 \ AND\ -3=6}$$
In other words:
$2 \cdot 48+ (-3) \cdot 30 =6$ and gcd(48,30)=6\\
In Step by step mode, we get:\\
{\tt [z,u,v]:z=u*48+v*30}\\
{\tt [48,1,0]}\\
{\tt [30,0,1]*-1}\\
{\tt [18,1,-1]*-1 }\\
{\tt [12,-1,2]*-1}\\ 
{\tt [6,2,-3]*-2}\\
{\tt Result : [6,2,-3]}\\
puis {\tt ENTER} ou {\tt OK},\\
 $${\tt 2 \ AND\ -3=6}$$
to be written to the Equation Editor.


\subsection{The integer Euclidean quotient : {\tt IQUOT}}\index{IQUOT}\label{sec:iquot}
{\tt IQUOT} returns the integer quotient of the Euclidean division of two integers.\\
Typing:
$${\tt IQUOT(148,5)}$$
gives:
$${\tt 29}$$
In Step by step mode, the division is carried out as if in longhand:
$$\begin{array}{rcl} 148 & | &\ 5\\ 48 & |&---\\ 3 &| &29 \end{array}$$
Press {\tt OK} to execute the division step by step, then press {\tt ENTER} to 
write the result {\tt 29} to the Equation Editor.
\subsection{The integer remainder : {\tt IREMAINDER}}\index{IREMAINDER}
{\tt IREMAINDER} returns the integer remainder from the Euclidean division of 
two integers.\\
{\tt IREMAINDER} is found in the {\tt MATH} key's Integer menu.\\
Typing:
$${\tt IREMAINDER(148,5)}$$
gives:
$${\tt 3}$$
{\tt IREMAINDER} works with integers or with Gaussian integers, which is what
 distinguishes it from {\tt MOD}.\\
{\sc Example}
$${\tt IREMAINDER(2+3 \cdot i,1+i)}$$
 returns {\tt i}\\
Try calculating:
$${\tt IREMAINDER(148!,5!+2 )}$$
(The symbol $!$  is obtained by typing ${\tt SHIFT \ \times}$).

In Step by step mode, the division is carried out as if in longhand, using the 
so-called "gallows" algorithm (see  \ref{sec:iquot} for an example).

\subsection{Test of pseudo-primality : {\tt ISPRIME?}}\index{ISPRIME?}
{\tt ISPRIME?(N)} returns {\tt 1.} (TRUE) if {\tt N} is a pseudo-prime, and 
{\tt 0.} (FALSE) if {\tt N} is not prime.\\
{\sc Definition}: For numbers less than  $10^{14}$, pseudo-prime and prime
 mean the same thing. But for numbers greater than  $10^{14}$, a pseudo-prime
 is a number with a large probability of being prime (cf. Rabin's Algorithm, section 7.6).\\
Typing:
$${\tt ISPRIME?(13) }$$
gives:
$${\tt 1.}$$
Typing:
$${\tt ISPRIME?(14) }$$
gives:
$${\tt 0.}$$
\subsection{The least common multiple : {\tt LCM}}\index{LCM} 
{\tt LCM} returns the least common multiple of two integers.\\
Typing:
$${\tt LCM(18,15) }$$
gives:
$${\tt 90}$$
\subsection{Remainder of the Euclidean division : {\tt MOD}}\index{MOD}
{\tt MOD} is an infix function that has two integers as arguments.\\
{\tt MOD} returns the remainder of the Euclidean division of the arguments.\\
Typing: 
$${\tt 3\ MOD\ 2}$$
produces the result:
$${\tt 1}$$
{\tt MOD} accepts real numbers ($7.5 \ \bmod \ 2.1 \ =\ 1.2$), but not 
Gaussian integers (cf section \ref{sec:mod}).
\subsection{The smallest pseudo-prime greater than {\tt N} : {\tt NEXTPRIME}}\index{NEXTPRIME}
{\tt NEXTPRIME(N)} returns the smallest pseudo-prime greater than {\tt N}.\\
Typing:
$${\tt NEXTPRIME(75)}$$
gives:
$${\tt 79}$$
%Nouveau
\subsection{Resolution of $a^2+b^2=p$ with integers: {\tt PA2B2}}\index{PA2B2}
{\tt PA2B2} decompose a prime integer $p$ congruent to 1 modulo 4, as follows:
$p= a^2+b^2$. \\
The calculator gives the result as $a+b \cdot i$\\
Typing :
$${\tt PA2B2(17)}$$
gives :
$${\tt 4+i }$$
that is,  $17=4^2+1^2$\\
Typing :
$${\tt PA2B2(29)}$$
gives :
$${\tt 5+2 \cdot i }$$
that is, $29=5^2+2^2$

\subsection{The greatest pseudo-prime less than {\tt N} : {\tt PREVPRIME}}\index{PREVPRIME}
{\tt PREVPRIME(N)} returns the greatest pseudo-prime less than {\tt N}.\\
Typing:
$${\tt  PREVPRIME(75)}$$
gives:
$${\tt 73}$$


\section{Modular Calculations}
All the functions in this section are found in the {\tt MATH} key's 
{\tt Modular} menu except {\tt DIV2MOD}, which is in the 
{\tt SHIFT MATH (CMDS)} key's menu.\\
You can carry out calculations in modulo {\tt p} that is, in ${\tt Z/pZ}$ 
 or in ${\tt Z/pZ[X]}$.\\
{\sc Note}: For some commands, {\tt p} must be prime.\\
{\sc All the examples in this section use a value for {\tt p} of {\tt 13}}.\\
It's assumed that you have already typed:
$${\tt MODSTO(13)}$$
or that you have used the {\tt SHIFT SYMB (SETUP)} keystroke to switch 
{\tt MODULO} to {\tt 13}.
The representation is the symetric representation (-5 instead of 8 modulo 13).
\subsection{Addition in Z/pZ or in Z/pZ[X]  : {\tt ADDTMOD}}\index{ADDTMOD}
{\tt ADDTMOD} performs an addition in $Z/pZ$.\\
Typing:
$${\tt ADDTMOD(2,18)}$$
gives:
$${\tt -6}$$

{\tt ADDTMOD} performs an addition in  $Z/pZ[X]$.\\
Typing:
$${\tt ADDTMOD(11X+5,8X+6)}$$
gives:
$${\tt 6X-2}$$
%Nouveau
\subsection{Quotient and remainder in Z/pZ[X]: {\tt DIV2MOD}}\index{DIV2MOD}
The arguments of {\tt DIV2MOD} are two polynomials {\tt A[X]} and {\tt B[X]}.
The result is a {\tt AND} containing both the quotient and the remainder of 
the euclidean division of {\tt A[X]} by {\tt B[X]} in $Z/pZ[X]$.\\
Typing:
$${\tt DI2VMOD(X^3+X^2+1,2\cdot X^2+4)}$$
you obtain in $Z/13Z$ :
$${\tt -(6X+6)\  AND\  -(2X+1)}$$
since $X^3+X^2+1=(2\cdot X^2+4) \cdot \frac{X+1}{2}+\frac{5\cdot X-4}{4}$\\
$2*(-6)=1 \bmod 13$ and \\
$4*(-3)=1 \bmod 13$

\subsection{Division in Z/pZ or in Z/pZ[X] : {\tt DIVMOD}}\index{DIVMOD}
The arguments are two integers $A$ and $B$. When $B$ has an inverse in 
$Z/pZ$, the result is $\frac{A}{B}$ simplified as $Z/pZ$, else there is an 
error message.\\
Typing:
$${\tt DIVMOD(5,3)}$$
gives:
$${\tt 6}$$

The arguments are two polynomials $A[X]$ and $B[X]$. The result is a 
rationale fraction $\frac{A[X]}{B[X]}$ simplified as $Z/pZ[X]$.\\
Typing:
$${\tt DIVMOD(2X^2+5,5X^2+2X-3)}$$
gives:
$${\tt -\frac{4X+5}{3X+3}} $$


\subsection{To expand and simplify expressions in  Z/pZ or in Z/pZ[X] : {\tt EXPANDMOD}}\index{EXPANDMOD}
{\tt EXPANDMOD} has as an argument a integer expression.\\
{\tt EXPANDMOD} expands this expression in $Z/pZ$.\\
Typing:
$${\tt EXPANDMOD(2*3+5*4)}$$
gives:
$${\tt 0}$$

{\tt EXPANDMOD} has as an argument a polynomial expression.\\
{\tt EXPANDMOD} expands this expression in $Z/pZ[X]$.\\
Typing:
$${\tt EXPANDMOD(( 2X^2+12).( 5X-4))}$$
gives:
$${\tt -(3X^3-5X^2+5X-4)}$$
\subsection{To factor polynomials in Z/pZ[X] : {\tt FACTORMOD}}\index{FACTORMOD}
{\tt FACTORMOD} has as an argument a polynomial.\\
{\tt FACTORMOD} factors this polynomial in $Z/pZ[X]$, providing that 
${\tt p \leq 97}$ and $p$ is prime.\\
Typing:
$${\tt FACTORMOD(-(3X^3-5X^2+5X-4))}$$
gives:
$${\tt -((3X-5)(X^2+6))}$$
\subsection{GCD of the two polynomials in Z/pZ[X] : {\tt GCDMOD}}\index{GCDMOD}
{\tt GCDMOD} has two polynomials as arguments.\\
{\tt GCDMOD} calculates the GCD of the two polynomials in $Z/pZ[X]$.\\
Typing:
$${\tt GCDMOD(2X^2+5,5X^2+2X-3)}$$
gives:
$${\tt -(6X-1)}$$
\subsection{Inverse in Z/pZ : {\tt INVMOD}}\index{INVMOD}
{\tt INVMOD} has as an argument an integer.\\
{\tt INVMOD} calculates the inverse of the integer in $Z/pZ$.\\
Typing:
$${\tt INVMOD(5)}$$
gives (since $5\times-5=-25=1\ (\bmod\ 13)$) :
$${\tt -5}$$
\subsection{To put a value in the {\tt  MODULO} variable : {\tt MODSTO}}\index{MODSTO}
You use the {\tt MODSTO} command to set the value of the {\tt MODULO} variable 
{\tt p}.\\
{\sc The examples in this section all use a value for {\tt p} of {\tt 13}}
that is, they assume that you have already typed:
$${\tt MODSTO(13)}$$
\subsection{Multiplication in Z/pZ or Z/pZ[X] : {\tt MULTMOD}}\index{MULTMOD}
{\tt MULTMOD} performs a multiplication in $Z/pZ$.\\
Typing:
$${\tt MULTMOD(11,8)}$$
gives:
$${\tt -3}$$

{\tt MULTMOD} performs a multiplication in $Z/pZ[X]$.\\
Typing:
$${\tt MULTMOD(11X+5,8X+6)}$$
gives:
$${\tt -(3X^2-2X-4)}$$
\subsection{Power in Z/pZ or in Z/pZ[X] : {\tt POWMOD}}\index{POWMOD}
 {\tt POWMOD(A,N)} calculates {\tt A} to the power of {\tt N} in $Z/pZ[X]$, and
 {\tt POWMOD(A(X),N)} calculates {\tt A(X)} to the power of {\tt N} in 
$Z/pZ[X]$.\\
The {\tt MODULO} variable {\tt p} must be a prime number less than 100.\\
Typing:
$${\tt POWMOD(11,195)}$$
gives if ${\tt p=13}$:
$${\tt 5}$$
In effect:  $11^{12}=1 \ \bmod \ 13$ so $11^{195}=11^3=5 \ \bmod \ 13$\\
Typing:
$${\tt POWMOD(2X+1,5)}$$
gives:
$${\tt 6 \cdot X^5+2 \cdot X^4+2 \cdot X^3+X^2-3 \cdot X+1}$$
since:\\
 $10=-3 \ (\bmod\ 13) \ \  40=1\ (\bmod\ 13)\ \   80=2 \ (\bmod\ 13)$\\
$ 32=6\ (\bmod\ 13)$.
\subsection{Subtraction in Z/pZ or in Z/pZ[X] : {\tt SUBTMOD}}\index{SUBTMOD}
{\tt SUBTMOD} performs a subtraction in $Z/pZ$. \\
Typing:
$${\tt SUBTMOD(29,8)}$$
gives:
$${\tt -5}$$

{\tt SUBTMOD} performs a subtraction in $Z/pZ[X]$. \\
Typing:
$${\tt SUBTMOD(11X+5,8X+6)}$$
gives:
$${\tt 3X-1}$$
\section{Rational Numbers}
Calculate:
$$\frac{123}{12}+\frac{57}{21}$$
After you press {\tt ENTER}, you get the result:
$$\frac{363}{28}$$
If you now invoke the {\tt XNUM}\index{XNUM} function on the {\tt REWRITE} 
menu, or if you press the {\tt NUM} key, you get the following result:
$$12.9642857143$$
If you mix the two representations, for example:
$$\frac{1}{2}+0\ .\ 5$$
the calculator asks to go into {\tt approx} mode to do the calculation. 
After responding {\tt yes}, you get:
$$1.$$
You'll then need to go back into exact mode ({\tt CFG}, etc... or by typing
{\tt SHIFT NUM}).
%Nouveau
\subsection{The $n$-th Bernoulli's number : {\tt IBERNOULLI}}\index{IBERNOULLI}
{\tt IBERNOULLI} has as an integer $n$ as argument.\\
{\tt IBERNOULLI} returns the $n^{th}$ Bernoulli's number $B(n)$.\\
We have :
$$\frac{t}{e^t-1}=\sum_{n=0}^{+\infty} \frac{B(n)}{n!}t^n$$
Remember that the Bernoulli's  polynomials $B_k$ are defined as :
$$B_0=1$$
$$B_k{'}(x)=kB_{k-1}(x)$$
$$\int_0^1B_k(x)dx=0$$
Then, the Bernoulli's numbers are defined as:\\
$B(n)=B_n(0)$\\
Typing :
$${\tt IBERNOULLI(6)}$$
gives :
$${\tt \frac{1}{42}}$$
\subsection{Whole-number and fractionnal part : {\tt PROPFRAC}}\index{PROPFRAC}
{\tt PROPFRAC} is found in the {\tt MATH} key's {\tt POLYNOMIAL} menu.\\
${\tt PROPFRAC(\frac{A}{ B})}$ writes the fraction $\frac{A}{B}$ in the form:
$$Q+\frac{R}{B}\ \ avec \ \ 0\leq R<B$$
Typing:
$${\tt  PROPFRAC(\frac{43}{ 12})}$$
gives:
$${\tt 3+\frac{7}{12}}$$
\subsection{Symbolic summation : ${\tt \sum}$}\index{$\sum$}
To calculate symbolic summations of rational 
fractions and hypergeometric series that allow a discrete primitive, you can
use the symbol $\sum$ which can be produced by typing : {\tt SHIFT +} (see also
\ref{sec:sum}).\\
Example:\\
If you type :
$${\tt \sum_{K=1}^\infty \frac{1}{K \cdot (K+1)}}$$
then select the entire expression and press {\tt ENTER}, you obtain:
$${\tt 1}$$
If you type:
$${\tt \sum_{K=1}^5 \frac{1}{K \cdot (K+1)}}$$
then select the entire expression and press {\tt ENTER}, you obtain:
$${\tt \frac{5}{6}}$$

\section{Real Numbers}
Calculate:
$${\tt EXP(\pi \times \sqrt{20})}$$
When you press the {\tt ENTER} key, the response is:
$${\tt EXP(2 \times \sqrt5 \times \pi)}$$
If you then invoke the {\tt XNUM}\index{XNUM} function on the {\tt REWRITE} 
menu or press the {\tt NUM} key, the result is:
$$1263794.7537$$
In the {\tt MATH} key's {\tt Real} menu, you'll find the {\tt FLOOR} function
and in the {\tt MATH} key's {\tt Integer} menu, you'll find the 
{\tt MOD} function.
\subsection{The whole part : {\tt FLOOR}}\index{FLOOR}
{\tt FLOOR} has as an argument a real number, and returns its whole part.\\
Typing:
$${\tt  FLOOR(3.53)}$$
gives:
$${\tt 3}$$

%Nouveau
\subsection{The $\Gamma$ function : {\tt GAMMA}}\index{GAMMA}
{\tt GAMMA} returns the values of the $\Gamma$ function at  the given point.\\
The $\Gamma$ function is defined as:\\
$$\Gamma(x)=\int_0^{+\infty}e^{-t}t^{x-1}dt$$
We have : 
$$\Gamma(1)=1$$
$$ \Gamma(x+1)=x \cdot \Gamma(x)$$
Typing :
$${\tt GAMMA(5)}$$
gives :
$${\tt 24}$$
Typing :
$${\tt GAMMA(\frac{1}{2})}$$
gives :
$${\tt \sqrt\pi}$$

\subsection{Remainder of the Euclidean division : {\tt MOD}}\index{MOD}\label{sec:mod}
{\tt MOD} is an infix function that has two integers or reals as arguments
$a$ and $b$.\\
{\tt MOD} returns the remainder of the Euclidean division of the arguments
$a$ and $b$ or the real $r$ such that $a=b*q+r$ with $q$ integer and 
$0\leq r<b$ or $b<r\geq 0$.\\
Typing: 
$${\tt 3\ MOD\ 2}$$
produces the result:
$${\tt 1}$$
Typing : 
$${\tt 3.2\ MOD\ 2.1}$$
produces the result :
$${\tt 1.1}$$
because we have $3.2=2.1+1.1$ and $0\leq 1.1<2.1$\\\\
Typing: 
$${\tt 3.2\ MOD\ -2.1}$$
produces the result:
$${\tt -1.}$$
because we have $3.2=(-2.1)*(-2)+1.$ and $-2.1<-1.\leq 0$\\
Typing : 
$${\tt 7.5\ MOD\ 2.15}$$
produces  the result :
$${\tt 1.05}$$
because we have $7.5=2.15*3+1.05$ and  $0\leq 1.05<2.15$
%Nouveau
\subsection{The derivatives of the Digamma function :{\tt PSI}}\index{PSI}
{\tt PSI} has a number $a$ and an integer $n$ as arguments .\\ 
{\tt PSI} returns the value of the $n$-th  derivative of the Digamma function 
at $a$. The function Digamma is the derivative of $\ln(\Gamma(x))$.\\
Typing :
$${\tt PSI(3,1)}$$
gives :
$${\tt -\frac{5}{4}+\frac{1}{6} \cdot \pi^2}$$
%Nouveau
\subsection{The Digamma function : {\tt Psi}}\index{Psi}
{\tt Psi} has as argument a number $a$.\\
{\tt Psi} returns the value of the Digamma function at $a$.\\ 
The Digamma function is defined as the derivative of $\ln(\Gamma(x))$, so 
we have :\\ 
{\tt PSI(a,0)=Psi(a)}.\\
Typing :
$${\tt Psi(3)}$$
gives (press on {\tt NUM}) :
$${\tt .922784335098}$$

\section{Complex Numbers}
{\sc Note} : Complex numbers of the form $a+b \cdot i$, where $a$ and $b$ are real 
numbers, can be notated $(a, b)$ or $a + b \cdot i$.\\
The operators {\tt +,-,*,/,}\verb|^| can be used for complex numbers.\\
Type:
$${\tt (1+2 \cdot i)^2}$$
Then press {\tt ENTER}.\\
If you are not in complex mode, the calculator asks to change modes. After 
responding {\tt YES}, you get:
$${\tt -(3-4 \cdot i)}$$
It's worth noting that this expression will not be simplified further: in exact
 mode, the result is always notated such that the real part of the complex 
number is positive.\\
In the {\tt MATH} key's Complex menu you will find the following functions, all
 of which have complex numbers as parameters:\\

{\tt ABS}\index{ABS} to determine the modulus of the parameter,\\
{\tt ARG}\index{ARG} to determine the argument of the parameter,\\
{\tt CONJ}\index{CONJ} to determine the conjugate of the parameter,\\
{\tt DROITE}\index{DROITE} takes two complex numbers $z_1,\ z_2$ as parameters,
and  returns the equation of the line through the Cartesian points, 
$z_1,\ z_2$.\\
{\tt IM}\index{IM} to determine the imaginary part of the parameter,\\
{\tt -}\index{-} to determine the opposite of the parameter,\\
{\tt RE}\index{RE} to determine the real part of the parameter,\\
{\tt SIGN}\index{SIGN} to determine the quotient of the parameter divided by 
its modulus.
\subsection{Argument of a  complex number : {\tt ARG}}\index{ARG}
Typing:
$${\tt ARG(3+4 \cdot i)}$$
produces (given that in {\tt CAS}, you're working in {\tt Radians}):
$${\tt ATAN(\frac{4}{3})}$$
{\sc Remark}:\\
You can do the same calculation in {\tt HOME}, but you get a numeric result 
({\tt 0.64250...}, if you're working in {\tt Radians})\\
In {\tt HOME}, typing:
$${\tt ARG(XQ(3+4 \cdot i))}$$
produces:
$${\tt ATAN(\frac{4}{3})}$$
\subsection{Conjugate of a  complex number : {\tt CONJ}}\index{CONJ}
Typing:
$${\tt CONJ(1+2 \cdot i)}$$
produces the result:
$${\tt 1-2 \cdot i}$$
{\sc Note}: If you chose {\tt Real vars} from the {\tt CFG} configuration menu,
 then {\tt CONJ(Z)=Z}; if you chose {\tt Cmplx vars}, {\tt CONJ(Z)} will be 
different from {\tt Z} as long as {\tt Z} is not in the list that contains the
 variable {\tt REALASSUME}\index{REALASSUME}. It is often preferable to write 
the expression as a quoted expression:\\
{\tt QUOTE(expression)}\index{QUOTE}, to avoid having to rewrite it. 
For example, if you 
select {\tt Real vars} and then type:
$${\tt SUBST(QUOTE(CONJ(Z)),Z=1+i)}$$
you get:
$${\tt CONJ(1+i)}$$
whereas:
$${\tt SUBST(CONJ(Z),Z=1+i)}$$
produces:
$${\tt 1+i}$$
Of course, if you have selected {\tt Cmplx vars}, and {\tt Z} is not in the list 
that contains the variable {\tt REALASSUME}, then typing:
$${\tt SUBST(CONJ(Z),Z=1+i)}$$
gives:
$${\tt CONJ(1+i)}$$
\subsection{Equation of the line : {\tt DROITE}}\index{DROITE}
{\tt DROITE} takes two complex numbers $z_1,\ z_2$ as parameters.\\
 {\tt DROITE} returns the equation of the line through the Cartesian 
points, $z_1,\ z_2$.\\
Typing:
$${\tt DROITE((1,2),(0,1))}$$
or:
$${\tt DROITE(1+2 \cdot i,i)}$$
returns:
$${\tt Y=X-1+2}$$
Then, {\tt ENTER} produces:
$${\tt Y=X+1}$$
\section{Algebraic Expressions}
All functions in this section can be found in the {\tt ALGB} menu on the menu 
bar.
\subsection{Factors over the integers : {\tt COLLECT}}\index{COLLECT}
{\tt COLLECT} has an expression as a parameter.\\
{\tt COLLECT} combines like terms, and factors the expression over the 
integers.\\
Examples :\\
To factor over the integers:
$$x^2-4$$
type:
$${\tt COLLECT(X^2-4)}$$
which gives in real mode :
$${\tt (X+2) \cdot (X-2)} $$
To factor over the integers:
$$x^2-2$$
type:
$${\tt COLLECT(X^2-2)}$$
which gives:
$${\tt X^2-2} $$
\subsection{Distributivity : {\tt EXPAND}}\index{EXPAND}
{\tt EXPAND} has an expression as a parameter.\\
{\tt EXPAND} expands and simplifies this expression.\\
Typing:
$${\tt EXPAND((X^2+\sqrt2 \cdot X+1) \cdot (X^2-\sqrt2 \cdot X+1))}$$ 
gives:
$${\tt X^4+1}$$ 


\subsection{Factorization : {\tt FACTOR}}\index{FACTOR}
{\tt FACTOR} has an expression as a parameter.\\
{\tt FACTOR} factors this expression.\\
Example:\\
To factor :
$$x^4+1$$
Key in:\\
$${\tt FACTOR(X^4+1)}$$
{\tt FACTOR} can be found in the {\tt ALGB} menu.\\
In real mode, the result is:
$${\tt (X^2+\sqrt2 \cdot X+1) \cdot (X^2-\sqrt2 \cdot X+1)} $$
In complex mode (using {\tt CFG}), the result is:
$${\tt \frac{(2 \cdot X+(1+i) \cdot \sqrt 2) \cdot (2 \cdot X-(1+i) \cdot \sqrt 2) \cdot (2 \cdot X+(1-i) \cdot \sqrt 2) \cdot (2 \cdot X-(1-i) \cdot \sqrt 2)}{16}}$$
%Nouveau
\subsection{Change the order of variables : {\tt REORDER}}\index{REORDER}
{\tt REORDER} has two arguments: an expression and  
 the  names of variables separated with {\tt AND}.\\
{\tt REORDER} reorders the input expression following the order of
variables given by its second argument.\\
Typing:
$${\tt REORDER(X^2+2 \cdot X \cdot A+A^2+Z^2-X \cdot Z,A \ AND \ X \ AND \ Z)}$$
gives:
$${\tt A^2+2 \cdot X \cdot A+X^2-Z \cdot X+Z^2}$$

%Nouveau
\subsection{Partial simplifications : {\tt SEVAL}}\index{SEVAL}
{\tt SEVAL} has an expression as argument.\\
{\tt SEVAL} simplifies the expression, operating on all but
the top-level operator of the expression.\\
Typing :
$${\tt SEVAL(SIN(3 \cdot X-X)+SIN(X+X))}$$
gives :
$${\tt SIN(2 \cdot X)+SIN(2 \cdot X)}$$

\subsection{Substitute a value for a variable : {\tt |}}\index{$\mid$}
{\tt |} is an infix operator used to substitute a value for a variable in an 
expression (a bit like the following function {\tt SUBST}).\\
{\tt |} has two parameters: an expression dependent on a parameter, and an
 equality (parameter=substitute value).\\
{\tt |} substitutes the specified value for the variable in the expression.\\
Typing:
$${\tt  X^2-1\ |_{\displaystyle X=2}}$$
gives:
$${\tt 2^2-1}$$
\subsection{Substitute a value for a variable : {\tt SUBST}}\index{SUBST}
{\tt SUBST} has two parameters: an expression dependent on a parameter, and an
 equality (parameter=substitute value).\\
{\tt SUBST} substitutes the specified value for the variable in the 
expression.\\
Typing:
$${\tt SUBST(A^2+1,A=2)}$$ 
gives:
$${\tt 2^2+1}$$ 


\section{Polynomials}
All functions (except DEGREE) in this section can be found in the {\tt MATH} 
key's Polynom. menu.
%Nouveau
\subsection{Resolution of {\tt A[X]U[X]+B[X]V[X]=C[X]} : {\tt ABCUV}}\index{ABCUV}
This command applies the B\'ezout identity like {\tt EGCD} but, now,
the arguments are three polynomials,
{\tt A, B, C} ({\tt C} must be a multiple of {\tt GCD(A,B)}):\\
{\tt ABCUV(A[X],B[X],C[X])} returns {\tt U[X]  AND  V[X]},
where {\tt U,V} satisfy the following:
$${\tt {C[X]=U[X]*A[X]+V[X]*B[X]}}$$
Typing:
$${\tt ABCUV(X^2+2 \cdot X+1 ,X^2-1,X+1 )}$$
gives:
$${\tt \frac{1}{2}\ AND\ \frac{-1}{2}}$$
Typing:
$${\tt ABCUV(X^2+2 \cdot X+1 ,X^2-1,X^3+1 )}$$
gives:
$${\tt \frac{X^2-X+1}{2}\ AND\ -\frac{X^2-X+1}{2}}$$

%Nouveau
\subsection{Chinese remainders : {\tt CHINREM}}\index{CHINREM}
{\tt CHINREM} has two {\tt AND} as arguments : each {\tt AND} has
two polynomials as components.\\
{\tt CHINREM(A[X] AND R[X],B[X] AND Q[X])} returns an {\tt AND} with two 
polynomials as components {\tt P[X]} and {\tt S[X]}. This polyonimals 
{\tt P[X]} and {\tt S[X]} satisfying the following relations when 
{\tt GCD(R[X],Q[X])=1}:\\
${\tt S[X]=R[X] \cdot Q[X]}$,\\
${\tt P[X]=A[X] (mod R[X])}$ and ${\tt P[X]=B[X] (mod Q[X])}$. \\
There is always a solution {\tt P[X]}, if {\tt R[X]} and {\tt Q[X]} are 
mutually primes, and all solutions are congruent modulo 
${\tt S[X]=R[X] \cdot Q[X]}$.\\
Find the solutions $P[X]$ of:
$${\tt \left \{ 
\begin{array}{rl}
P[X]=&X\ (\bmod\ X^2+1)\\ P[X]=&X-1\ (\bmod\ X^2-1)
\end{array}\right.}$$
Typing:
$${\tt CHINREM(X \ AND\ X^2+1,X-1\ AND\ X^2-1)}$$
gives:
$${\tt -\frac{X^2-2 \cdot X+1}{2}\ AND\ -\frac{X^4-1}{2}}$$
that is, $P[X]=-\frac{X^2-2 \cdot X+1}{2} \ (\bmod-\frac{X^4-1}{2})$

%Nouveau
\subsection{Cyclotomic polynomial : {\tt CYCLOTOMIC}}\index{CYCLOTOMIC}
{\tt CYCLOTOMIC} has an integer $n$ as argument.\\
{\tt CYCLOTOMIC} returns the cyclotomic polynomial of order $n$.  This
is a polynomial having the $n$-th pritmitive roots of the unity
as zeros.\\
For example, when $n=4$ the fourth roots of the unity are:
$\{ 1,i,-1,-i\}$;\\ 
among them, the primitive roots are: $\{i,-i\}$.\\
Therefore, the cyclotomic polynomial of order $4$ is $(X-i).(X+i)=X^2+1$.\\
Another example, typing:
$${\tt CYCLOTOMIC(20)}$$
gives :
$${\tt X^8-X^6+X^4-X^2+1}$$

\subsection{degree of a polynomial : {\tt DEGREE}}\index{DEGREE}
{\tt DEGREE} has as an argument a polynomial in the current variable.\\
{\tt DEGREE} returns the degree of this polynomial.\\
{\sc Note}: The degree of a null polynomial is {\tt -1}. \\ 
The {\tt DEGREE} command must be entered using the {\tt ALPHA} keys.\\
Typing:
$${\tt DEGREE(X^2+X+1)}$$
returns:
$${\tt 2}$$ 
%Nouveau
\subsection{Quotient and remainder : {\tt DIV2}}\index{DIV2}
The arguments of {\tt DIV2} are two polynomials $A[X]$ and $ B[X]$.\\
{\tt DIV2} returns the quotient {\tt AND} the remainder of
the euclidean division between the two polynomials $A[X]$ and $ B[X]$.\\
Typing:
$${\tt DIV2(X^2+2\cdot X+1 ,X )}$$
gives:
$${\tt X+2\ AND\ 1}$$
The step-by-step mode can be of interest here, because it displays
the intermediate steps of the division process.\\


\subsection{Bézout's Identity : {\tt EGCD}}\index{EGCD}
This function returns Bézout's Identity, the {\tt EGCD} (Extended Greatest 
Common Divisor). In other words, {\tt EGCD(A(X), B(X))} returns 
{\tt U(X) AND V(X) = D(X)}, with {\tt D, U, V} such that:\\
$${\tt {D(X)=U(X)\cdot A(X)+V(X)\cdot B(X)}}$$ 
Typing:
$${\tt EGCD(X^2+2 \cdot X+1 ,X^2-1 )}$$
gives:
$${\tt 1 \ AND \ -1\ =\ 2 \cdot X+2}$$
Typing:
$${\tt EGCD(X^2+ 2 \cdot X+1 ,X^3+1)}$$
gives:
$${\tt -(X-2) \ AND \ 1\ =\ 3 \cdot X+3}$$


\subsection{Factorize a polynomial : {\tt FACTOR}}\index{FACTOR}
{\tt FACTOR} has a polynomial as an argument.\\
{\tt FACTOR} factors this polynomial.\\
Typing:
$${\tt FACTOR(X^2-2)}$$
gives:
$${\tt (X+ \sqrt2) \cdot (X- \sqrt2)}$$
Typing:
$${\tt FACTOR(X^2+2\cdot X+1)}$$
gives:
$${\tt (X+1)^2}$$
Typing:
$${\tt FACTOR(X^4-2 \cdot X^2+1)}$$
gives:
$${\tt (X-1)^2 \cdot (X+1) ^2}$$
Typing:
 $${\tt FACTOR(X^3-2 \cdot X^2+1)}$$
gives: 
$${\tt \frac{(X-1) \cdot (2 \cdot X-1+\sqrt5) \cdot (2 \cdot X-(1+\sqrt5))}{4}}$$
\subsection{GCD of two polynomials : {\tt GCD}}\index{GCD}
{\tt GCD} returns the GCD (Greatest Common Divisor) of two polynomials.\\
Typing: 
$${\tt GCD(X^2+2 \cdot X+1 ,X^2-1 )}$$
gives:
$${\tt X+1 }$$
\subsection{Hermite polynomial : {\tt HERMITE}}\index{HERMITE}
{\tt HERMITE} has as an argument a whole number $n$.\\
{\tt HERMITE} returns the Hermite polynomial of degree $n$. This is a 
polynomial of the following type:\\
$$H_n(x)=(-1)^n \cdot e^{\frac{x^2}{2}}\frac{d^n}{dx^n}e^{\frac{-x^2}{2}}$$
That means that  :\\
for $n \geq 0$
$$H_n^{''}(x)-xH_n^{'}(x)+nH_n(x)=0$$
and for $n \geq 1$
$$H_{n+1}(x)-xH_n(x)+nH_{n-1}(x)=0$$
$$H_n^{'}(x)=nH_{n-1}(x)$$ 
Typing:
$${\tt HERMITE(6)}$$
produces the result:
$${\tt 64 \cdot X^6-480 \cdot X^4+720 \cdot X^2-120}$$
%Nouveau
\subsection{To evaluate a polynomial : {\tt HORNER}}\index{HORNER}
{\tt HORNER}  has two arguments : a polynomial {\tt P[X]} and a number 
{\tt a}.\\
{\tt HORNER(P[X],a)}  returns the polynomial {\tt Q[X]} (quotient of {\tt P[X]}
divided by {\tt X-a}) {\tt AND} the value {\tt P[a]}.\\
Typing :
$${\tt HORNER(X^3+1,2)}$$
gives :
$${\tt X^2+2 \cdot X+4 \ AND\  9}$$
Typing :
$${\tt HORNER(X^4+2 \cdot X^3-3 \cdot X^2+X-2,1)}$$
gives :
$${\tt X^3+3 \cdot X^2+1 \ AND\  -1}$$

\subsection{LCM of two polynomials : {\tt LCM}}\index{LCM}
{\tt LCM} returns the LCM (Least Common Multiple) of two polynomials.\\
Typing:
$${\tt LCM(X^2+2 \cdot X+1 ,X^2-1 )}$$
gives:
$${\tt (X^2+2 \cdot X+1) \cdot (X-1)}$$
\subsection{Legendre polynomial : {\tt LEGENDRE}}\index{LEGENDRE}
{\tt LEGENDRE} has as an argument a whole number $n$.\\
{\tt  LEGENDRE} returns the polynomial $L_n$, a non-null solution of the 
differential equation:\\
$$(x^2-1) \cdot y''-2 \cdot x \cdot y'-n(n+1) \cdot y=0$$ 
For $n \geq 0$, we have the Rodriguès Formula:
$$L_n(x)=\frac{1}{n!2^n}\frac{d^n}{dx^n}(x^2-1)^n $$
and for $n \geq 1$, we have:
$$(n+1)L_{n+1}(x)=(2n+1)xL_n(x)-nL_{n-1}(x)$$
Typing:
$${\tt LEGENDRE(4)}$$
gives:
$${\tt \frac{35 \cdot X^4-30 \cdot X^2+3}{8}}$$


\subsection{Partial fraction expansion : {\tt PARTFRAC}}\index{PARTFRAC}
{\tt PARTFRAC} has as an argument a rational fraction.\\
{\tt PARTFRAC} returns the partial fraction decomposition of this rational 
fraction.\\
Example :\\
To perform a partial fraction decomposition of a rational function, for example:
$$\frac{x^5-2 \times x^3+1}{x^4-2\times x^3+2\times x^2-2\times x+1}$$
you use the {\tt PARTFRAC} command. \\
Type:
$${\tt PARTFRAC(\frac{X^5-2*X^3+1}{X^4-2*X^3+2*X^2-2*X+1})}$$
In real and direct mode, this produces:
$${\tt X+2+\frac{X-3}{2 \cdot X^2+2}+\frac{-1}{2 \cdot X-2}}$$
In complex mode, this produces:
$${\tt X+2+\frac{\frac{1-3 \cdot i}{4}}{X+i}+\frac{\frac{-1}{2}}{X-1}+\frac{\frac{1+3 \cdot i}{4}}{X-i} }$$
\subsection{Whole-number and fractional part : {\tt PROPFRAC}}\index{PROPFRAC}
{\tt PROPFRAC} has as an argument a rational fraction.\\
{\tt PROPFRAC} rewrites this rational fraction so as to bring out its 
whole-number part.\\
{\tt PROPFRAC(A(X)/ B(X))} writes the rational fraction 
$\frac{A[X]}{B[X]}$ in the form:
$$Q[X]+\frac{R[X]}{B[X]}$$
where $R[X] = 0$, or $0\leq deg(R[X])< deg(B[X])$.\\
Typing:
$${\tt  PROPFRAC(\frac{(5 \cdot X+3) \cdot (X-1)}{X+2})}$$
gives:
$${\tt 5 \cdot X-12+\frac{21}{X+2}}$$
\subsection{Rewrite in order of the powers of ($X-a$) : {\tt PTAYL}}\index{PTAYL}
{\tt PTAYL} takes two parameters: a polynomial $P[X]$ and a number a.\\
{\tt PTAYL} rewrites the polynomial $P[X]$ in order of its powers of $X-a$.\\
Typing:
$${\tt PTAYL(X^2+2\cdot X +1 , 2)}$$
produces the polynomial Q[X]:
$${\tt X^2+6\cdot X +9 }$$
{\sc Note that}:
$${\tt P(X)=Q(X-2)}$$
\subsection{Euclidean quotient: {\tt QUOT}}\index{QUOT}
The arguments of {\tt QUOT} are two polynomials $A[X]$ and $ B[X]$.\\
{\tt QUOT} returns the quotient of the two polynomials $A[X]$ and $ B[X]$
divided in decreasing order by exponent.\\
Typing:
$${\tt QUOT(X^2+2\cdot X +1 ,X )}$$
gives:
$${\tt X+2}$$
\subsection{Euclidean remainder : {\tt REMAINDER}}\index{REMAINDER}
The arguments of {\tt REMAINDER} are two polynomials $A[X]$ and $ B[X]$.\\
{\tt REMAINDER} returns the remainder from the division of the two polynomials
$A[X]$ and $ B[X]$ divided in decreasing order by exponent.\\
Typing:
$${\tt REMAINDER(X^3-1 ,X^2-1 )}$$
gives:
$${\tt X-1}$$

%Nouveau
\subsection{Number of zeros in $[a,b[$ : {\tt STURMAB}}\index{STURMAB}
{\tt STURMAB} has three arguments: a polynomial $P(X)$ and two numbers
$a$ and $b$.\\
{\tt STURMAB} returns the number of zeros of $P$ in $[a,b[$.\\
For example, typing:
$${\tt STURMAB(X^2 \cdot (X^3+2),-2,0)}$$
gives:
$${\tt 1}$$
Typing :
$${\tt STURMAB(X^2 \cdot(X^3+2),-2,1)}$$
gives:
$${\tt 3}$$

\subsection{First and 2nd-species Tchebycheff polynomials : {\tt TCHEBYCHEFF}}\index{TCHEBYCHEFF}
{\tt TCHEBYCHEFF} has as an argument an integer $n$.\\
If $n > 0$, {\tt TCHEBYCHEFF} returns the polynomial $T_n$ such that:
$$T_n[x]= \cos(n \cdot \arccos(x))$$
For $n \geq 0$, 
we have:
$$T_n(x)=\sum_{k=0}^{[n/2]}C_n^{2k}(x^2-1)^kx^{n-2k}$$
For $n \geq 0$ we also have:
$$(1-x^2)T_n^{''}(x)-xT_n^{'}(x)+n^2T_n(x)=0$$
For $n \geq 1$, we have:
$$T_{n+1}(x)=2xT_n(x)-T_{n-1}(x)$$
If n < 0, {\tt TCHEBYCHEFF} returns the 2nd-species Tchebycheff polynomial:
$$T_n[x]=\frac{\sin(n \cdot \arccos(x))}{\sin(\arccos(x))}$$
Typing:
$${\tt TCHEBYCHEFF(4)}$$
gives:
$${\tt 8 \cdot X^4-8 \cdot X^2+1}$$
In effect:\\
$\cos( 4 \cdot x)=Re((\cos(x)+i \cdot \sin(x))^4)$\\
$\cos( 4 \cdot x)=\cos(x)^4-6 \cdot \cos(x)^2 \cdot (1-\cos(x)^2)+((1-\cos(x)^2)^2$\\
$\cos(4 \cdot x)=T_4(\cos(x))$
Typing:
$${\tt TCHEBYCHEFF(-4)}$$
gives:
$${\tt 8 \cdot X^3-4 \cdot X}$$
In effect:\\
$\sin(4 \cdot x)=\sin(x) \cdot (8 \cdot \cos(x)^3-4 \cdot \cos(x))$.

\section{Functions}
All the functions in this section can be found in the {\tt DIFF} menu on the 
menu bar, except {\tt DEF}, which is in the {\tt ALGB} menu, and 
{\tt IFTE}, which is in the {\tt MATH} key's Tests menu.

\subsection{Define a function : {\tt DEF}}\index{DEF}
{\tt DEF} has as argument an equality between (1) the name of a function 
(with parentheses containing the variable), and (2) an expression defining the 
function.\\
{\tt DEF} defines this function and returns the equality.\\
Typing:
$${\tt DEF(U(N)=2^N+1)}$$
produces the result:
$${\tt U(N)=2^N+1}$$
Typing:
$${\tt U(3)}$$
then returns:
$${\tt  9}$$

\subsubsection{Another {\tt DEF} example}\index{DEF}
Calculate the first six Fermat numbers $F_1..F_6$
and say whether they're prime.\\
So, you want to calculate $F(k)=2^{2^k}+1$ for $k = 1..6$.\\
Typing the formula :
$$2^{2^2}+1$$
gives a result of 17. 
You can then invoke the {\tt ISPRIME?()} \index{ISPRIME?}
command, which is found in the {\tt MATH} key's {\tt Integer} menu.\\
The response is {\tt 1.}, which means {\tt TRUE}. Using the history (which you 
access by pressing the {\tt SYMB} key), you put the expression 
$2^{2^2}+1$ into the Equation Editor with {\tt ECHO}, and change it to:
$$2^{2^3}+1$$
Or better, define a function F(K) by selecting {\tt DEF} from the {\tt ALGB} 
menu (on the menu bar), and typing:
$${\tt DEF(F(K)=2^{2^K}+1)}$$
The response is ${\tt 2^{2^K}+1}$, and {\tt F} is now listed amongst 
the variables (which you can verify using the VARS key.)\\
For $K = 5$, you then type:
$${\tt F(5)}$$
which gives:
$${\tt 4294967297}$$
You can factor $F(5)$ with {\tt FACTOR}, which you'll find in the {\tt ALGB} 
menu on the menu bar.\\
Typing:
$${\tt FACTOR(F(5))}$$
gives
$$641 \cdot 6700417$$
Typing:
$${\tt F(6)}$$
 gives:
$$18446744073709551617$$
Using {\tt FACTOR} to factor it then yields:
$$274177\cdot67280421310721$$
{\sc Note}: Pay careful attention to the position of the dot in :
$$2\ .\ 5 \verb|the approximate representation of| \frac{5}{2}$$
versus $$2\cdot5=10$$

\subsubsection{Define a function with conditions : {\tt IFTE}}\index{IFTE}
{\tt IFTE} has three arguments: a Boolean (note the use of {\tt = =} to test 
for equality), and two expressions $expr1,\ expr2$.\\
{\tt IFTE} evaluates the condition, then returns $expr1$ if the condition is 
true, or $expr2$ if the condition is false.\\
Typing:
$${\tt STORE(2,N)}$$
$${\tt  IFTE(N==0,1,\frac{N+1}{N})}$$
produces the result:
$$ {\tt \frac{3}{2}}$$
It is easy to define functions using {\tt IFTE}. For example:\\
$${\tt  DEF(F(X)=IFTE(X==0,1,\frac{SIN(X)}{X}))}$$
defines the function $f$ such that:\\
$$f(x)=\left\{
\begin{array}{rl}
1 &\mbox{si } x=0\\
\displaystyle \frac{\sin(x)}{x}&\mbox{si } x \neq 0
\end{array}\right.$$


\subsection{Derivative and partial derivative : {\tt DERIV}}\index{DERIV}
{\tt DERIV} has two arguments: an expression (or a function) and a variable.\\
{\tt DERIV} returns the derivative of the expression (or the function) with 
respect to the variable given as the second parameter (used for calculating 
partial derivatives).\\
Example:\\
Calculate:
$$\frac {\partial (x \cdot y^2 \cdot z^3+x \cdot y)}{\partial z}$$
Typing:
$${\tt  DERIV(X \cdot Y^2 \cdot Z^3+X \cdot Y\ ,\ Z)}$$
gives:
$${\tt 3 \cdot X \cdot Y^2 \cdot Z^2}$$

\subsection{Derivative : {\tt  DERVX}}\index{DERVX}
{\tt DERVX} has one argument: an expression.\\
{\tt DERVX} calculates the derivative of the expression  with 
respect to the variable stored in {\tt VX}.\\
For example, given:
$$f(x)=\frac {x}{x^2-1}+\ln(\frac {x+1}{x-1})$$
Calculate the derivative of  $f$.\\
Type:
$${\tt DERVX(\frac {X}{X^2-1}+LN(\frac {X+1}{X-1}))} $$
or, if you have stored the definition of $f(x)$ in {\tt F} that is, if you have
 typed:
$${\tt STORE(\frac {X}{X^2-1}+LN(\frac {X+1}{X-1}),F)}$$
then type:\\
$${\tt DERVX(F) }$$
or, if you have defined $F(X)$ using {\tt DEF} that is, if you have typed:
$${\tt DEF(F(X)=\frac {X}{X^2-1}+LN(\frac {X+1}{X-1}))}$$
then type:
$${\tt DERVX(F(X)) }$$ 
The result is a complicated expression. Pressing {\tt ENTER} simplifies it, 
giving:
$${\tt -\frac {3 \cdot X^2-1}{X^4-2 \cdot X^2+1}} $$ 
\subsection{Fourier coefficients : {\tt FOURIER}}\index{FOURIER}\label{sec:fourier}
{\tt FOURIER} has two parameters: an expression $f(x)$ and a whole number 
$N$.\\
{\tt FOURIER} returns the Fourier coefficient $c_N$ of $f(x)$, considered to be
 a function defined over interval $[0,T]$ and with period $T$ ($T$ being equal
 to the contents of the variable {\tt PERIOD}).\\
If $f(x)$ is a discrete series, then:
$$f(x)=\sum_{N=-\infty}^{+\infty} c_N e^\frac{2iNx\pi}{T}$$                    

Example: \\
Determine the Fourier coefficients of a periodic function $f$ with period  
$2\cdot \pi$ and defined over interval $[0\ 2 \cdot \pi[$ by  $f(x) = x^2$.\\
Typing:
$${\tt STORE(2 \cdot \pi\ , \ PERIOD)}$$
$${\tt FOURIER(X^2,N)}$$
The calculator do not know that {\tt N} is a whole number, so you have
to  replace ${\tt EXP(2*i*N*\pi)}$ with 1 and
then  simplify the expression. We get:
$${\tt \frac{2 \cdot i \cdot N \cdot \pi+2}{N^2}}$$

\noindent So if $N \neq 0$, then:
$$c_N=\frac{2 \cdot i \cdot N \cdot \pi+2}{N^2}$$
Typing:
$${\tt FOURIER(X^2,0)}$$
gives:
$${\tt \frac{4 \cdot {\pi}^2}{3} }$$
so if $N = 0$, then:
$$c_0=\frac{4 \cdot {\pi}^2}{3}$$ 
\subsection{Partial integration : {\tt IBP}}\index{IBP}
{\tt IBP} has two parameters: an expression of the form $u(x) \cdot v'(x)$ and 
$v(x)$.\\
{\tt IBP} returns the {\tt AND} of $u(x) \cdot v(x)$ and of $-v(x) \cdot u'(x)$ that is, 
the terms that one must calculate when one performs a partial integration.\\
It remains then to calculate the integral of the second term of the {\tt AND},
 then add it to the first term of the {\tt AND} to obtain a primitive of 
$u(x) \cdot v'(x)$.\\
Typing:
$${\tt IBP(LN(X),X) }$$
gives:
$${\tt X \cdot LN(X)\ AND  \ -1}$$
One completes the integration by calling {\tt INTVX}:
$${\tt  INTVX(X \cdot LN(X) AND -1)}$$
which produces the result:
$${\tt X\cdot LN(X)-X}$$
{\sc Remark}: If the first {\tt IBP} (or {\tt INTVX}) parameter is an {\tt AND}
of two elements, {\tt IBP} concerns itself only with the second element of the
{\tt AND}, adding the integrated term to the first element of the {\tt AND} 
(so that you can perform multiple {\tt IBP} in succession).
\subsection{Integrals : ${\tt \int}$}\index{$\int$}
To calculate an integral, you can use the symbol $\int$ which is found
on the keyboard and it can be produced by typing : {\tt SHIFT d/dX}.\\
You have just to enter the arguments (you can move the cursor with the arrow 
keys $\rhd$ and $\lhd$). For more details cf. \ref{sec:sum}.\\
You can put $+\infty$ or $-\infty$ as limit of the integral.\\
{\sc Example}\\
For the following expression, determine the limit when a approaches +(:
$$  \int _2^a (\frac {x}{x^2-1}+\ln(\frac {x+1}{x-1}))\ dx$$
In the Equation Editor, type:\\
$${\tt \int _2^{+\infty} (\frac {X}{X^2-1}+LN(\frac {X+1}{X-1}))\ dX} $$
{\sc Note}:  To obtain the symbol ${\tt {+\infty}}$, type:
$${\tt  {(-) \ (-) \ \infty}\ (SHIFT\ 0)\ }$$
This produces:
$${\tt +\infty-\frac{7 \cdot LN(3)}{2} }$$
and, after simplification:
$$+\infty$$
%Nouveau
\subsection{Primitive and definied integral : {\tt INTVX}}\index{INTVX}
{\tt INTVX} has one argument : une expression.\\
{\tt INTVX} calculates a primitive of its argument with respect to the variable
 stored in {\tt VX}.\\
Exercise 1\\
Calculate a primitive of $\sin(x) \times \cos(x)$.\\
Typing:
$${\tt INTVX(SIN(X) \cdot COS(X))}$$
gives, in Step by step mode:
$${\tt COS(X) \cdot  SIN(X)}$$
$${\tt Int[u'*F(u)]\ with\ u=SIN(X)}$$
Pressing {\tt OK} then sends the result to the Equation Editor:
$${\tt \frac{SIN(X)^2}{2}}$$
Exercise 2\\
Given:
 $$f(x)=\frac {x}{x^2-1}+\ln(\frac {x+1}{x-1})$$
Calculate a primitive of $f$.\\
Type:
$${\tt INTVX(\frac {X}{X^2-1}+LN(\frac {X+1}{X-1}))} $$
Or, if you have stored the definition of  $f (x)$ in {\tt F}, that is, 
if you have already typed:
$${\tt DEF(F(X)=\frac {X}{X^2-1}+LN(\frac {X+1}{X-1}))}$$
then type:
$${\tt INTVX(F)} $$
Or, if you have used {\tt DEF} to define {\tt F(X)}, that is, 
if you have already typed:
$${\tt DEF(F(X)=\frac {X}{X^2-1}+LN(\frac {X+1}{X-1}))}$$
then type:
$${\tt INTVX(F(X)) }$$ 
The result in all cases is equivalent to:
$$ {\tt X \cdot LN(\frac {X+1}{X-1})+ \frac{3}{2} \cdot LN(|X-1|)+\frac{3}{2} \cdot LN(|X+1|)} $$
We obtain absolute values only in {\tt Rigourous} mode.\\
Exercise 3\\
Calculate:
$$\int \frac {2}{x^6+2 \cdot x^4+x^2} \ dx $$
Typing:
$${\tt INTVX(\frac {2}{X^6+2 \cdot X^4+X^2})}$$
gives a primitive:
$${\tt -3 \cdot ATAN(X)-\frac {2}{X}-\frac {X}{X^2+1}} $$
{\sc Remark}:\\
You can also type:
$${\tt \int_1^X \frac {2}{X^6+2 \cdot X^4+X^2} \ dX} $$
which gives the primitive which is zero for $X=1$:
$${\tt -3\cdot ATAN(X)-\frac {2}{X}-\frac {X}{X^2+1}+\frac{3\cdot \pi+10}{4}}$$
Exercise 4\\
Calculate:\\
$$\int \frac {1}{\sin(x)+\sin(2 \cdot x )} \ dx $$
Typing:
$${\tt INTVX(\frac {1}{SIN(X)+SIN(2 \cdot X )})}$$
gives the result:
$${\tt \frac {1}{6}\cdot LN(|COS(X)-1|)+\frac {1}{2}\cdot LN(|COS(X)+1|)+}$$
$${\tt \frac {-2}{3} \cdot LN(|2\cdot COS(X)+1|)} $$ 
{\sc Remark}: If the argument to {\tt INTVX} is the {\tt AND} of two elements,
{\tt  INTVX} concerns itself only with the second element of the {\tt AND}, and
adds the result to the first argument.

\subsection{To calculate limits : {\tt LIMIT} or {\tt lim}}\index{LIMIT}\index{lim}\label{sec:limit}
{\tt LIMIT} or {\tt lim} has two arguments:  an expression dependent on a variable, and an 
equality (a variable = the value to which you want to calculate the limit).\\
You can omit the name of the variable and the sign {\tt =}, when this name
 is in {\tt VX}).\\ 
It is often preferable to use a quoted expression:\\
{\tt QUOTE(expression)}\index{QUOTE}, to avoid rewriting the expression in 
normal form (i.e., not to have a rational simplification of the arguments) 
during the execution of the {\tt LIMIT} command.\\
Typing, for example:
$${\tt LIMIT(QUOTE((2X-1) \cdot EXP(\frac{1}{X-1})),X=+\infty)}$$
gives:
$$+\infty$$
 To find a right limit you type, for example:
$${\tt LIMIT(\frac{1}{X-1},QUOTE(1+0))}$$
gives (if {\tt X} is the current variable) :
$$+\infty$$
To find a leftt limit you type, for example:
$${\tt LIMIT(\frac{1}{X-1},QUOTE(1-0))}$$
gives (if {\tt X} is the current variable) :
$$-\infty$$
Ii is not  necessary to quote the second argument, when it is written with 
{\tt =} for example :\\
$${\tt LIMIT(\frac{1}{X-1},X=1+0)}$$
gives :
$$+\infty$$
{\sc Exercises}\\
For $n > 2$ in the following expression, find the limit as $x$ approaches 0:
$$ \frac{n\cdot \tan(x)-\tan(n\cdot x)}{\sin(n\cdot x)-n\cdot \sin(x)}$$
You can use the {\tt  LIMIT} command to do this.\\
Typing:
$${\tt LIMIT \left( \frac{N \cdot TAN(X)-TAN(N \cdot X)}{SIN(N \cdot X)-N \cdot SIN(X)}, 0 \right)}$$
gives:
$${\tt 2 }$$
{\sc Note}
To find the limit as $x$ approaches $a^+$
(resp $a^-$), the second argument is written :\\
${\tt X=A+0}$ (resp ${\tt X=A-0}$), see also \ref{sec:limit}.\\

For the following expression, find the limit as $x$ approaches $+\infty$ :
$$\sqrt{x+\sqrt{x+\sqrt x}}-\sqrt x$$
Typing:
$${\tt LIMIT (\sqrt{X+\sqrt{X+\sqrt{X}}}-\sqrt{X}, +\infty)} $$
produces (after a short wait):
$$\frac{1}{2}$$
{\sc Note}: \\
The symbol $\infty$ is obtained by typing {\tt SHIFT 0}.\\
To obtain ${\tt {-\infty}}$ type:
$${\tt  (-)\ \infty}$$
To obtain ${\tt {+\infty}}$ type:\\
$${\tt (-) \ (-)\ \infty}$$
You can also find the symbol ${\tt \infty}$ in the {\tt MATH} key's 
{\tt Constant} menu.
\subsection{Plot of an expression : {\tt PLOT}}\index{PLOT}
{\tt PLOT} has an expression as argument.\\ 
{\tt PLOT} asks you to select an {\tt Aplet} and then stores this 
expression in an {\tt Aplet} variable.\\
For example, type:
$${\tt PLOT(X^2+X)}$$
You  select the {\tt Aplet} {\tt Function}, and you choose to save the 
expression ${\tt X^2+X}$ in {\tt F2}. In the history the answer is : 
$${\tt X^2+X}$$
To obtain  the plot of the expression stored in  {\tt F2}, you have to quit the
{\tt CAS} (press {\tt HOME}) and then open the {\tt Aplet} {\tt Function}, 
 select the function {\tt F2}, then press on {\tt PLOT} 

%Nouveau
\subsection{Add the plot of an expression :{\tt PLOTADD}}\index{PLOTADD}
{\tt PLOTADD} has an expression as argument.\\ 
{\tt PLOTADD}  asks you to select an {\tt Aplet} and then stores this 
expression in an {\tt Aplet}-variable.\\a
Typing:
$${\tt PLOTADD(X^2-X)}$$
You  select the {\tt Aplet} {\tt Function}, and you choose to save the 
expression ${\tt X^2-X}$ in {\tt F3}. In the history the answer is : 
$${\tt X^2-X}$$
To obtain  the plot of the expressions stored in {\tt F2} and  {\tt F3}, 
you have to quit the
{\tt CAS} (press {\tt HOME}), to open the {\tt Aplet} {\tt Function}, then
 select the functions {\tt F2} and {\tt F3}, and press on {\tt PLOT}. 

\subsection{Evaluate a primitive : {\tt PREVAL}}\index{PREVAL}
{\tt PREVAL} has three parameters: an expression {\tt F(VX)} dependent on the 
variable contained in {\tt VX}, and two expressions {\tt A} and {\tt B}.\\
For example if {\tt VX} contains {\tt X}, and if {\tt F} is a function,
{\tt PREVAL (F(X),A,B)} returns {\tt F(B)-F(A)}.\\
{\tt PREVAL} is used for calculating an integral defined from a primitive: 
it evaluates this primitive between the two limits of the integral.\\
Typing:
$${\tt PREVAL(X^2+X,2,3)} $$
gives:
$${\tt 6}$$
\subsection{Primitive and definied intégral : {\tt RISCH}}\index{RISCH}
{\tt RISCH} has two parameters: an expression and the name of a variable.\\
{\tt RISCH} returns a primitive of the first parameter with respect to the
 variable specified in the second parameter.\\
Typing:
$${\tt RISCH((2 \cdot X^2+1) \cdot EXP(X^2+1),X) }$$
gives:
$${\tt X \cdot EXP(X^2+1)}$$
{\sc Remark}: If the {\tt RISCH} parameter is the {\tt AND} of two elements, 
{\tt RISCH} concerns itself only with the second element of the {\tt AND}, and
adds the result to the first argument..

%Nouveau
\subsection{Discrete antiderivative : {\tt SIGMA}}\index{SIGMA}
{\tt SIGMA} has two arguments: the first argument is a function $f(x)$ of a
variable $x$ given as the second argument.
{\tt SIGMA} returns the discrete antiderivative of the input function,
that is, the function $G$ that satisfies the relation: $G(x+1)-G(x)=f(x)$.\\ 
For example, typing :
$${\tt SIGMA(X \cdot X!,X)}$$
gives :
$${\tt X!}$$
because $(X+1)!-X!=X\cdot X!$
%Nouveau
\subsection{Discrete antiderivative : {\tt SIGMAVX}}\index{SIGMAVX}
{\tt SIGMAVX} has as argument a function $f$ of the current
variable {\tt VX}.\\
{\tt SIGMAVX} returns the discrete antiderivative of the input function,
that is a function $G$ that satisfies the relation: $G(x+1)-G(x)=f(x)$.\\ 
For example, type:
$${\tt SIGMAVX(X^2)}$$
You obtain:
$${\tt \frac{2\cdot X^3-3\cdot X^2+X}{6}}$$
because  $2(X+1)^3-3(X+1)^2+X+1-2X^3+3X^2-X=6X^2$

\subsection{Variation table : {\tt TABVAR}}\index{TABVAR}
{\tt TABVAR} has as a parameter an expression with a rational derivative.\\
{\tt TABVAR} returns the variation table for the expression in terms of the 
current variable.\\
Typing:
$${\tt TABVAR(LN(X)+X)} $$
In Step by step mode, this gives:\\
${\tt F=:(LN(X)+X)}$\\
${\tt F'=:(\frac{1}{X}+1}$\\
${\tt \rightarrow :\frac{X+1}{X}} $\\
{\tt Variation table}:
$$\left[\begin{array}{cccccc}
-\infty & ?  & 0 & + & +\infty & X\\
? & ?  & -\infty & \uparrow & +\infty & F \end{array}\right]$$

\section{Taylor and asymptotic Expansions}
All functions in this section can be found in the {\tt DIFF} menu on the menu 
bar.\\
It is customary to write the expansions in ascending order by exponent of the 
variable; you set this up by choosing ${\tt 1+x+x^2...}$ in {\tt CFG}.
\subsection{Division in increasing order by exponent : {\tt DIVPC}}\index{DIVPC}
{\tt DIVPC} has three arguments: two polynomials {\tt A(X)} and  {\tt B(X)}
(where {\tt B(0)}$\neq 0$), and a whole number {\tt n}.\\
{\tt DIVPC} returns the quotient {\tt Q(X)} of the division of {\tt A(X)} by 
{\tt B(X)}, in increasing order by exponent, and with deg{\tt (Q)$\leq $ n}
 or {\tt Q = 0}.\\
{\tt Q[X]}( is then the limited $n$th-order expansion of 
${\tt \frac{A[X]}{B[X]}}$ in the vicinity of {\tt X = 0}.\\
Typing:
$${\tt DIVPC(1+X^2+X^3,1+X^2,5)}$$
gives:
$${\tt 1+X^3-X^5}$$
{\sc Note}: When the calculator asks to go into "increasing powers" mode, 
respond {\tt yes}.

\subsection{Limited $n$th-order expansion : {\tt SERIES}}\index{SERIES} 
{\tt SERIES} has three arguments : an expression dependent on a variable,
an equality (the variable $x$ = the value $a$ to which you want to calculate 
the expansion) and a whole number (the order $n$ of the limited expansion).\\
You can omit the name of the variable and the sign {\tt =}, when this name
 is in {\tt VX})\\ 
{\tt SERIES} returns the limited $n$th-order expansion of the expression in the
 vicinity of $x=a$.
\begin{itemize}
\item  Expansion in the vicinity of {\tt x = a}\\
Example:\\
Give a limited 4th-order expansion of $\cos(2\times x)^2$ in the vicinity of 
$x=\frac{\pi}{6}$.\\
For this you use the {\tt SERIES} command.\\
Typing:
$${\tt SERIES( COS(2 \cdot X)^2 , X=\frac{\pi}{6} , 4 )}$$
gives:
$${\tt \ (\frac{1}{4}-\sqrt 3 h+2h^2+\frac {8 \sqrt {3}}{3}h^3- \frac {8}{3}h^4 +O(\frac{h^5}{4})|_{\ \displaystyle h=X- \frac{ \pi}{6}}}$$
\item  Expansion in the vicinity of {\tt x=+$\infty$} or {\tt x=-$\infty$}\\
Example 1:\\
Give a 5th-order expansion of $\arctan(x)$ in the vicinity of 
{\tt x=+$\infty$}, taking as infinitely small $h=\frac{1}{x}$.\\
Typing:
$${\tt SERIES(ATAN(X),X=+\infty,5)}$$
gives:
$${\tt (\frac{\pi}{2}-h+\frac{h^3}{3}-\frac{h^5}{5}+O(\frac{\pi \cdot h^6}{2})|_{\ \displaystyle h=\frac{1}{X}}}$$
Example 2:\\
Give a 2nd-order expansion of $(2x-1)e^\frac{1}{x-1}$ in the vicinity of 
 {\tt x=+$\infty$}, taking as infinitely small $h=\frac{1}{x}$.\\
Typing:
$${\tt SERIES((2X-1) \cdot EXP(\frac{1}{X-1}),X=+\infty,3)}$$
gives:
$${\tt (\frac{12+6h+12h^2+17h^3}{6 \cdot h}+O(2 \cdot h^3)|_{\ \displaystyle h=\frac{1}{X}}}$$
Example 3:\\
Give a 2nd-order expansion of $(2x-1)e^\frac{1}{x-1})$ in the vicinity of 
{\tt x=-$\infty$}, taking as infinitely small $h=-\frac{1}{x}$.\\
Typing: 
$${\tt SERIES((2X-1) \cdot EXP(\frac{1}{X-1}),X=-\infty,3)}$$
gives:
$${\tt (\frac{-12+6h-12h^2+17h^3}{6h}+O(-(2h^3))|_{\displaystyle h=-\frac{1}{X}}}$$
\item  Unidirectional expansion\\
You must be in {\tt Rigourous} mode (Press {\tt DIFF}, then {\tt CFG}, then 
choose {\tt Rigourous} and then {\tt Quit config.}).\\
To perform an expansion in the vicinity of $x=a$ where $ \ x>a$, use a positive
 real (such as 4. or 4.0) for the order; to perform an expansion in the vicinity of 
$x=a$ where $ \ x<a$, use a negative real (such as -4.0 or -4.) for the order\\
Example 1:\\
Give a 3nd-order expansion of $\ \frac{(1+X)^\frac{1}{X}}{X^3}\ $in the vicinity of $X = 0^+$.\\
Typing:
$${\tt SERIES(\sqrt{X^2+X^3} ,X=0,3.0)}$$
gives:
$${\tt \frac{1}{16}\cdot h^4+\frac{-1}{8}\cdot h^3+\frac{1}{2}\cdot h^2+ h+O(h^5)|_{\displaystyle h=X}}$$
Example 2:\\
Give a 3nd-order expansion of $\ \frac{(1+X)^\frac{1}{X}}{X^3}\ $in the vicinity of $X=0^-$.\\
Typing:
$${\tt SERIES(\sqrt{X^2+X^3} ,X=0,-3.0)}$$
gives:
$${\tt (\frac{-1}{16}\cdot h^4+\frac{-1}{8}\cdot h^3+\frac{-1}{2}\cdot h^2+ h+O(h^5)|_{\displaystyle h=-X}}$$
Example 3:\\
Give a 3nd-order expansion of $\ \frac{(1+X)^\frac{1}{X}}{X^3}\ $
 in the vicinity of $X = 0$.\\
Typing:
$${\tt SERIES(\sqrt{X^2+X^3} ,X=0,3)}$$
gives:
$${\tt SERIIES Error : Unable to find sign}$$
{\bf Note} :\\
If you are in {\tt Sloppy} mode the three previous examples
give the same answer than in the vicinity of $X=0+$
\end{itemize}
\subsection{Limited expansion in the vicinity of 0 : {\tt  TAYLOR0}}\index{TAYLOR0} 
{\tt  TAYLOR0} has a single argument: the function of $x$ to expand. It returns
 the function's limited 4th-relative-order expansion in the vicinity of $x=0$
 (if $x$ is the current variable).\\
Typing:
$${\tt TAYLOR0(\frac{TAN(P \cdot X)-SIN(P \cdot X)}{TAN(Q \cdot X)-SIN(Q \cdot X)}) }$$
gives:
$${\tt \frac{P^3}{Q^3}+\frac{P^5-Q^2 \cdot P^3}{4 \cdot Q^3} \cdot X^2}$$
{\sc Note}: "th-order" means that the numerator and the denominator are 
expanded to the 4th relative order (here, the 5th absolute order for the 
numerator, and for the denominator, which is given in the end, the 2nd order 
(5- 3), seeing that the exponent of the denominator is 3).
\subsection{Truncate at order $n-1$ : {\tt TRUNC}}\index{TRUNC}
{\tt TRUNC} enables you to truncate a polynomial at a given order (used to 
perform limited expansions).\\
{\tt TRUNC} has two arguments: a polynomial and $X^n$. \\
{\tt TRUNC} returns the polynomial truncated at order $n-1$; that is, the 
returned polynomial has no terms with exponents $\geq n$.\\
Typing:
$${\tt TRUNC({(1+X+\frac{1}{2} \cdot X^2)}^3\ ,\ X^4)}$$
gives:
$${\tt 1+3 \cdot X+\frac{9}{2} \cdot X^2+4 \cdot X^3}$$
\section{Conversion Functions}
All functions in this section can be found in the {\tt REWRITE} menu on the 
menu bar.
\subsection{Distributivity of multiplication : {\tt DISTRIB}}\index{DISTRIB}
{\tt DISTRIB} enables you to apply the distributivity of multiplication in respect to addition in a single instance.\\
{\tt DISTRIB} enables you, when you apply it several times, to carry out the distributivity step by step.\\
Typing:
$${\tt DISTRIB((X+1)\cdot(X+2)\cdot(X+3))}$$
gives:
$${\tt X\cdot(X+2)\cdot(X+3)+1\cdot(X+2)\cdot(X+3) }$$
\subsection{Disregard small values : {\tt EPSX0}}\index{EPSX0}\label{sec:epsx0}
{\tt EPSX0} has as a parameter an expression in {\tt X}, and returns the same 
expression with the values less than {\tt EPS} replaced by zeroes.\\
Typing:
$${\tt EPSX0(0.001+X)}$$
gives, if {\tt EPS=0.01}:
$${\tt 0+X}$$
or, if {\tt EPS=0.0001}:
$${\tt .001+X}$$
\subsection{Transform exp(n*ln(x)) as a power of x : {\tt EXP2POW}}\index{EXP2POW}
{\tt EXP2POW} transforms an expression of the form  $\exp(n \times \ln(x))$,
 rewriting it as a power of $x$.\\
Typing:
$${\tt  EXP2POW(EXP(N\cdot LN(X))) }$$
gives:
$${\tt X^N}$$
Take careful note of the difference between this function and {\tt LNCOLLECT}, 
as shown in the following examples:\\    
${\tt  LNCOLLECT(EXP(N\cdot LN(X))) = EXP(N\cdot LN(X)) }$\\
${\tt  LNCOLLECT(EXP(LN(X)/3))\ =\ EXP(LN(X)/3) }$\\
${\tt  EXP2POW(EXP(LN(X)/3))\ = \sqrt[3]{X}}$
\subsection{Transform a trigonometric expression into complex exponentials : {\tt EXPLN}}\index{EXPLN}
{\tt EXPLN} takes as an argument a trigonometric expression.\\
{\tt EXPLN} transforms the trigonometric function into exponentials and logarithms without linearising it.\\
{\tt EXPLN} puts the calculator into complex mode.\\
Typing:
$${\tt EXPLN(SIN(X))}$$
gives:
$${\tt \frac{EXP(i \cdot X)-\frac{1}{EXP(i \cdot X)}}{2 \cdot i}}$$
\subsection{Distributivity : {\tt FDISTRIB}}\index{FDISTRIB}
{\tt FDISTRIB} has an expression as argument.\\
{\tt FDISTRIB} enables you to apply the distributivity of multiplication with 
respect to addition all at once.\\
Typing:
$${\tt FDISTRIB((X+1)\cdot(X+2)\cdot(X+3))}$$
gives:
$${\tt X \cdot X \cdot X+3 \cdot X \cdot X+X \cdot 2 \cdot X+3 \cdot 2 \cdot X+X \cdot X \cdot 1+3 \cdot X \cdot 1+X \cdot 2 \cdot 1+3 \cdot 2 \cdot 1}$$
after simplification ({\tt ENTER}) :
$${\tt X^3+6\cdot X^2+11\cdot X+6 }$$
\subsection{Linearise the  exponentials : {\tt LIN}}\index{LIN}
{\tt LIN} has as an argument an expression containing exponentials and 
trigonometric functions.\\
{\tt LIN} converts trigonometric expressions
to exponentials and then linearises the complex exponentials (in terms of $\exp(n \cdot x)$)).\\
{\tt LIN} puts the calculator into complex mode when dealing with trigonometric
 functions.\\
Example 1\\
Typing:
$${\tt LIN((EXP(X)+1)^3)}$$
gives:
$${\tt 3 \cdot EXP(X)+1+3 \cdot EXP(2 \cdot X)+EXP(3 \cdot X)}$$
Example 2\\
Typing:
$${\tt LIN(SIN(X))}$$
gives:
$${\tt -(\frac{i}{2} \cdot EXP(i \cdot X))+\frac{i}{2} \cdot EXP(-(i \cdot X))}$$
Example 3\\
Typing:
$${\tt LIN(COS(X)^2)}$$
gives:
$${\tt \frac{1}{4} \cdot EXP(-(2 \cdot i \cdot X))+\frac{1}{2}+\frac{1}{4} \cdot EXP(2 \cdot i \cdot X)}$$
\subsection{Regroup the logarithms : {\tt LNCOLLECT}}\index{LNCOLLECT}
{\tt LNCOLLECT} has as an argument an expression containing logarithms.\\
{\tt LNCOLLECT} regroups the terms in the logarithms. It is therefore preferable to use an expression that has already been factored (using {\tt FACTOR}).\\
Typing:
$${\tt  LNCOLLECT(LN(X+1)+LN(X-1))}$$
gives:
$${\tt LN((X+1)(X-1))}$$
\subsection{Transform a power : {\tt POWEXPAND}}\index{POWEXPAND}
{\tt POWEXPAND} writes a power in the form of a product.\\
Typing:
$${\tt  POWEXPAND((X+1)^3)}$$
gives:
$${\tt (X+1)\cdot (X+1)\cdot (X+1)}$$
This allow you to do the developpement of $(x+1)^3$ in step by step, using 
{\tt DISTRIB} several times on the precedent result.
\subsection{Simplify : {\tt SIMPLIFY}}\index{SIMPLIFY}
{\tt SIMPLIFY} simplifies an expression automatically. \\
As with all automated simplification routines, however, one should not expect 
miracles.\\
Typing:
$${\tt SIMPLIFY(\frac{SIN(3 \cdot X)+SIN(7 \cdot X)}{SIN(5 \cdot X)})}$$
gives, after simplification:
$${\tt 4 \cdot COS(X)^2-2}$$
\subsection{Evaluation of reals : {\tt XNUM}}\index{XNUM}
{\tt XNUM} has an expression as a parameter.\\
{\tt XNUM} puts the calculator into approximate mode and returns the numeric 
value of the expression.\\
Typing:
$${\tt XNUM(\sqrt2)}$$ 
gives:
$${\tt 1.41421356237}$$
\subsection{Rational approximation : {\tt XQ}}\index{XQ}
{\tt XQ} has a real numeric expression as a parameter.\\
{\tt XQ} puts the calculator into exact mode and gives a rational or real 
approximation of the expression.\\
Typing:
$${\tt XQ(1.41421)}$$
gives:
$${\tt \frac{66441}{46981}}$$
Typing:
$${\tt XQ(1.414213562)}$$
gives:
$${\tt \sqrt2}$$
\section{Equations}
All the functions in this section are found in the {\tt SOLV} menu on the 
menu bar.
\subsection{The zeros of an expression :{\tt ISOLATE}}\index{ISOLATE}
{\tt ISOLATE} returns the values that are
the zeros of an expression or an equation.\\
{\tt ISOLATE} has two parameters: an expression or equation, and the name of 
the variable to isolate (ignoring {\tt REALASSUME}).\\
Typing:
$${\tt  ISOLATE(X^4-1=3,X)}$$
gives in real mode:
$${\tt (X=\sqrt2)\ OR\ (X=-\sqrt2)}$$
and in complex mode:
$${\tt (X=\sqrt2 \cdot i)\ OR\ (X=-\sqrt2)\ 
OR\ (X=-(\sqrt2 \cdot i))\ OR\ (X=\sqrt2) }$$

\subsection{Solve equations : {\tt SOLVE}}\index{SOLVE}
{\tt SOLVE} has as two parameters:\\
 (1) either an equality between two expressions, or a single expression (in 
which case {\tt = 0}~is implied), and \\
(2) the name of a variable.\\
{\tt SOLVE} solves the equation in $\mathbb{R}$ in real mode and in 
$\mathbb{C}$ in complex mode (ignoring {\tt REALASSUME}).\\
Typing:
$${\tt  SOLVE(X^4-1=3,X)}$$
gives, in real mode:
$${\tt (X=-\sqrt{2}) \ OR \ (X=\sqrt{2})}$$
or, in complex mode:
$${\tt (X=-\sqrt{2})\ OR \ (X=\sqrt{2})\ OR \ (X=-i \cdot \sqrt{2})\ OR\ (X=i\sqrt{2})}$$

\subsection{Solve equations : {\tt SOLVEVX}}\index{SOLVEVX}
{\tt SOLVEVX} has as a parameter either \\
(1) an equality between two expressions in the variable contained in {\tt VX},\\
 or \\
(2) a single such expression (in which case {\tt = 0} is implied).\\
{\tt SOLVEVX} solves the equation.\\
Example 1\\
Typing: 
$${\tt  SOLVEVX(X^4-1=3)}$$
gives, in real mode:
$${\tt (X=-\sqrt{2}) \ OR \ (X=\sqrt{2})}$$
or, in complex mode, even if you have chosen {\tt X} as real :\\
$${\tt (X=-\sqrt{2})\ OR \ (X=\sqrt{2})\ OR \ (X=-i \cdot \sqrt{2})\ OR\ (X=i\sqrt{2})}$$
Example 2\\
Typing: 
$${\tt  SOLVEVX((X-2) \cdot SIN(X))}$$
gives, in real mode:
$${\tt (X=-2 \cdot \pi \cdot n_1)\ OR\ (X=2 \cdot \pi \cdot n_1)\ OR \ (X=2)}$$

\section{Systems}
All the functions in this section are found in the {\tt SOLV} menu on the menu bar.
\subsection{Solve linear system : {\tt LINSOLVE}}\index{LINSOLVE}
{\tt LINSOLVE} enables you to solve a system of linear equations.\\
It's assumed that the various equations are of the form $expression = 0$.\\
{\tt LINSOLVE} has two arguments:  the first members of the various equations 
separated by {\tt AND}, and the names of the various variables separated by 
{\tt AND}.\\
Example 1\\
Typing:
$${\tt LINSOLVE(X+Y+3\ AND\ X-Y+1,X\ AND\ Y)}$$
gives:
$${\tt (X=-2)\ AND\ (Y=-1)}$$
or, in Step by step mode ({\tt CFG} etc...):\\
{\tt L2=L2-L1}\\
$ \left[\begin{array}{ccc}1&1&3\\1&-1&1 \end{array}\right] $\\
 {\tt ENTER}\\
{\tt L1=2L1+L2}\\
$ \left[\begin{array}{ccc}1&1&3\\0&-2&-2 \end{array}\right] $\\
 {\tt ENTER}\\
{\tt Reduction  Result}\\
$ \left[\begin{array}{ccc}2&0&4\\0&-2&-2 \end{array}\right] $\\
 {\tt ENTER}\\
The following is then written to the Equation Editor:
$${\tt (X=-2)\ AND\ (Y=-1)}$$
Example 2\\
Type:
$${\tt (2 \cdot X+Y+Z=1)\ AND\ (X+Y+ 2 \cdot Z=1)\ AND \ (X+2 \cdot Y+Z=4)}$$
Then, invoke {\tt LINSOLVE}\\
 and type the unknowns:
$${\tt X \ AND \ Y \ AND\ Z}$$
and press the {\tt ENTER} key.\\The following result is produced if you're in 
Step by step mode ({\tt CFG} etc...):\\
{\tt L2=2L2-L1}\\

$ \left[\begin{array}{cccc}2&1&1&-1\\1&1&2 &-1\\1&2&1&-4 \end{array}\right] $\\

puis {\tt ok}\\

{\tt L3=2L3-L1}\\

$ \left[\begin{array}{cccc}2&1&1&-1\\0&1&3 &-1\\1&2&1&-4 \end{array}\right] $\\

...and so on until, finally:

{\tt Reduction Result}\\

$ \left[\begin{array}{cccc}8&0&0&4\\0&8&0 &-20\\0&0&-8&-4 \end{array}\right] $\\

then press {\tt ENTER} and \\
$${\tt (X=-\frac{1}{2})\ AND\ (Y=\frac{5}{2})\ AND\ (Z=-\frac{1}{2})}$$ 
is written to the Equation Editor.
\subsection{Solve non linear system : {\tt SOLVE}}\index{SOLVE}
{\tt SOLVE} accepts non-linear equations if they are polynomial.\\
Otherwise, {\tt MSLV} should be used in {\tt HOME} to get a numerical 
solution.\\
It's assumed that the various equations are of the form $expression = 0$.\\
{\tt SOLVE} has as arguments, the first members of the various equations 
separated by {\tt AND}, and the names of the various variables separated by 
{\tt AND}.\\ 
Typing:
$${\tt SOLVE(X^2+Y^2-3\ AND\ X-Y^2+1,X\ AND\ Y)}$$
gives:
$${\tt (X=1)\ AND\ (Y=-\sqrt2)\  OR\ (X=1)\ AND\ (Y=\sqrt2)}$$
\section{Differential Equations}
All the functions in this section are found in the {\tt SOLV} menu on the 
Equation Editor menu bar.
\subsection{Solve of differential equations  : {\tt DESOLVE}}\index{DESOLVE}
{\tt DESOLVE} enables you to solve differential equations (for linear 
differential equations having constant coefficients, it is better to use 
{\tt LDEC}).\\
{\tt DESOLVE} has two arguments : the differential equation where $y'$ is 
written {\tt d1Y(X)} (or the differential equation and the initial conditions 
separated by {\tt AND}), and the unknown {\tt Y(X)}.\\
You have to be in real mode.\\
Example 1\\
Solve:
$$y''+y=\cos (x)$$
$$ y(0)=c_0 \; \; y'(0)=c_1$$
Typing:
$${\tt DESOLVE(d1d1Y(X)+Y(X)=COS(X),Y(X))}$$
gives:
  $${\tt Y(X)=cC0\cdot COS(X)+ \frac {X+2 \cdot cC1}{2}\cdot SIN(X)}$$
{\tt cC0} and {\tt cC1} are integration constants 
(${\tt y(0)=cC0 \ y\prime(0)=cC1}$).\\
You can then assign values to the constants using the {\tt SUBST}\index{SUBST}
 command. \\
To produce the solutions for $y(0) = 1$, type:
$${\tt SUBST ( Y(X)=cC0\cdot COS(X)+ \frac {X+2 \cdot cC1}{2}\cdot SIN(X), cC0=1)}$$
which gives:
$${\tt Y(X)=\frac {2\cdot COS(X)+  (X+2 \cdot cC1)\cdot SIN(X)}{2}} $$
Example 2 :\\
Solve:
$$y''+y=\cos (x)$$
$$ y(0)=1 \; \; y'(0)=1$$
It is possible to solve for the constants from the outset.\\ 
Typing\\
$${\tt DESOLVE((d1d1Y(X)+Y(X)=COS(X)) AND (Y(0)=1) AND (d1Y(0)=1),Y(X))}$$
Gives :
$${\tt Y(X)=COS(X)+ \frac {X+2}{2}\cdot SIN(X)}$$

%Nouveau
\subsection{Laplace transform and inverse Laplace transform~: {\tt LAP} and {\tt ILAP}}\index{LAP}\index{ILAP}
{\tt LAP} is the  Laplace transform of the expression given as argument.
We consider this expression as the value of a function of the 
variable stored in {\tt VX}.\\
{\tt ILAP} is the inverse Laplace transform of the expression given as 
argument. We consider this expression as the value of a function of the 
variable stored in {\tt VX}.\\
Laplace tranform ({\tt LAP}) and inverse Laplace transform
({\tt ILAP}) are useful to solve linear differential equations
with constant coefficients, for example:
$$y'' +p\cdot y'+q\cdot y \ =\ f(x)$$ 
$$ y(0)=a \; \; y'(0)=b$$
The following relations hold:
$${\tt LAP(Y)(X)=\int_0^{+\infty}e^{-X.T}Y(T)dT} $$
$${\tt ILAP(F)(X)=\frac{1}{2.i.\pi}\int_C e^{Z.X}F(Z)dZ}$$
where {\tt C} is a closed contour enclosing the poles of {\tt F}.\\
The following property is used:
$${\tt LAP(Y')(X)=-Y(0)+X \cdot LAP(Y)(X)}$$
The solution {\tt Y} of\\
${\tt Y'' +P \cdot Y'+Q \cdot Y \ =\ F(x),\; \;  Y(0)=A, \; \; Y'(0)=B}$ is then:
$${\tt ILAP(\frac{LAP(F(X))+(X+P) \cdot A +B}{X^2+P \cdot X+Q})}$$
Example:\\
Solve:
$$y'' -6 \cdot y'+9 \cdot y \ =\ x \cdot e^{3 \cdot x}$$
$$y(0)=a$$
$$y'(0)=b$$
Typing:
$${\tt LAP(X \cdot EXP(3 \cdot X))\ ENTER}$$
gives:
$${\tt \frac {1}{X^2-6 \cdot X+9}}$$
Typing:
$${\tt ILAP(\frac {\frac {1}{X^2-6 \cdot X+9}+(X-6) \cdot A+B}{X^2-6 \cdot X+9})}$$
gives the solution $y$ :
$${\tt ( \frac{X^3}{6}-(3 \cdot A-B) \cdot X+A) \cdot EXP(3 \cdot X)}$$
\subsection{Linear differential equations having constant coefficients : {\tt LDEC}}\index{LDEC}
{\tt LDEC}  enables you to directly solve linear differential equations having 
constant coefficients.\\
The parameters are the second member and the characteristic equation.\\
Solve:
$$y\prime \prime -6 \cdot  y\prime+9 \cdot  y \ =\ x \cdot  e^{3 \cdot  x}$$
Typing:
$${\tt LDEC(X \cdot EXP(3 \cdot X),X^2-6 \cdot X+9)}$$
gives: 
 $${\tt -(\frac{(18 \cdot X-6)\cdot cC0-(6\cdot X\cdot cC1+X^3)}{6} \cdot EXP(3 \cdot X))}$$
{\tt cC0}  and {\tt cC1} are integration constants 
(${\tt y(0)=cC0}$ and ${\tt  \ y\prime(0)=cC1}$).

\section{Trigonometric Expressions}
All the functions in this section are found in the {\tt TRIG} menu on the 
{\tt CAS} menu bar.
\subsection{Transform the arccos into arcsin : {\tt ACOS2S}}\index{ACOS2S}
{\tt ACOS2S} has as an argument a trigonometric expression.\\
{\tt ACOS2S} transforms the expression by replacing :\\
$\arccos(x)$ with 
$\displaystyle \frac{\pi}{2}-\arcsin(x)$.\\
Typing:
$${\tt ACOS2S(ACOS(X)+ASIN(X))}$$
gives, when simplified :
$${\tt \frac{\pi}{2}}$$
\subsection{Transform the arcsin into arccos : {\tt ASIN2C}}\index{ASIN2C}
{\tt ASIN2C} has as an argument a trigonometric expression.\\
{\tt ASIN2C} transforms the expression by replacing :\\
$\arcsin(x)$ with 
$\displaystyle \frac{\pi}{2}-\arccos(x)$.\\
Typing:
$${\tt ASIN2C(ACOS(X)+ASIN(X))}$$
gives, when simplified:
$${\tt \frac{\pi}{2}}$$
\subsection{Transform the arcsin into arctan : {\tt ASIN2T}}\index{ASIN2T}
{\tt ASIN2T} has as an argument a trigonometric expression.\\
{\tt ASIN2T} transforms the expression by replacing :\\
$\arcsin(x)$ with
$\displaystyle \arctan(\frac{x}{\sqrt{1-x^2}})$ .\\
Typing:
$${\tt ASIN2T(ASIN(X))}$$
gives:
$${\tt ATAN(\frac{X}{\sqrt{1-X^2}})}$$
\subsection{Transform the arctan into arcsin : {\tt ATAN2S}}\index{ATAN2S}
{\tt ATAN2S} has as an argument a trigonometric expression.\\
ATAN2S transforms the expression by replacing $\arctan(x)$ with
$\displaystyle \arcsin(\frac{x}{\sqrt{1+x^2}})$.\\
Typing:
$${\tt ATAN2S(ATAN(X))}$$
gives:
$${\tt ASIN(\frac{X}{\sqrt{X^2+1}})}$$

%Nouveau
\subsection{Transform exponential into hyperbolic functions : {\tt EXP2HYP}}\index{EXP2HYP}
{\tt EXP2HYP} has  an expression enclosing exponantials as argument.\\
{\tt EXP2HYP} transforms this expression with the relation :\\
$\exp(a)=\sinh(a)+\cosh(a)$.\\
Typing  :
$${\tt EXP2HYP(EXP(A))}$$
gives  :
$${\tt SINH(A)+COSH(A)}$$
Typing :
$${\tt EXP2HYP(EXP(-A)+EXP(A))}$$
gives :
$${\tt 2 \cdot COSH(A)}$$

\subsection{Transform in terms of tan(x/2) : {\tt HALFTAN}}\index{HALFTAN}
{\tt HALFTAN} has as an argument a trigonometric expression.\\
{\tt HALFTAN} transforms $\sin(x)$, $\cos(x)$ and $\tan(x)$ in the expression,
 rewriting them in terms of $\displaystyle \tan(\frac{x}{2})$.\\
Typing:
$${\tt HALFTAN(\frac{SIN(2 \cdot X)}{1+COS(2 \cdot X)})}$$
gives, after simplification:
$${\tt TAN(X)}$$
Typing:
$${\tt HALFTAN( SIN(X)^2+COS(X)^2)}$$
gives (${\tt SQ(X)=  X^2}$):
$${\tt {\left(\frac{2 \cdot TAN(\frac{X}{2})}{SQ(TAN(\frac{X}{2}))+1}\right)}^2+ {\left(\frac{1-SQ(TAN(\frac{X}{2}))}{SQ(TAN(\frac{X}{2}))+1}\right)}^2 }$$
or, after simplification:
$${\tt 1}$$
\subsection{Transform the complex exponentials into sin and cos : {\tt SINCOS}}\index{SINCOS}
{\tt SINCOS} takes as an argument an expression containing complex exponentials.\\
{\tt SINCOS} then rewrites this expression in terms of $\sin(x)$ and $\cos(x)$.\\
Typing:
$${\tt SINCOS(EXP(i \cdot X))}$$
gives after turning on complex mode, if necessary :\\
$${\tt COS(X)+i \cdot SIN(X)}$$
\subsection{Transform tan(x) with  sin(2x) and cos(2x) : {\tt TAN2CS2}}\index{TAN2CS2}
{\tt TAN2CS2} takes as an argument a trigonometric expression.\\
{\tt TAN2CS2} transforms this expression by replacing $\tan(x)$ with 
 $\displaystyle \frac{1-\cos(2 \cdot x)}{\sin(2 \cdot x)}$.\\
Typing:
$${\tt TAN2CS2(TAN(X))}$$
gives:
$${\tt \frac{1-COS(2 \cdot X)}{SIN(2 \cdot X)}}$$
\subsection{Replace tan(x) with  sin(x)/cos(x) : {\tt TAN2SC}}\index{TAN2SC}
{\tt TAN2SC} has as an argument a trigonometric expression.\\
{\tt TAN2SC} transforms this expression by replacing $\tan(x)$ with 
$\displaystyle \frac{\sin(x)}{\cos(x)}$.\\
Typing:
$${\tt TAN2SC(TAN(X))}$$
gives:
$${\tt \frac{SIN(X)}{COS(X)}}$$
\subsection{Transform tan(x) with sin(2x) and cos(2x) : {\tt TAN2SC2}}\index{TAN2SC2}
{\tt TAN2SC2} has as an argument a trigonometric expression.\\
{\tt TAN2SC2} transforms this expression by replacing $\tan(x)$ with
$\displaystyle \frac{\sin(2 \cdot x)}{1+\cos(2 \cdot x)}$.\\
Typing:
$${\tt TAN2SC2(TAN(X))}$$
gives 
$${\tt \frac{SIN(2 \cdot X)}{1+COS(2 \cdot X)}}$$
\subsection{Reconstruct the sine and the cosine of the same angle~: {\tt TCOLLECT}}\index{TCOLLECT}
{\tt TCOLLECT} has as an argument a trigonometric expression.\\
{\tt TCOLLECT} linearises this expression in terms of $\sin(n \cdot x)$ and 
$\cos(n \cdot x)$, then (in {\tt Real mode}) reconstructs the sine and cosine of the 
same angle.\\
Typing:
$${\tt TCOLLECT(SIN(X)+COS(X))}$$
gives:\
$${\tt \sqrt2 \cdot COS(X-\frac{\pi}{4})}$$
\subsection{Develop transcendental expressions : {\tt TEXPAND}}\index{TEXPAND}
{\tt TEXPAND} has as argument a transcendental expression (that is an
expression with trigonometric or exponantial or logarithmic functions.\\
{\tt TEXPAND} develops this expression in terms of $\sin(x)$, $\cos(x)$,
$\exp(x)$ or $\ln(x)$.\\
Example 1\\
Typing:
$${\tt TEXPAND( EXP(X+Y))}$$
gives:
$${\tt  EXP(X)\cdot EXP(Y)}$$
Example 2\\
Typing:
$${\tt TEXPAND( LN(X*Y))}$$
gives:
$${\tt  LN(Y)\cdot LN(X)}$$
Example 3\\
Typing:
$${\tt TEXPAND( COS(X+Y))}$$
gives:
$${\tt COS(Y) \cdot COS(X)-SIN(Y) \cdot SIN(X)}$$
Example 4\\
Typing:
$${\tt TEXPAND( COS(3 \cdot X))}$$
gives:
$${\tt 4 \cdot {COS(X)}^3-3 \cdot COS(X)}$$
Example 5\\
Typing:
$${\tt TEXPAND( \frac{SIN(3 \cdot X)+SIN(7 \cdot X)}{SIN(5 \cdot X)})}$$
gives, after pressing {\tt ENTER} to simplify:
$${\tt 4 \cdot {COS(X)}^2-2}$$
\subsection{Linearise une trigonometric expression : {\tt TLIN}}\index{TLIN}
{\tt TLIN} has as an argument a trigonometric expression.\\
{\tt TLIN} linearises this expression in terms of $\sin(n \cdot x)$ and $\cos(n \cdot x)$.\\
Example 1\\
Typing:
$${\tt TLIN(COS(X) \cdot  COS(Y))}$$
gives:
$${\tt \frac{1}{2} \cdot COS(X-Y)+\frac{1}{2} \cdot COS(X+Y)}$$
Example 2\\
Typing: 
$${\tt TLIN({COS(X)}^3)}$$
gives:
$${\tt \frac{1}{4} \cdot COS(3 \cdot X)+\frac{3}{4} \cdot COS(X)}$$
Example 3\\
Typing:
$${\tt TLIN(4 \cdot {COS(X)}^2-2)}$$
gives:
$${\tt 2 \cdot COS(2 \cdot X)}$$
\subsection{Simplify using $\sin(x)^2+\cos(x)^2=1$ : {\tt TRIG}}\index{TRIG}
{\tt TRIG} has as an argument a trigonometric expression.\\
{\tt TRIG} simplifies this expression using the identity 
$\sin(x)^2+\cos(x)^2=1$.\\
Typing:
$${\tt TRIG(SIN(X)^2+COS(X)^2+1)}$$
gives:
$${\tt 2}$$
\subsection{Simplify using the cosines : {\tt TRIGCOS}}\index{TRIGCOS}
{\tt TRIGCOS} has as an argument a trigonometric expression.\\
{\tt TRIGCOS} simplifies this expression, using the identity $\sin(x)^2+\cos(x)^2=1$ to rewrite it in terms of cosines.\\
Typing:
$${\tt TRIGCOS(SIN(X)^4+COS(X)^2+1)}$$
gives:
$${\tt COS(X)^4-COS(X)^2+2}$$
\subsection{Simplify using the sines : {\tt TRIGSIN}}\index{TRIGSIN}
{\tt TRIGSIN} has as an argument a trigonometric expression.\\
{\tt TRIGSIN} simplifies this expression, using the identity 
$\sin(x)^2+\cos(x)^2=1$ to rewrite it in terms of sines.\\
Typing:
$${\tt TRIGSIN(SIN(X)^4+COS(X)^2+1)}$$
gives:
$${\tt SIN(X)^4-SIN(X)^2+2}$$
\subsection{Simplify using the tangents : {\tt TRIGTAN}}\index{TRIGTAN}
{\tt TRIGTAN} has as an argument a trigonometric expression.\\
{\tt TRIGTAN} simplifies this expression, using the identity 
$\sin(x)^2+\cos(x)^2=1$ to rewrite it in terms of tangents.\\
Typing:
$${\tt TRIGTAN(SIN(X)^4+COS(X)^2+1)}$$
gives:
$${\tt \frac{2 \cdot TAN(X)^4+3 \cdot TAN(X)^2+2}{TAN(X)^4+2 \cdot TAN(X)^2+1}}$$

%Nouveau
\subsection{Simplification with complex exponentials : {\tt TSIMP}}\index{TSIMP}
{\tt TSIMP} has an expression as argument.\\
{\tt TSIMP} simplifies the expression rewriting it in function of
complex exponentials, and then reducing the number of variables (enabling 
{\tt complex} mode in the process).\\
Use {\tt TSIMP} only as a last resort.\\
Typing:
$${\tt TSIMP(\frac{SIN(3 \cdot X)+SIN(7 \cdot X)}{SIN(5 \cdot X)})}$$
You obtain after simplification (that is, after copying the result 2 times):
$${\tt \frac{EXP(i \cdot X)^4+1}{EXP(i \cdot X)^2}}$$

%Nouveau
\section{Version number of your CAS : {\tt VER}}\index{VER}\index{VERSION}
{\tt VER} returns the version number of your {\tt CAS}.\\
Typing:\\
{\tt VER}\\
gives:
$${\tt 4.20050219}$$
This result means that you have a version 4 {\tt CAS},
dated 19 February 2005.\\
Instead, {\tt VERSION} returns the version number of the calculator's
{\tt ROM} as a whole.\\
Type in {\tt HOME} screen:\\
{\tt VERSION}\\
You obtain:
$${\tt  Version \ HP39-E \ Copyright\ HP \ 1993 2004}$$ 



\chapter{Worked Exercises with the HP40}
\section{Introduction}
Begin by selecting {\tt CAS}:\\
to do this, press {\tt F6} for {\tt CAS} on the menu bar.\\
The various commands used in this chapter are found:\\
- in the Equation Editor menus:\\
{\tt ALGB (CFG DEF FACTOR SUBST TEXPAND)}\\
{\tt DIFF (DERIVX DERIV INTVX LIMIT TABVAR)}\\
{\tt REWRITE (DISTRIB LIN POWEXPAND XNUM)}\\
{\tt SOLV (LINSOLV)}\\
and in the {\tt MATH} key's menu:\\
{\tt Complex (DROITE RE IM)}\\
{\tt Integer (IEGCD ISPRIME? PROPFRAC)}.\\
Next, put the calculator into exact real algebraic mode:\\
to do this, press {\tt ALGB} on the menu bar and highlight {\tt CFG}, then 
press {\tt OK} on the menu bar.\\
It suffices then to choose {\tt Default cfg}, then {\tt OK} on the menu bar, 
but you can also choose {\tt Direct} mode or Step by step mode 
({\tt Step/step}), then quit the configuration menu with {\tt CANCEL} on the 
menu bar.\\
Do not forget that you must press {\tt ENTER} after each command!\\
In the remainder of this chapter, you will find portions of the 1999 
mathematical proof of Brevet d'Amiens, and the 1999 mathematical proof 
(series S) of Bac.\\
The examples illustrate as many features of the {\tt HP40GS} as possible...\\
It is worth noting, though, that it is still up to the student to take care to 
check the calculations and to know what course to follow when carrying out 
calculations.
\section{Exercises on Brevet}
\subsection{Exercise 1}
Given $A$:
$$\frac{\frac{3}{2}-1}{\frac{1}{2}+1}$$
calculate the result of $A$ in the form of an irreducible fraction, showing 
each step of the calculation.\\
In the Equation Editor, enter the value of $A$ by 
typing:\\
${\tt 3 \ \div \ 2\ \rhd \ -\ 1\ \rhd \rhd \ \div \ 1 \ \div \ 2\ \rhd \ +\ 1}$\\
$ \rhd$  selects the denominator.\\
{\tt ENTER} simplifies the denominator, giving:
$${\tt \frac{\frac{3}{2}-1}{\frac{3}{2}}}$$
Then, select the numerator using $\lhd$,\\
{\tt ENTER} simplifies the numerator, giving:
$${\tt \frac{\frac{1}{2}}{\frac{3}{2}}}$$
$\bigtriangleup$ selects the entire fraction, and {\tt ENTER} simplifies the 
fraction, giving:
$${\tt \frac{1}{3}}$$
\subsection{Exercise 2}
Given the number $C$:
$$C = 2\sqrt{45}+3\sqrt{12}-\sqrt{20}-6\sqrt3$$
write $C$ in the form $d \sqrt5$, where $d$ is a whole number.\\

In the Equation Editor, we enter the value of $C$ by typing:\\
${\tt 2\sqrt{\ }\ 45\ \rhd \rhd\ +\ 3\sqrt{\ }\ 12\ \rhd \rhd\ -\ \sqrt{\ }\ 20 \ \rhd \rhd\ -\ 6\sqrt{\ }\ 3}$\\
$\ \rhd \rhd \rhd $ selects ${\tt -6\sqrt3}$ and\\
$\lhd$  selects ${\tt -\ \sqrt{20}}$\\
$\triangledown \triangledown$ selects ${\tt -\ \sqrt{20}}$\\
Invoke the {\tt FACTOR} command, which is found in the {\tt ALGB} menu.\\
Pressing {\tt ENTER} then causes 20 to be factored into ${\tt 2^2 \cdot 5}$.\\
$\bigtriangleup$ selects ${\tt \sqrt{2^2\cdot 5}}$ and {\tt ENTER} returns 
${\tt 2\sqrt5}$\\
$\rhd$ selects ${\tt - 2\sqrt{5}}$\\
${\tt SHIFT \lhd}$ exchanges 
${\tt 3 \sqrt{12}}$ with ${\tt -2 \sqrt{5}}$\\
$\lhd$ selects ${\tt \ 2 \sqrt{45}}$\\
$\triangledown \rhd \triangledown$ selects ${\tt 45}$.\\
Invoke the {\tt FACTOR} command, which is found in the {\tt ALGB} menu.\\
Pressing {\tt ENTER} then causes 45 to be factored into ${\tt 3^2 \cdot 5}$.\\
$\bigtriangleup$ selects ${\tt \sqrt{3^2\cdot 5}}$ and {\tt ENTER} replaces 
${\tt \sqrt{3^2\cdot 5}}$ with ${\tt 3\sqrt5}$, \\
$ \bigtriangleup$ selects ${\tt 2 \cdot 3\sqrt5}$,\\
${\tt SHIFT \rhd}$ selects ${\tt 2 \cdot 3 \sqrt{5}}$ and ${\tt -2 \sqrt{5}}$,
and then {\tt ENTER} completes the operation and gives:\\
 ${\tt 4\sqrt{5}}$.\\
It remains to transform ${\tt 3 \sqrt{12}}$ and to see that this term is 
combined with ${\tt -6 \sqrt 3}$. \\
The result is:\\
$C=4 \sqrt5$
\subsection{Exercise 3}
Given the expression $D=(3x-1)^2-81$.\\
1.Expand and reduce $D$.\\
2.Factor $D$.\\
3.Solve the equation: $(3x-10)(3x+8)=0$.\\
4.Evaluate $D$ for $x = 5$.\\

1. First, write $D$ into the Equation Editor.\\
typing:\\
${\tt 3\ X \ - \ 1 \rhd \rhd \   x^y \ 2 \rhd \ - \ 81}$\\
Select  ${\tt (3X-1)^2}$ ($\rhd \ \lhd$), then press {\tt ENTER} to expand the 
expression.\\
 This gives:\\
${\tt 9X^2-6X+1-81}$\\
To do the expansion step by step, press {\tt MEMORY (SHIFT ,)} to recall the 
previous expression, then invoke {\tt POWEXPAND} for ${\tt (3.X-1)^2}$, then 
execute {\tt DISTRIB} a couple of times on the result to obtain:\\
${\tt 9X^2-6X+1}$\\
$\bigtriangleup$ selects the entire expression, then pressing {\tt ENTER} 
reduces it to:\\
${\tt 9X^2-6X-80}$\\
2. Search for $D$ in the history ({\tt SYMB} key), then highlight $D$ 
and press {\tt ENTER} to confirm your choice.\\
Invoke {\tt FACTOR} to obtain:\\
${\tt (3X+8)(3X-10)}$\\
You can also retrieve the original expression, select {\tt 81} to factor it 
into ${\tt 3^4}$ , and work out the difference between the two squares...\\
3. Invoke the {\tt SOLVEX} command, then press {\tt ENTER} to obtain:
$${\tt (X=-\frac{8}{3})\ OR\ (X=\frac{10}{3})}$$
4. Search for $D$ in the history ({\tt SYMB} key), then highlight $D$ 
and press {\tt ENTER} to confirm your choice.\\
Invoke {\tt SUBST}, then complete the second argument:\\
{\tt X=-5}\\
Then press $\rhd \rhd \rhd$ and {\tt ENTER} to obtain :\\
${\tt (3 \cdot (-5)-1)^2-81}$\\
Pressing {\tt ENTER} once more yields the result:\\
{\tt 175}\\
therefore, $D = 175$ when $X=-5$.
\subsection{Exercise 4}
A baker produces two different assortments of biscuits and macaroons.\\
A packet of the first assortment contains 17 biscuits and 20 macaroons.\\
A packet of the second assortment contains 10 biscuits and 25 macaroons.\\
Both packets cost $90\ c$.\\
Calculate the price of one biscuit, and the price of one macaroon.\\

Let $x$ be the price in cents of one biscuit, and $y$ the price of one 
macaroon.\\
 The problem is then to solve:
$$\left\{
\begin{array}{rl}
17x+20y&=90\\
10x+25y&=90
\end{array}
\right.
$$
In the Equation Editor, type:\\
${\tt LINSOLVE(17 \cdot X+20 \cdot Y-90\ AND\ 10 \cdot X+25 \cdot Y-90\ ,\ X\ AND\ Y)}$\\
If you are working in Step by step mode, this produces:\\

${\tt L_2=17L_2-10L_1}$\\
$\left[
\begin{array}{ccc}
17& 20& -90\\
10& 25 & -90
\end{array}
\right]$\\

${\tt L_1=45L_1-4L_2}$\\
$\left[
\begin{array}{rrr}
17& 20& -90\\
0& 225 & -630
\end{array}
\right]$\\

${\tt Reduction \ Result}$\\
$\left[
\begin{array}{rrr}
765& 0& -90\\
0& 225 & -630
\end{array}
\right]$\\

Pressing {\tt ENTER} then produces the result:
$${\tt (X=2)\ AND\ (Y=\frac{14}{5})}$$
If you select ${\tt \displaystyle \frac{14}{5}}$, and press the {\tt NUM} key 
(or invoke {\tt XNUM}), you get:
 $${\tt (X=2)\ AND\ (Y=2.8)}$$
In other words, the price of one biscuit is $2\ c$, and the price of one 
macaroon is $2.8\ c$.\\
{\sc Note}: If the calculator has gone into {\tt Approx} mode, put it back into
{\tt  Exact} mode using {\tt CFG}.
\subsection{Exercise 5}\index{DROITE}
Say that $A$ and $B$ are points having the coordinates:\\
$A$(-1 ; 3) and $B$(-3 ; -1), where the unit of measure is the centimetre.\\
1/
Find exact length of $AB$ in centimetres.\\
2/ Determine the equation of the line $AB$.\\
First Method\\
Type:\\
{\tt STORE((-1,3),A)}\\
accept the change to {\tt Complex} mode, if necessary.\\
{\tt STORE((-3,-1),B)}\\
The vector $\overrightarrow{AB}$ has coordinates ${\tt B-A}$.\\
1/ Typing:
$${\tt ABS(B-A)}$$
gives:
$${\tt 2\sqrt5}$$
2/  Apply the {\tt DROITE} command, on the {\tt MATH} key's {\tt Complex} menu:
$${\tt DROITE(A,B)}$$
gives:
$${\tt Y=2 \cdot X+5}$$
Pressing {\tt ENTER} then produces the result:
$${\tt Y=2 \cdot X+5}$$
Or second Method\\
1/ Typing:
$${\tt (-3,-1)-(-1,3)}$$
gives:
$${\tt -2-4 \cdot i}$$
Apply the {\tt ABS} command to get:
$${\tt ABS(-2-4i)}$$
gives:
$${\tt 2\sqrt5}$$
2/  Typing:
$${\tt DROITE((-1,3),(-3,-1))}$$
gives:
$${\tt Y=2 \cdot (X--1)+3}$$
Pressing {\tt ENTER} then produces the result:
$${\tt Y=2 \cdot X+5}$$
\section{Exercises on Bac}
\subsection{Exercise 1}
\subsubsection{Terms of exercise 1}
Let $m$ be a point on the circle $C$ of center $O$ and radius 1.
Consider the image $M$ of $m$ defined on their affixes by the transformation
$F\ :\ z->\frac{1}{2}z2-z$.  When $m$ moves on the circle $C$, $M$ will move 
on a curve $\Gamma$. The object of this exercice is to study and plot $\Gamma$.

\begin{enumerate}
\item Let $t \in  [-\pi , \pi]$ and  $m$ the point on $C$ of affix 
$z=e^{i \cdot t}$. Find the coordinates of $M$ in terms of $t$.
\item Compare $x(-t)$ with $x(t)$ and  $y(-t)$ with $y(t)$. Show that
$\Gamma$ has a symmetry center.
\item Compute $x'(t)$ and find the variations of $x$ over
$[0,\pi]$.
\item Same question for $y$.
\item Show the variations of $x$ and $y$ in the same table.
\item Put the points of $\Gamma$ corresponding to $t=0, \pi/3, 2\pi/3, \pi$
and draw the tangent to $\Gamma$ at these points. Draw the part
of $\Gamma$ corresponding to $t\in [0,\pi]$. Draw $\Gamma$.
\end{enumerate}
\subsubsection{Correction}
The object of this exercise is to trace the curve $\Gamma$ described by $M$ and
 given by $\frac{1}{2}\cdot z^2-z $, when $m$, given by $z$
 describes a circle \textit{C} with center $O$ and having a radius of 1. Let 
$t$ be a real number in $[-\pi , \pi]$, and let $m$ be the point of \textit{C}
 given by $z=e^{i \cdot t}$.
\begin{enumerate}
\item Calculating the coordinates of $M$:\\
First, make {\tt t} the {\tt VX} variable (SHIFT SYMB (SETUP) keys and then {\tt Indep var : t})\\
Then, enter the expression $\frac{1}{2}\cdot z^2-z$ into the Equation Editor.\\
In the Equation Editor, type:
$${\tt \ ALPHA \ Z \ x^y \ 2 \ \rhd\ \div\  2\ \rhd\ -\ ALPHA \ Z \ \rhd\ 
\rhd\ }$$
The expression ${\tt \displaystyle \frac{Z^2}{2}-Z}$ is selected.\\
Since $z=e^{i \cdot t}$, invoke {\tt SUBST} and complete the second argument by
 typing:
$${\tt SUBST(\frac{Z^2}{2}-Z,Z=EXP(i\times t))}$$
which gives:
$${\tt \frac{EXP(i\cdot t)^2}{2} - EXP(i\cdot t)} $$
Then, you linearise the expression with the command:\\
{\tt LIN}\\
The result (after accepting the switch to Complex mode) is:
$${\tt \frac{1}{2} \cdot EXP(2\cdot i\cdot t)+-1\cdot EXP(i\cdot t) }$$
\begin{itemize}
\item
Now store the result with the {\tt STORE} command by typing:
$${\tt STORE(\frac{1}{2} \cdot EXP(2\cdot i\cdot t)+-1\cdot EXP(i\cdot t),M)}$$
then pressing {\tt ENTER}.\\
To calculate the real part of this expression, enter the command:
$${\tt RE} $$
which returns:
$${\tt \frac {COS ( t\cdot 2)-2\cdot COS(t)}{2}}$$
We suppose that {\tt VX} contains {\tt t}
({\tt SHIFT HOME (MODES)} then {\tt Indep var : t}).\\
Then, define the function $x(t)$ by invoking {\tt DEF}:\\
{\sc Note}: You will need to type {\tt = X(t)}, then exchange {\tt X(t)}
 with the expression ${\tt \frac {COS ( t\cdot 2)-2\cdot COS(t)}{2}}$.
To do this, highlight {\tt X(t)} with $\rhd$  and type ${\tt SHIFT \lhd}$.  
Highlight the entire expression and select the {\tt DEF} command:
$${\tt DEF\ (X(t) = \frac {COS ( t\cdot 2)-2\cdot COS(t)}{2})}$$
Then press {\tt ENTER}.\\
To calculate the imaginary part of this expression, type the command:\\
{\tt IM(M)}\\
which returns:
$${\tt \frac {SIN ( t\cdot 2)-2\cdot SIN(t)}{2}}$$
Then, define the function $y(t)$ (in the same way as you defined $x(t)$):
$${\tt DEF( Y(t) =\frac {SIN ( t\cdot 2)-2\cdot SIN(t)}{2}}$$
Then press {\tt ENTER}.
\end{itemize}
\item To find an axis of symmetry for $\Gamma$, calculate $x(-t)$ and $y(-t)$
 by typing:
$${\tt X(-t)\ ENTER}$$
which produces:
$${\tt \frac {COS ( t\cdot 2)-2\cdot COS(t)}{2}}$$
In other words: $x(-t) = x(t)$\\
Then type:
$${\tt Y(-t)\ ENTER}$$
which produces:
$${\tt \frac {-SIN ( t\cdot 2)+2\cdot SIN(t)}{2}}$$
In other words: $y(-t) = -y(t)$\\
If $M_1 (x(t), y(t))$ is part of $\Gamma$, then $M_2 (x(-t),y(-t))$ is also 
part of  $\Gamma$.\\
Since $M_1$ and $M_2$ are symmetrical with respect to the $x$-axis , we can 
deduce that the $x$-axis is an axis of  symmetry for  $\Gamma$.\\
\item Calculate x´(t):\\
Typing:
$${\tt DERVX (X(t))}$$
returns:
$${\tt \frac {2 \cdot (-2 \cdot SIN ( t\cdot 2)-2\cdot(- SIN(t)))}{4}}$$
or, after simplification (ENTER), the reponse is :
$${\tt -SIN ( t)\cdot (2 \cdot COS(t)- 1)}$$
You can now define the function $x'(t)$ by invoking {\tt DEF}:\\
Note: You will need to type {\tt = X1(t)}, then exchange {\tt X1(t)} with the 
expression ${\tt -SIN ( t)\cdot (2 \cdot COS(t)- 1)}$.  
To do this, highlight {\tt X1(t)} ($\rhd$) and type ${\tt SHIFT \ \lhd}$.
This returns:
$${\tt DEF(\ X1(t)= -SIN ( t)\cdot (2 \cdot COS(t)- 1)) }$$
Then press {\tt ENTER}.\\
\item Calculate  y'(t):\\
Typing:
$${\tt DERVX (Y(t))}$$
returns:
$${\tt \frac {2 \cdot (2 \cdot COS( t\cdot 2)-2\cdot COS(t))}{4}}$$
and, after simplification ({\tt ENTER}), the response is :
$${\tt  2 \cdot COS(t)^2- COS(t)-1}$$
Invoke FACTOR to factor the expression:
$${\tt FACTOR(2 \cdot COS(t)^2- COS(t)-1)} $$
then press ENTER, the response is:
$${\tt (COS ( t)-1)\cdot (2 \cdot COS(t)+1)}$$
You can now define the function $y'(t)$ (in the same way as you defined 
$x'(t)$):
$${\tt DEF(\ Y1(t)=(COS ( t)-1)\cdot (2 \cdot COS(t)+1))}$$
\item Variations of $x(t)$ and $y(t)$\\
For this, you trace $x(t)$ and $y(t)$ on the same graph.\\
We suppose that {\tt t} is contained in{\tt VX} ({\tt SHIFT SYMB (SETUP)})
Type {\tt X(t)} in the Equation Editor and press {\tt ENTER}.\\
Then press the {\tt PLO}T key.\\
Select {\tt Function} using the dialog box, and select {\tt F1} as the 
destination.\\
Then, do the same thing with {\tt Y(t)}, making {\tt F2} the destination.\\
To graph the functions: quit {\tt CAS} (using the {\tt ON (CANCEL)} button), 
choose the Function aplet, and check {\tt F1} and {\tt F2}. You will have to 
set the window's parameters ({\tt SHIFT PLOT}), then press {\tt PLOT} to see 
the graphs.\\
Back in the Equation Editor (press the {\tt HOME} key, then {\tt CAS} 
on the menu bar), we can get exact outputs from the curve  $\Gamma$ :\\
\begin{itemize}
\item Values of $x(t)$ and $y(t)$\\
Find the values of $x(t)$ and $y(t)$ for 
$t=0,\frac{\pi}{3},\frac{2 \cdot \pi}{3},\pi$ by typing in succession 
({\tt ENTER} is pressed twice in most cases for further simplification):\\
$${\tt X(0) \ ENTER}$$
Response:  $\frac{-1}{2}$
$${\tt X(\frac{\pi}{3}) \ ENTER\ ENTER}$$
Response:  $\frac{-3}{4}$
$${\tt X(2 \times \frac{\pi}{3}) \ ENTER\ ENTER}$$
Response: $\frac{1}{4}$
$${\tt X(\pi) \ ENTER\ ENTER}$$
Response: $\frac{3}{2}$
$${\tt Y(0) \ ENTER}$$
Response: $0$\\
$${\tt Y(\frac{\pi}{3}) \ ENTER\ ENTER}$$
Response: $\frac{-\sqrt3}{4}$
$${\tt Y(2 \times \frac{\pi}{3}) \ ENTER\ ENTER}$$
Response: $\frac{-3 \cdot \sqrt 3}{4}$
$${\tt Y(\pi) \ ENTER\ ENTER}$$
Response: $0$
\item Slope of the tangents ($m=\frac{y'(t)}{x'(t)}$)\\
Find the values of $\frac{y'(t)}{x'(t)}$ for 
$t=0,\frac{\pi}{3},\frac{2 \cdot \pi}{3},\pi$ by typing in succession:
$${\tt LIMIT(\frac{Y1(t)}{X1(t)},t=0) \ ENTER}$$
Response: $0$
$${\tt  LIMIT(\frac{Y1(t)}{X1(t)},t=\pi \div 3) \ ENTER}$$
Response (answer {\tt YES} when asked {\tt UNSIGNED INF. SOLVE?}): 
$\infty$
$${\tt  LIMIT(\frac{Y1(t)}{X1(t)},t=2 \times \pi \div 3) \ ENTER}$$
Response: $0$
$${\tt LIMIT(\frac{Y1(t)}{X1(t)},t=\pi) \ ENTER}$$
Response (answer {\tt YES} when asked {\tt UNSIGNED INF. SOLVE?}): (\\
Here, then, are the variations of $x(t)$ and $y(t)$:
$$\begin{array}{|c|ccccccc|}\hline t & 0 & & \frac{\pi}{3} & & \frac{2\pi}{3} & &\pi \\\hline
x'(t)&0&-&0&+&\sqrt3&+&0\\\hline
x(t)&\frac{-1}{2} & \downarrow & \frac{-3}{4} & \uparrow &\frac{1}{4} & \uparrow &\frac{3}{2}\\\hline
y(t)&0&\downarrow & -\frac{\sqrt3}{4} &\downarrow & \frac{-3\sqrt3}{4} & \uparrow & 0\\\hline
y'(t)&0&-&-1&-&0&+&2\\\hline
m &0&&\infty&&0&&\infty\\\hline
\end{array}$$
\item The curve $\Gamma $ :\\
Now graph the parametric curve.\\
In the Equation Editor, type ${\tt X(t)+i \times Y(t)}$, then press 
{\tt ENTER}.\\
Then press:\\
{\tt PLOT}, and select {\tt Parametric} using the dialog box, specifying 
{\tt X1,Y1} as the destination. \\
To make the graph of the curve $\Gamma $ : quit {\tt CAS} (using the {\tt HOME}
 button), then choose the {\tt Parametric} aplet.  Check {\tt X1(T), Y1(T)}, 
and choose default values in {\tt PLOT SETUP}.
\end{itemize}
\end{enumerate}
\subsection{Exercise 2 (specialty)}
\subsubsection{Terms of exercise 2}
For $n$ a strictly positive integer, we define
\[ a_n=4\times 10^n-1, \quad  b_n=2\times 10^n-1, \quad  c_n=2\times 10^n+1\]
\begin{enumerate}
\item a/ Compute $a_1,b_1,c_1,a_2,b_2,c_2,a_3,b_3$ and $c_3$.\\
b/ Find how many digits the decimal representation of $a_n$ and $c_n$ have.
Show that $a_n$ and $c_n$ are divisible by 3.\\
c/ Using a list of prime smaller than 100, show that $b_3$ is prime.\\
d/ Show that for every integer $n>0$, $b_n\times c_n=a_{2n}$. Deduce
the prime factor decomposition of $a_6$.\\
e/ Show that GCD($b_n,c_n$)=GCD($c_n,2$). Deduce that $b_n$ and $c_n$
are prime together.
\item Consider the equation:
 $$(1)\ \ b_3x+c_3y=1$$
where the integers $x$ and $y$ are the unknown.\\
a/ Show that (1) has at least one solution\\
b/ Apply Euclide's algorithm to $c_3$ and $b_3$ and find a
solution to (1).\\
c/ Find all solutions of (1)
\end{enumerate}
\subsubsection{Correction}
Define the following for a natural whole number:
$$a_n=4 \times 10^n-1,\  b_n=2 \times 10^n-1 \mbox{ and } c_n=2 \times 10^n+1$$
Begin by typing:
$${\tt DEF(A(N)=4 \cdot 10^N-1)} $$
$${\tt DEF(B(N)=2 \cdot 10^N-1)} $$
$${\tt DEF(C(N)=2 \cdot 10^N+1)} $$
\begin{enumerate}
\item Now do the following:\\
Calculate 
\begin{itemize}
\item a) 
Simply type (in succession):
$${\tt A(1)}$$
Result:  39
$${\tt B(1)}$$
Result:  19
$${\tt C(1)}$$
Result:  21
$${\tt A(2)}$$
Result:  399
$${\tt B(2)}$$
Result:  199
$${\tt C(2)}$$
Result:  201
$${\tt A(3)}$$
Result:  3999
$${\tt B(3)}$$
Result:  1999\\C(3)\\
$${\tt C(3)}$$
Result:  2001
\item b) Number of digits, and divisibility\\
In this, the calculator is used only to try out different values of $n$ ... \\
Show that the whole numbers $k$ such that:
$$10^n \leq k < 10^{n+1} $$
have $(n+1)$ digits in decimal notation.\\
We have:
$$10^n\ <\ 3 \cdot 10^n\ <\ a_n\ < \ 4 \cdot 10^n\ <\  10^{n+1}$$
$$ 10^n\ <\ b_n\ < \ 2 \cdot 10^n\ < \ 10^{n+1}$$
$$10^n\ <\ 2 \cdot 10^n\ <\ c_n\ < \ 3 \cdot 10^n\ <\  10^{n+1}$$
so $a_n,\ b_n,\ c_n$  have $(n+1)$ digits in decimal notation. \\
Moreover, $d_n=10^n-1$  is divisible by 9, since its decimal
 notation can only end in 9.\\
We also have:
$$a_n=3 \cdot 10^n\ +\ d_n$$
and
$$c_n=3 \cdot 10^n\ -\ d_n$$
so $a_n$ and $c_n$ are both divisible by 3.\\
\item c) $b_3$ is a prime number\\
Typing:
$${\tt ISPRIME? (B(3))}$$
gives:
$${\tt 1.}$$
which means true.\\
To prove that $b_3=1999$ is a prime number, it is necessary to show that 1999 is
 not divisible by any of the prime numbers less than or equal to 
$\sqrt{1999}$.\\
As $1999<2025=45^2$, that means testing the divisibility of 1999 by 
$n = 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41$.\\
1999 is not divisible by any of these numbers, so we can conclude that 1999 is prime.
\item d)  $a_{2n}=b_n \times c_n$\\
Typing:
$${\tt B(N)\cdot C(N)}$$
produces:
$${\tt 4 \cdot {(10^N)}^2-1}$$
after applying the EXP2POW command.  This is  the value $a_{2n}$.\\
Decomposition of $a_6$ into its prime factors:\\
Typing:
$${\tt FACTOR(A(6))}$$
yields: 
$${\tt 3 \cdot 23 \cdot 29 \cdot 1999}$$
\item e) $b_n$ and $c_n$ are relatively prime.\\
In this part, the calculator is useful only for trying out different values of
 $n$...\\
To show that $c_n$ and $b_n$ are relatively prime, it is enough to remark that\\
$$c_n=b_n+2$$
That means that the common divisors of $c_n$ and $b_n$ are the common divisors 
of $b_n$ and 2, as well as the common divisors of $c_n$ and 2. $b_n$ and 2 are 
relatively prime because $b_n$ is a prime number different from 2. So:
$$PGCD(c_n,\ b_n)=PGCD(c_n,\ 2)=PGCD(b_n,\ 2)=1$$ 
\end{itemize}
\item Given the equation:
$$b_3 \cdot x + c_3 \cdot y =1$$
\begin{itemize}
\item a) It has at least one solution, as it is actually a form of Bézout's 
Identity.\\
In effect, Bézout's Theorem says:\\
If $a$ and $b$ are relatively prime, there exist $x$ and $y$ such that:
$$a \cdot x + b \cdot y =1$$
Therefore, the equation:
$$b_3 \cdot x + c_3 \cdot y =1$$
has at least one solution.\\
\item b) Typing:
$${\tt IEGCD(B(3),C(3))}$$
returns:
$${\tt 1000\ AND\ -999 =1}$$
In other words:
$$b_3 \times 1000 +c_3 \times (- 999)=1$$
so we have a particular solution:\\
$x=1000, \ y=-999$.\\
The rest can be done on paper:\\
$ c_3\ =\ b_3\ +\ 2$ and $b_3\ =\ 999\ \times \ 2 \ +\ 1$\\
so,  $b_3\ =\ 999\ \times \ (c_3 \ -\ b_3) \ +\ 1$, or:
$$b_3 \times 1000 +c_3 \times (- 999)\ =\ 1$$
\item c) In this part, the calculator is not used for finding the general 
solution.\\
We have:
$$b_3 \cdot x + c_3 \cdot y\ =\ 1$$
and
$$b_3 \times 1000 +c_3 \times (- 999)\ =\ 1$$
so, by subtraction:
$$b_3 \cdot (x-1000 )+ c_3 \cdot (y+999)\ =\ 0$$
or:
$$b_3 \cdot (x-1000 )\ =\ - c_3 \cdot (y+999)\ $$
According to Gauss's Theorem, $c_3$ is prime with $b_3$, so $c_3$ is a divisor 
of $(x-1000)$.\\
So, there exists $ k\ \in Z$ such that:
$$(x-1000)=k \times c_3 $$
and
$$-(y+999)=k \times b_3$$
Solving for x and y, we get:
$$x\ =\ 1000\ +\ k \times\ c_3$$
and 
$$y\ =\ -999\ -\ k \times\ b_3$$
for   $\ k\ \in Z$\\
This gives us:
$$b_3 \cdot x+ c_3 \cdot y =b_3 \times 1000 +c_3 \times (- 999)\ =\ 1$$
The general solution for all $k\ \in Z$ is therefore:
$$x\ =\ 1000\ +\ k \times\ c_3$$
$$y\ =\ -999\ -\ k \times\ b_3$$
\end{itemize}
\end{enumerate}
\subsection{Exercise 3 (non-specialty)}
\subsubsection{Terms of exercise 2}
For $n$ an integer, define:
$$u_n=\int _0 ^2\ \frac{2x+3}{x+2}\ e^\frac{x}{n}\ dx$$
\begin{enumerate}
\item a/ Define $g$ over $[0,2]$ by
$\displaystyle g(x)=\frac{2x+3}{x+2}$.\\
Find the variations of $g$ over $[0,2]$. Show that for every real
$x$ in $[0,2]$, $\displaystyle\frac{3}{2} \leq g(x) \leq \frac{7}{4}$.\\
b) Show that for every real $x$ in $[0,2]$:
$\displaystyle\frac{3}{2} e^\frac{x}{n}\leq g(x)e^\frac{x}{n} \leq \frac{7}{4}e^\frac{x}{n}$.\\
c) After integration, show that :
$$\frac{3}{2}n (e^\frac{2}{n}-1)\leq u_n \leq \frac{7}{4} n (e^\frac{2}{n}-1)$$
\\
d) Using $\displaystyle \lim_{h \rightarrow 0}\frac{e^h-1}{h}=1$.\\
show that if $u_n$ has a limit $L$ as $n \rightarrow \infty$, then 
$\displaystyle 3 \leq L \leq  \frac{7}{2}$.\\
\item
a) Show that for every $x$ in $[0,2]$:
$\displaystyle \frac{2x+3}{x+2}=2-\frac{1}{x+2}$.\\
Find the value of $I=\int _0 ^2\ \frac{2x+3}{x+2}\ dx$.\\
b) Show that for every $x$ in $[0,2]$:
$\displaystyle 1 \leq e^\frac{x}{n}\leq e^\frac{2}{n}$.\\
Deduce that $\displaystyle 1 \leq u_n \leq e^\frac{2}{n}I$.\\
c) Show that ($u_n$) is convergent and find it's limit $L$.
\end{enumerate}
\subsubsection{Correction}
Before you begin, check that the calculator is in exact real mode with {\tt X}
 as the current variable; if not, select {\tt Default cfg} in {\tt CFG}.\\
Given:
 $$u_n=\int _0 ^2\ \frac{2x+3}{x+2}\ e^\frac{x}{n}\ dx$$
\begin{enumerate}
\item Do the following:
\item
\begin{itemize}
\item Variation of $g(x)=\frac{2x+3}{x+2} \mbox{ for } x\in [0,2]$\\
Typing:
$${\tt DEF(G(X)=\frac{2X+3}{X+2})}$$
then:
$${\tt TABVAR(G(X))}$$
yields:
$$\begin{array}{cccccc} -\infty & + & -2 & + & +\infty & X\\
 2 & \uparrow & \infty & \uparrow & 2 & F
\end{array}$$
The first line gives the sign of {\tt g'(x)} according to {\tt x}, and the 
second line the variations of {\tt g (x)}. Note that for {\tt TABVAR} the 
function is always called {\tt F}.\\
We can deduce, then, that $g$(x) increases over $[0, 2]$.\\
If you were in Step by step mode (for this, choose {\tt Step/step} and then 
{\tt OK} on the {\tt CFG} menu bar), you would obtain (although the function 
is labelled {\tt F}):
$${\tt F=: \frac{2 \cdot X+3}{X+2}}$$
Press {\tt ENTER} :
$${\tt F':=\frac{2 \cdot (X+2)-(2 \cdot X+3)}{SQ(X+2)}}$$
Using the down-arrow $\triangledown$, scroll down the screen:
$${\tt \rightarrow \frac{1}{(X+2)^2}}$$
Then press {\tt ENTER} to obtain the table of variations.\\
If you are not in Step by step mode, you can also request the calculation of the derivative by typing:
$${\tt DERVX(G(X))}$$ 
which produces the preceding calculation.\\
To calculate $g(0)$ and $g(2)$, type:
$${\tt G(0)}$$
Response: $\frac{3}{2}$
$${\tt G(2)}$$ 
Response: 
$\frac{7}{4}$\\
whence the inequality:
$$\frac{3}{2} \leq g(x) \leq \frac{7}{4} \ \mbox{ for } x\in [0,2]$$.
\item b) The calculator is not needed here... simply stating that :
$$e^\frac{x}{n} \geq 0 \ \mbox{   pour } x\in [0,2] $$ 
is sufficient to show that, for $x\in [0,2]$, we have:
$$\frac{3}{2}e^\frac{x}{n}\leq g(x)e^\frac{x}{n}\leq \frac{7}{4}e^\frac{x}{n}$$
\item c) To integrate the preceding inequality, type:
$${\tt \int _0^2\  e^\frac{X}{N}\ dX} $$
which produces:
$${\tt N \cdot e^\frac{2}{N} -N } $$
We can then deduce that:
$$\frac{3}{2}(n e^\frac{2}{n}-n) \leq u_n \leq \frac{7}{4}(ne^\frac{2}{n}-n)$$
To justify the preceding calculation, it is necessary to assume that 
$n \cdot e^\frac{x}{n}$ is a primitive of $ e^\frac{x}{n}$.\\
If you are not sure, you can type:
$${\tt INTVX(EXP(\frac{X}{N}))}$$
The simplified result is: ${\tt N \cdot e^\frac{X}{N}}$
\item d) 
To find the limit of $(n e^\frac{2}{n}-n)$ when $n \rightarrow +\infty$:
$${\tt LIMIT(N \cdot EXP(\frac{2}{N}) -N\ ,\ N=+\infty)}$$
The result is:
$${\tt 2}$$
{\sc Note} :\\
The variable {\tt VX} is set equal to {\tt N}; use the {\tt SHIFT SYMB (SETUP)}
 keys to reset {\tt VX} to {\tt X}.\\
To check the result, we can say that:
$$\lim_{x \rightarrow 0}\frac{e^x-1}{x}=1$$
and that therefore:
$$\lim_{n \rightarrow +\infty}\frac{e^\frac{2}{n}-1}{\frac{2}{n}}=1$$
or, simplifying:
$$\lim_{n \rightarrow +\infty}(e^\frac{2}{n}-1)\cdot n=2$$
If the limit $L$ of $u_n$  exists as $n$ tends to $+\infty$ in the inequalities
 in 1b), we get:
$$\frac{3}{2} \cdot 2 \leq L \leq \frac{7}{4} \cdot 2$$
\end{itemize}
\item
\begin{itemize}
\item a) 
Do the following:\\ 
$g(x)=2-\frac{1}{x+2}$ and the calculation of $I= \int _0 ^2 g(x)dx$\\
Typing:
$${\tt PROPFRAC(G(X))}$$
returns:
$${\tt 2-\frac{1}{X+2}}$$
To calculate the integral $I$, type:
$${\tt \int _0 ^2 G(X)dX}$$
This produces:
$${\tt -(LN(2)-4)}$$
Working by hand: $2x+3=2(x+2)-1$, so :
$$g(x)=2-\frac{1}{x+2}$$
Then, integrating term by term between 0 and 2 produces:
$$\int_0^2 g(x)dx=[2x-\ln(x+2)]_{x=0}^{x=2}$$
that is, since $\ln4=2\ln2$ :
$$\int_0^2 g(x)dx=4- \ln2$$
\item b) The calculator is not needed here... simply stating that 
$e^\frac{x}{n}$ increases for $x \in [0,2]$ is sufficient to yield the 
inequality:
$$1 \ \leq \ e^\frac{x}{n} \ \leq e^\frac{2}{n} $$
Then, through multiplication, $g(x)$ being positive over $[0, 2]$, we get:
$$g(x)\ \leq \ g(x)e^\frac{x}{n}\ \leq g(x)e^\frac{2}{n}  $$
and then, integrating:
$$I \ \leq u_n \ \leq \ e^\frac{2}{n}I $$
\item c) Convergence of  $u_n$\\
Find the limit of $e^\frac{2}{n}$ when $n \rightarrow +\infty$:
$${\tt LIMIT(EXP(\frac{2}{N})\ , \ N=+\infty)}$$
This returns:
$${\tt 1}$$
In effect, $\frac{2}{n}$ tends to  0 as $n$ tends to $+\infty$, so 
$e^\frac{2}{n}$ tends to $e^0=1$ as $n$ tends to $+\infty$.\\
As $n$ tends to $+\infty$, $u_n$ is the portion between $I$ and a quantity 
that tends to $I$  (cf. inequalities 2b)).\\
So then, $u_n$ converges, and its limit is $I$.\\
We have therefore shown that:
$$L=I=4- \ln2$$
\end{itemize}
\end{enumerate}
\section{Conclusion}
You can see that, by that making good use of the {\tt HP40GS} calculator , you 
can use it for a large proportion of the calculations...\\
It is necessary to note, however, that arithmetic does require more reasoning.  Here, the calculator enables you to check your work...

%%%%% HP40GS END CAS %%%%%

\chapter{Programming}
\section{Implementation}\label{sec:programme}
\subsection{How to edit and save a program}
>From the {\tt HOME} screen, to get access to the catalogue of programs, press 
the {\tt SHIFT 1 (PROGRAM)} keys.\\
A screen then appears containing the list of available programs and a menu bar 
({\tt EDIT NEW SEND RECV RUN)}.\\
To create a new program, press {\tt F2 (NEW)}.\\
You are asked for the name of the program.\\ 
{\sc Note}: If you are not in {\tt Alpha}
 mode, press {\tt F4 (A..Z)} to go into it!\\
Type its name, then press {\tt F6 (OK)}.\\
You enter your program, and your work is automatically saved when you leave the editor by pressing {\tt HOME} or {\tt SHIFT 1 (PROGRAM)}.\\

\subsection{How to correct a program}
If the syntax is invalid, the calculator displays:\\
{\tt Invalid Syntax Edit program?} 
Respond by pressing {\tt F6 (YES)}.\\
The calculator automatically positions the cursor where the compiler has 
detected the error. All you need do then is correct it!

\subsection{How to run a program}
To run a program, open the catalogue of programs by pressing 
{\tt SHIFT 1 (PROGRAM)}.\\
A screen is then displayed containing the list of available programs and the 
menu bar {\tt EDIT NEW SEND RECV RUN}.\\
Highlight the name of the program and press {\tt F6 (RUN)}.

\subsection{How to modify a program}
To modify a program (and overwrite the old one), open the catalogue of programs
 by pressing {\tt SHIFT 1 (PROGRAM)}. A screen is then displayed containing the
 list of available programs and the menu bar 
{\tt EDIT NEW SEND RECV RUN}.\\
Highlight the name of the program and press {\tt F1 (EDIT)}.\\
If you want to save and edit the old program under a new name, then:\\
- Open the catalogue of programs ({\tt SHIFT 1 (PROGRAM)})\\
- Press {\tt F2 (NEW)} and type the new name, then press {\tt F6 (OK)}. 
The Editor opens.\\
- Press {\tt VARS}, then the letter {\tt P} to highlight {\tt Program}.\\
- Using the arrows, highlight the name of the old program, then press
{\tt F4 (VALUE)} (to select {\tt VALUE} on the menu bar), then {\tt F6 (OK)}.\\
This copies the text of the old program into the editor.
\section{Comments}
It is important to comment your programs.\\
In writing algorithms, a comment commonly starts with {\tt //} and ends at the 
end of the line.\\
In the {\tt HP40GS}, a comment starts with {\tt @} and ends at the end of the line or at the next {\tt @}, whichever comes first.\\
{\sc Note}:\\
Do not forget to put a space after the {\tt @}.\\
The character @ is obtained by typing {\tt SHIFT VAR (CHARS)}, then 
highlighting the character and choosing {\tt ECHO} on the menu bar
(or {\tt ECHO1 ECHO1 OK} to have two characters {\tt @}).


\subsection{{\tt SHIFT 1 (PROGRAM)} keys}
This key combination, if pressed in {\tt HOME}, displays the screen : \\
{\tt PROGRAM CATALOG}\\
It shows:\\
- a list of the programs that you've written, and\\
- a menu bar containing the commands:\\
{\tt EDIT NEW RUN SEND RECV}.\\
{\tt EDIT} enables you to edit the highlighted program,\\
{\tt NEW} enables you to create a new program,\\
{\tt RUN} enables you to run the highlighted program 
(cf \ref{sec:programme}),\\
{\tt SEND} and {\tt RECV} are functions that enable your calculator to talk 
to your computer or another calculator.\\
For example:\\
If you press {\tt SEND} on the menu bar, it asks:\\
{\tt HP39/40 (Wire)} or {\tt Disk Drive}\\
You highlight {\tt HP39/40 (Wire)} to send a program to another {\tt HP40GS}, 
or you highlight {\tt Disk Drive} to send a program to a computer.\\
Then press {\tt OK} on the menu bar.\\
For example, here is how you connect a Linux computer to the {\tt HP40GS} so 
as to use the program C-Kermit version 7 (which you can find at the URL 
{\tt www.columbia.edu/kermit}, or which you can download via anonymous ftp 
from the site {\tt kermit.columbia.edu}):\\
Connect the calculator to a data transfer cable.\\
On the computer, type:\\
{\tt kermit}\\
{\tt set line /dev/ttyS0} (or {\tt S1...} depending on the number of your       serial port)\\
{\tt set speed 9600}\\
{\tt set carrier-watch off}\\
{\tt serv}\\
On the {\tt HP40GS}:\\
Highlight the program called {\tt NAME}, then press {\tt SEND} on the menu bar 
and highlight {\tt Disk drive}. Then press {\tt OK} on the menu bar, and the program called {\tt NAME} on the {\tt HP40GS} is copied into your computer. \\
OR:\\
Press {\tt RECV} on the menu bar and highlight {\tt Disk drive}. Then press 
{\tt OK} on the menu bar, and the calculator displays a list of the 
{\tt HP40GS}
 programs on your computer.  (Naturally, you have to have already created a 
directory on your computer where the {\tt HP40GS} programs are stored).\\
You then highlight {\tt GCD}, and the program called {\tt GCD} on your computer
 is copied into the {\tt HP40GS}.\\
For Windows users, the connectivity program is found on the URL :\\
{\tt http://www.hp.com/calculators/france}.\\
To find out more about the use of Kermit with HP calculators, visit the URL: 
{\tt http://www.columbia.edu/kermit/hp48.html} 

\section{Variables}
\subsection{Their names}
These are the containers in which you can store values, numbers, expressions,
 and other objects.\\
With the {\tt HP40GS}, only the 26 letters of the alphabet, and the Greek letter
${\tt \theta}$ are available for storing real numbers.

\subsection{The concept of local variables}\index{PUSH}\index{POP}
Local variables are used to protect user variables from modifications
after a program call.
This concept does not exist natively on the {\tt HP40GS}
(only global variables are supported).\\
For advanced users, it is however possible to mimic the local variables 
mechanism using the {\tt CAS} history and {\tt PUSH} and {\tt POP}.
Say for example that our program use the variables {\tt A, B, C}.
At the beginning we can {\tt PUSH A} then {\tt PUSH B} then {\tt PUSH C}.
This will save the values of {\tt A}, {\tt B} and {\tt C} in the
{\tt CAS} history. At the end of the program we restore the value
of {\tt A}, {\tt B} and {\tt C} using {\tt POP}
and store the value in {\tt C}, {\tt B} and {\tt A}, it must be done
{\bf in reverse order} since the {\tt CAS}
history is a stack container (LIFO=Last In First Out).

\subsection{The concept of parameters}\index{PUSH}\index{POP}
It is not possible for programs written on the {\tt HP40GS} to natively pass 
parameters.
Hence you cannot use the {\tt HP40GS} programming language to write 
functions having parameters.\\
For advanced users, it is possible to mimic parameters using the {\tt CAS}
history. The caller {\tt PUSH} a list of parameters in the {\tt CAS}
history, then runs the program,
that will have as first instruction a {\tt POP} instruction.
This mechanism does not work in conjonction with the local variables
turnaround above. If you want to combine both concepts, you can
choose a list variable for parameter transmission and return value,
and use local variables as described above.

\section{User entry}
\subsection{Algorithmic syntax}
So that the user is able to enter a value for the variable {\tt A} during the 
course of the program's execution, one writes in algorithms:\\
{\tt input A}\\
And for entering values into {\tt A} and {\tt B}, one writes:\\
{\tt input A,B}
\subsection{{\tt HP40GS} syntax}\index{PROMPT}\index{PROMPTSTO}\label{sec:prompt}
\noindent{\tt INPUT A;"TITRE";"A=";;0:}\\
If it annoys you to have to type all the punctuation in the {\tt INPUT} 
command, you might prefer to use the {\tt PROMPT} or {\tt PROMPTSTO} command 
instead (thanks to Jean Yves!).\\
{\tt PROMPTSTO(A)} or {\tt PROMPT A} opens a window that asks you to enter 
the value of A.\\
In the remainder of this guide, programs that were written before the existence
 of PROMPT use the subroutine {\tt IN}, which enables you to enter two values
 into {\tt A} and {\tt B}.
\section{Output}
\subsection{Algorithmic syntax}
In algorithms one writes:\\
{\tt display "A=",A}
\subsection{{\tt HP40GS} syntax}
\noindent{\tt DISP 3;"A="A:}  3 represents the number of the line where{\tt  A}
 will be displayed\\
Or:\\
{\tt MSGBOX "A="A:}
\section{The sequence of statements, or "action"}
An action is a sequence of one or more statements.
\subsection{Algorithmic syntax}
In algorithmic language, you use the space or the linebreak to terminate the 
statement.
\subsection{{\tt HP40GS} syntax}
\noindent {\tt:} indicates the end of the statement.
\section{The assignment statement}
A value or an expression is stored in a variable by means of an assignment.
\subsection{Algorithmic syntax}
In algorithms, one writes (for example):\\
{\tt 2*A->B}\\ to store {\tt 2*A} in {\tt B}.
\subsection{{\tt HP40GS} syntax}
The arrow is obtained by means of the ${\tt STO\triangleright}$ key on the menu
 bar.\\
One types (for example):\\
{\tt 2*A-> B} that mean :\\
press {\tt 2*A} then press ${\tt STO\triangleright}$ on the menu bar
then press {\tt B}.
\section{Conditional statements}
\subsection{Algorithmic syntax}
\noindent Conditional statements have two syntax :\\
{\tt If \emph{condition} then\\
\emph{action}\\
endif}\\
and also :\\
{\tt  If  \emph{condition} then\\
\emph{action1} else\\
\emph{action2}\\
endif}\\ 
Example:\\
{\tt If A = 10 ou A < B then \\
B-A->B else \\A-B->A \\endif}
\subsection{{\tt HP40GS} syntax}
\noindent{\tt IF \emph{condition} THEN\\ 
\emph{action} : \\
END:}\\
and also :\\
{\tt IF \emph{condition} THEN\\ 
\emph{action1} : ELSE\\
\emph{action2}:\\
END:}\\
{\sc Note} au {\tt ==} to denote the condition of equality.\\
Example :\\
{\tt IF A==10 OR A<B THEN}\\ 
{\tt B-A->B : ELSE}\\
{\tt A-B-> A}\\
{\tt END:}
\section{FOR statement}
\subsection{Algorithmic syntax}
\noindent{\tt For I = A to B do action endfor}\\
and also :\\
{\tt For I = A to B (step P) do action endfor} 
\subsection{{\tt HP40GS} syntax}
\noindent{\tt FOR I = A TO B STEP 1 ; \emph{action} : END:}\\
and also :\\
{\tt FOR I = A TO B STEP P ; \emph{action} : END:} 
\section{WHILE statement}
\subsection{Algorithmic syntax}
\noindent{\tt While condition do action endwhile}
\subsection{{\tt HP40GS} syntax}
\noindent{\tt WHILE \emph{condition} REPEAT 
\emph{action} : 
END:}
\section{Boolean Expressions}
A condition is a function that has a Boolean as a value, that is, it is 
either {\tt TRUE} or {\tt FALSE}.
\subsection{Algorithmic syntax}
To express a condition, simply use the operators:

{\tt = > > $\leq$  $\geq$  $\neq$}
\subsection{{\tt HP40GS} syntax}
{\sc Note}: for the {\tt HP40GS} calculator, equality is denoted by:\\
{\tt ==}\\
Otherwise, the operators are the same.
\section{Logical Operators}
\subsection{Algorithmic syntax}
To express complex conditions, use the logical operators:

{\tt or and not}
\subsection{{\tt HP40GS} syntax}
{\tt Or, and, not} are represented on the {\tt HP40GS} as {\tt OR, AND, NOT}
\section{Lists}
\subsection{Algorithmic syntax}
In algorithms, you use {\tt \{ \}} to define a list.\\
For example, {\tt \{\}} designates a void list, and \{1, 2, 3\} is a list with three 
elements.\\
The {\tt +} is used to concatenate two lists, or a list and an element, or an 
element and a list:\\
{\tt \{1, 2, 3\} -> TAB}\\
{\tt TAB + 4  -> TAB} ({\tt TAB} now designates {\tt \{1, 2, 3, 4\}}\\
{\tt TAB[2]} indicates the second element of {\tt TAB}, here {\tt 2}.
\subsection{{\tt HP40GS} syntax}
The list variables have the following names: {\tt L0, L1, L2,... L9}.\\
You use {\tt \{ \}} to delimit a list.\\
For example, {\tt \{1, 2, 3\}} is a list with three elements.\\
But {\tt \{\}} does not designate a void list; to clear a list you must 
use the command {\tt CLRVAR}\index{CLRVAR}, e.g.:\\
{\tt CLRVAR L0} \\
will initialise the list {\tt L0} as void.
You can also use the command {\tt SUB} which extract a sub-list (if
{\tt L1=\{1,2,3,4\}} then {\tt SUB L2;L1;2;3} make the list 
{\tt L2=\{2,3\}}) and so,
{\tt SUB L1;L1;2;1} to initialise the list {\tt L1} as void.\\
Following are some useful commands:\\
{\tt MAKELIST(I*I, I, 1, 10, 2)} designates a list of the squares of the first
 five odd whole numbers (2 indicates the step of {\tt I}).\\
{\tt L1(I)} designates the Ith element of the list.\\
{\tt CONCAT (L1, \{5\})} designates a list having the element {\tt 5} in addition to 
the elements of the list {\tt L1}.\\
You can also use:\\
{\tt AUGMENT(L1,5)}, which designates a list having the element {\tt 5} in
 addition 
to the elements of the list {\tt L1}.\\
{\tt SUB L2; L1; 2; 4} is a command that copies into {\tt L2} the elements of 
{\tt L1}  having indices from 2 to 4.\\
{\sc Note} the difference between functions and commands:\\
Functions return a value, and they have parentheses enclosing their arguments 
(which are separated by commas), whereas\\
Commands do not return values, and their arguments are written directly after
 the name of the command (and are separated by semi-colons).
\section{Example: The Sieve of Eratosthenes}
\subsection{Description}
To find the prime numbers less than or equal to $N$:
\begin{enumerate}
\item Write the numbers from 1 to $N$ in a list.
\item Cross out 1, and let 2 be the first value of $P$.\\
If $P*P \leq N$, then taking the numbers from $P$ to $N$.
\item Cross out all the multiples of $P$ from $P*P$ onward.
\item Augment $P$ by 1,
If $P*P$ is less than or equal to $N$, then taking the non-excluded numbers 
from $P$ to $N$.
\item Change $P$ to the smallest non-excluded number between $P$ and $N$.
\item Repeat steps 3, 4 and 5 until $P*P$ exceeds $N$.
\end{enumerate}
\subsection{Algorithmic syntax}
\begin{verbatim}
Function sieve(N)
local TAB PRIMES I P
//TAB and PRIMES are lists
{} ->TAB
{} ->PRIMES
//do steps 1 and 2
for I = 2 to N do
   TAB+I -> TAB
endfor
0 + TAB -> TAB
2-> P
//TAB is the list 0 2 3 4 ..N
//1 has been excluded by replacing it with 0
\end{verbatim}{\tt while P*P $\leq$ N do}\begin{verbatim}
//exclude all multiples of P from P*P onward
   for I = P to FLOOR(N/P) do
     //FLOOR(N/P) designates the integer part of N/P
     0 -> TAB[I*P]  
   endfor
   P+1-> P  
//Find the smallest non-excluded number
//between P and N
\end{verbatim}
 {\tt {\  }   while (P*P $\leq$ N) and (TAB[P]=0) do}     
\begin{verbatim}
   P+1 -> P
   endwhile
endwhile
//write the result to the list PRIMES
for I = 2 to N do\end{verbatim}   
{\tt {\  } If  TAB[I]  $\neq$  0  then}
\begin{verbatim}     
    PRIMES + I -> PRIMES   
  endif
endfor
Result: PRIMES
\end{verbatim}
\subsection{{\tt HP40GS} syntax}
Following is the program {\tt SIEVE}:\\
The user must input a value for N.\\
At the end, the list {\tt L2} contains the prime numbers less than or equal to
{\tt  N}.
\begin{verbatim}
INPUT N;"CRIBLE";"N=";;10:
ERASE:
MAKELIST(I,I,1,N,1) -> L1:
0 -> L1(1):
2->P:\end{verbatim}
{\tt WHILE P*P $\leq$ N REPEAT}\begin{verbatim}
  FOR I = P TO INT(N/P) STEP 1;
    0->L1(I*P):
  END: 
  DISP 3;""L1:
  P+1->P:\end{verbatim}
{\tt {\  } WHILE P*P $\leq $ N AND L1(P) == 0 REPEAT}\begin{verbatim}
    P+1->P:
  END:
END:
{2}->L2:
@ on sait que 2 est premier
FOR I=3 TO N  STEP 1;\end{verbatim}
{\tt {\  }IF L1(I) $\neq$ 0 THEN}\begin{verbatim}
  CONCAT(L2,{I}) ->L2:
  END:
END:
DISP 3 ;"PREM" L2:
FREEZE:
\end{verbatim}
\chapter{Arithmetic Programs}
\section{GCD and Euclid's Algorithm}
Given the two whole positive numbers $A$ and $B$, find their $GCD$ (Greatest 
Common Divisor).\\
Euclid's Algorithm is based on the recursive definition of $GCD$:\\
\begin{eqnarray*}
GCD(A,0) & = & A\\
GCD(A,B) & = & GCD(B, A \bmod B) if B \neq 0
\end{eqnarray*}
where $A\ \bmod \ B$ designate the remainder of the Euclidean division of $A$
 by $B$.\\
Here is the description of this algorithm:\\
Perform the successive Euclidean divisions:
\begin{eqnarray*}
A=& B \times Q_1+R_1  &  0 \leq R_1 < B \\
B=& R_1 \times Q_2+R_2  & 0 \leq R_2 < R_1 \\
R_1=& R_2 \times Q_3+R_3 & 0 \leq R_3 < R_2 \\
.......
\end{eqnarray*}
After a finite number of steps, there exists a whole number n such that:
$ R_n = 0$.\\
One then has:\\
$GCD(A,B) = GCD(B, R_1) = ...=$\\
$GCD(R_{n-1}, R_n) = GCD(R_{n-1},0) = R_{n-1}$.
\subsection{Algorithmic syntax}
- Iterative version\\
If $B \neq 0$, calculate $R=A \bmod B$. Then, make $A$ equal to $B$, and $B$
 equal to $R$, and repeat the calculation until $B=0$. The $GCD$ is then $A$.
\begin{verbatim}
Function GCD(A,B)
Local R\end{verbatim}
{\tt While B $\neq$ 0 do}\begin{verbatim}
   A mod B ->R
   B ->A
   R ->B
endwhile
Result: A
endfunction
\end{verbatim}
- Recursive version\\
One simply writes the recursive definition given earlier.
\begin{verbatim}
Function GCD(A,B)\end{verbatim}
{\tt If B  $\neq$ 0 then}\begin{verbatim}
   Result: GCD(B,A mod B)
Else
   Result: A  
endif
endfunction
\end{verbatim}
\subsection{{\tt HP40GS} syntax}\label{sec:pgcdc}
- Iterative version for two whole numbers\\
First, type the subroutine {\tt IN}, which enables the user to enter two 
numbers {\tt A} and {\tt B} :
\begin{verbatim}
INPUT A;"A";;;1:
INPUT B;"B";;;1:
ERASE:\end{verbatim}
Then type the {\tt GCD} program:
\begin{verbatim}RUN IN:
DISP 3;"PGCD "{A,B}:\end{verbatim}
{\tt WHILE B $\neq$ 0 REPEAT }
\begin{verbatim}A MOD B ->R:
B ->A:
R ->B:
END:
DISP 4;"PGCD "A:
FREEZE:\end{verbatim}
- Recursive version for two whole numbers {\tt A} and {\tt B}\\
You cannot create recursive functions on the {\tt HP40GS}... but you can create the program {\tt GCDR} :
\begin{verbatim}DISP 3;"PGCD "{A,B}:
FREEZE:\end{verbatim}
{\tt IF B $\neq$ 0 THEN}
\begin{verbatim}A MOD B ->R:
B ->A:
R ->B:
PGCDR:
ELSE
DISP 3;"PGCD "A:
FREEZE:
END:\end{verbatim}
First, the values of {\tt A} and {\tt B} are stored.\\
The program {\tt GCDR} displays the GCD that it is in the process of 
calculating.\\
The recursive call {\tt GCDR} returns you to the {\tt GCDR} program, 
which you must execute by pressing {\tt RUN} on the menu bar.\\
The {\tt GCDR} program then displays the intermediate GCD calculations.\\
You can also replace {\tt GCDR} in the preceding program with {\tt RUN GCDR}
 to avoid having to press {\tt RUN} on the menu bar, and to suppress the display of the intermediate values, so that you can use this program in a larger program that caters for input and output:\\
>From the recursive program {\tt GCDR}, we can derive the recursive program 
{\tt PR} :\\

\noindent{\tt IF B $\neq$ 0 THEN}
\begin{verbatim} A MOD B ->R:
B ->A:
R ->B:
RUN PR:
END:\end{verbatim}
The program {\tt PR} can be inserted into a larger program catering for input 
and output:
\begin{verbatim}
PROMPT A:
PROMPT B:
RUN PR:
ERASE:
MSGBOX A:
\end{verbatim}
- Iterative version for two complex numbers.\\
If you use the symbolic calculation function {\tt IREMAINDER} in place of 
{\tt MOD} in the preceding programs, {\tt GCD} (or {\tt PR}) can then have 
Gaussian whole numbers as parameters on condition that you replace the names 
of the variables {\tt A}, {\tt B} and {\tt R} with {\tt Z1}, {\tt Z2} and 
{\tt Z3}, and that you change the test for completion.  When creating the new version start by recalling the contents of the earlier version, as described in 6.1.4.  Here is the iterative version:
 \begin{verbatim}
PROMPT Z1:
PROMPT Z2:
ERASE:
DISP 3;"PGCD "{Z1,Z2}:\end{verbatim}
{\tt WHILE ABS(Z2) $\neq$ 0 REPEAT }
\begin{verbatim}XNUM(IREMAINDER(XQ(Z1),XQ(Z2)) ->Z3:
Z2 ->Z1:
Z3 ->Z2:
END:
DISP 4;"PGCD "Z1:
FREEZE:
\end{verbatim}
- Iterative version for two polynomials.\\
The variables {\tt E1, E2,...} enable you to store expressions, which is what 
you must do if you deal with polynomials! If you use the symbolic calculation 
function {\tt REMAINDER} in place of {\tt MOD} in the preceding programs, 
{\tt GCD} (or {\tt PR}) can then have polynomials as parameters on condition that you replace the names of the variables {\tt A}, {\tt B} and {\tt R} with 
{\tt E1, E2, E3}, and that you change the test for completion.   The {\tt CAS}
 must be in {\tt Exact} and {\tt Direct} modes for this program.
\begin{verbatim}
PROMPT E1:
PROMPT E2:
ERASE:\end{verbatim}
{\tt WHILE DEGREE(E2) $\neq$ -1 REPEAT }
\begin{verbatim}REMAINDER(E1,E2) ->E3:
E2 ->E1:
E3 ->E2:
END:
DISP 4;"PGCD "E1:
FREEZE:
\end{verbatim}
You enter (for example):\\
${\tt E1=S1^2-1}$ and ${\tt E2=S1^2-2*S1+1}$
 to find the GCD equal to {\tt 2*S1-2}.
\section{Bézout's Identity}
Bézout's function (A,B) returns the list
$\{U, V, PGCD(A,B)\}$ (where $U$ and $V$ are such that:\\
$ A \times U + B \times V= PGCD(A,B)$.
\subsection{Iterative version without lists}
Euclid's Algorithm enables us to find a pair $U$ and $V$ such that:\\
$ A \times U + B \times V= PGCD(A,B) $\\
In effect, if we call $A_0$ and $B_0$ the values the $A$ and $B$ at the start, 
then we have:\\
\begin{eqnarray*}
 A & =A_0 \times U+B_0 \times V \ \mbox{ avec }\  U=1 \ \mbox{ and }\  V=0 \\ 
 B & =A_0 \times W+B_0 \times X  \ \mbox{ avec }\  W=0 \ \mbox{ and } \  X=1 
\end{eqnarray*}
You then derive $A,\ B,\ U,\ V,\ W,\ X$ in such a way that the two relations
 above are always satisfied.\\
If:\\
$ A=B \times Q+R \ \ \  0 \leq R < B \ \ ( R = A \ mod \ B \ and \  Q = E(A / B )) $\\
then:\\
\begin{eqnarray*}
R=A-B \times Q=A_0 \times (U-W \times Q)+B_0 \times (V-X \times Q)=\\
A_0 \times S+B_0 \times T \ \mbox{ avec } \ S=U-W \times Q \  \mbox{ and } \   T=V-X \times Q
\end{eqnarray*}
It remains then to repeat the process with:\\
$B$ in the role of $A$ ({\tt B->A\  W->U \ X->V}), and\\
$R$ in the role of $B$ ({\tt R->B \ S->W \ T->X})\\
whence the algorithm:
\begin{verbatim}
Function Bezout (A,B)
local U,V,W, X, S, T, Q, R
1->U 0->V 0->W 1->X\end{verbatim}
{\tt While B  $\neq$ 0 do}\begin{verbatim}
 A mod B->R
 FLOOR(A/B)->Q
 //R=A-B*Q
 U-W*Q ->S  
 V-X*Q ->T 
 B->A
 W->U
 X->V  
 R->B 
 S->W 
 T->X
endwhile
Result: {U, V, A}
endfunction
\end{verbatim}
\subsection{Iterative version with lists}
You can simplify the algorithmic syntax below by using fewer variables: for 
this, use the lists {\tt LA, LB, LR} to store the triplets {\tt \{U, V, A\}}, 
{\tt \{W, X, B\}} and {\tt \{S, T, R\}}.  This is quite easy, as the calculator
 knows how to add lists of the same length (by adding elements with the same 
index), as well as how to multiply a list by a number (by multiplying each of 
the list's elements by the number).
\begin{verbatim}
Function Bezout (A,B)
local LA LB LR
{1, 0, A}->LA
{0, 1, B}->LB\end{verbatim}
{\tt While LB[3] $\neq$ 0 do}\begin{verbatim}
LA-LB*E(LA[3]/LB[3])->LR 
LB->LA 
LR->LB 
endwhile
Result : LA
endfunction
\end{verbatim}
\subsection{Recursive version with lists}
Bézout's Function can be recursively defined by:

$ Bezout(A,0)=\{1,\ 0,\ A\} $

If $ B \neq 0 $, is it necessary to define $Bezout(A, B)$ as a function of 
$Bezout(B, R)$ when

$ R=A-B \times Q \ \mbox{ and } \  Q=FLOOR((A/B)$.

We have:        
\begin{eqnarray*} Bezout(B,R)=LT=\{W, X, pgcd(B,R)\} \\
\mbox{ avec }\  W \times B+X \times R=pgcd(B,R)
\end{eqnarray*}
with 
\begin{eqnarray*}
 W \times B+X \times (A-B \times Q) & = & gcd(B,R) \ \mbox{ or} \\ 
X \times A+(W-X \times Q) \times B & = & gcd(A,B).
\end{eqnarray*}

whence, if  $B \neq 0$ and if $ Bezout(B,R)=LT$, we have:\\

$ Bezout(A,B)=\{LT[2],\ LT[1]-LT[2] \times Q,\ LT[3]\}.$
\begin{verbatim}
function Bezout (A,B)
local LT Q R\end{verbatim}
{\tt If B $\neq$ 0 then}\begin{verbatim}
   FLOOR(A/B) ->Q
   A-B*Q->R
   Bezout(B,R)->LT   Result: {LT[2], LT[1]-LT[2]*Q, LT[3]}
else Result: {1, 0, A}
endif
endfunction
\end{verbatim}
\subsection{Recursive version without lists}\label{sec:recsl}
If you use global variables for {\tt A, B, D, U, V, T}, you can view the 
function {\tt Bezour} as using {\tt A, B} to calculate the values for 
{\tt U, V, D (AU+BV=D)} by means of a local variable {\tt Q}.\\
One can then write:
\begin{verbatim}
program Bezour
local Q\end{verbatim}
{\tt If B $\neq$ 0 then}\begin{verbatim}
   FLOOR(A/B) ->Q
   A-B*Q->T
   B->A
   T->B
   Bezour
   U-V*Q->T
   V->U
   T->V
else
   1->U 
   0->V
   A->D
endif\end{verbatim}
\subsection{{\tt HP40GS} syntax}
\noindent- Iterative version with lists\\
Here, you also use the program {\tt IN}, which enables the user to enter two
 numbers {\tt A} and {\tt B}:
\begin{verbatim}INPUT A;"A";;;1:
INPUT B;"B";;;1:
ERASE:\end{verbatim}
Now type the {\tt BEZOUT} program:
\begin{verbatim}
RUN IN:
DISP 3;"BEZOUT "{A,B}:
{1,0,A} ->L1:
{0,1,B} ->L2:\end{verbatim}
{\tt WHILE L2(3) $\neq$ 0 REPEAT} 
\begin{verbatim}L1-L2*FLOOR(L1(3)/L2(3)) ->L3:
L2 ->L1:
L3 ->L2:
END:
DISP 4;"U V PGCD "L1:
FREEZE:
\end{verbatim} 
- Recursive version without lists\\
Type the program {\tt BEZOUR}, using the commands (thanks to Bernard!!!):\\
{\tt PUSH}\index{PUSH} (the command {\tt PUSH(A)} stores the contents of 
{\tt A} on the {\tt CAS} stack), and\\
{\tt POP}\index{POP} (the {\tt POP} command retrieves values stored on the 
{\tt CAS} stack)\\
{\tt PUSH} and {\tt POP} can simulate the local variable {\tt Q}
We have replaced in the translation (cf \ref{sec:recsl}) the variables {\tt R} 
and {\tt W} by the temporary variable {\tt T}.\\
\noindent{\tt  PROGRAM BEZOUR}\\
{\tt IF B $\neq$ 0 THEN}
\begin{verbatim}PUSH (FLOOR(A/B)):
A MOD B->T:
B->A:
T->B:
RUN BEZOUR:
U-V*POP->T:
V->U:
T->V:
ELSE
 1->U:
 0->V:
 A->D: 
END:
\end{verbatim}

{\tt PUSH (FLOOR(A/B))} has the effect of putting the different values of 
{\tt FLOOR(A/B)} onto a stack, and {\tt POP} recovers them.\\
{\tt T} is an auxiliary variable.\\
{\tt BEZOUR} takes, as user input, the values of the global variables {\tt A}
 and {\tt B}, and assigns values to the global variables {\tt U} and {\tt V}
 such that:\\
${\tt A\cdot U+B\cdot V=GCD(A,B)}$. 
We can then write the final program {\tt BEZOURT}, which caters for the input 
of A and B and the output of {\tt \{U, V, D\}}:\\
\noindent{\tt  PROGRAM BEZOURT}
\begin{verbatim}
PROMPT A:
PROMPT B:
RUN BEZOUR:
ERASE:
MSGBOX {U,V,D}:
\end{verbatim}


\noindent {\sc Remarks} (cf. iterative version for two complex \ref{sec:pgcdc}): \\
If you use the symbolic calculation functions {\tt IREMAINDER} and 
{\tt IQUOT(XQ(Z1),XQ(Z2))} in place of {\tt MOD} and {\tt FLOOR(A/B)} in the 
preceding programs, then {\tt BEZOUT} and {\tt BEZOUR} can take Gaussian 
integers as parameters, on condition that you replace the names of the 
variables {\tt A, B, R...} with {\tt Z1, Z2, Z3...}.\\
If you use the symbolic calculation function {\tt REMAINDER} in place of 
{\tt MOD} in the preceding programs, then {\tt BEZOUT} and {\tt BEZOUR}
 can take polynomials as parameters, on condition that you replace the names
 of the variables {\tt A, B, R...} with {\tt E1, E2, E3...} and that you 
change the test for completion.
\section{Decomposition into prime factors}
\subsection{Algorithmic syntax}
- Initial algorithm\\
Let $N$ be a whole number.\\
For all numbers $D$ from 2 to $N$, test the divisibility of $N$ by $D$.\\
If $D$ is a divisor of $N$, then find the divisors of $N/D$, and so on... with 
$N/D$ taking the role of $N$. The process stops when $N = 1$.\\
As divisors are found, they are stored in the list {\tt FACT}.
\begin{verbatim}
function facprimes(N)
local D FACT
2->D
{} -> FACT\end{verbatim}
{\tt While N $\neq$ 1  do}\begin{verbatim}
   If N mod D = 0 then
      FACT + D -> FACT
      N/D -> N
   Else
      D+1 -> D
   endif
endwhile
Result: FACT 
endfunction
\end{verbatim}
- First improvement \\
One only tests the divisors D that are between 2 and $FLOOR(\sqrt N)$.\\
In effect, if  $N = D1* D2$, then we can say:\\
Let $D1 \leq FLOOR(\sqrt N)$, and let $D2 \leq FLOOR(\sqrt N)$; otherwise, we
 would have:\\
$D1 * D2 \geq (FLOOR(\sqrt N) + 1)^2 > N$.
\begin{verbatim}
function facprimes(N)
local D FACT
2-> D
{} -> FACT\end{verbatim}
{\tt While  D*D $\leq$  N do}
\begin{verbatim}  If  N mod D = 0 then
      FACT + D -> FACT
      N/D -> N
   Else
      D+1-> D
   endif
endwhile
FACT + N -> FACT
Result: FACT   
endfunction                  
\end{verbatim}
- Second improvement \\
One looks to see whether 2 is a divisor of $N$, then one tests only the odd 
divisors $D$ that are between 3 and $FLOOR(\sqrt N)$.\\
In the list {\tt FACT}, each divisor is written followed by its exponent:\\
decomp(12)=\{2,2,3,1\}.
\begin{verbatim}
function facprimes(N)
local K D FACT
{}->FACT
0 -> K
While N mod 2 = 0 do
   K+1 -> K
   N/2 -> N
endwhile\end{verbatim}
{\tt  If K $\neq$ 0  then}
\begin{verbatim}   FACT + {2 K} -> FACT
endif
3-> D\end{verbatim}
{\tt While D*D $\leq$ N do}
\begin{verbatim}   0 -> K
   While N mod D = 0  do
      K+1 -> K
      N/D -> N
   endwhile\end{verbatim}
 {\tt \ \ If K $\neq$ 0 then}
\begin{verbatim}      FACT + (D K( -> FACT
   endif
   D+2 -> D
endwhile
{\tt If N $\neq 1$ 1 then}
\begin{verbatim}   FACT + {N 1} -> FACT
endif
Result: FACT
endfunction\end{verbatim}
\subsection{{\tt HP40GS} syntax}
This is a translation of the last algorithm.\\
The {\tt HP40GS} calculator does not understand \{\}, so to initialise {\tt L1}
 as an empty list you must type:\\
{\tt CLRVAR L1}\\
or  {\tt SUB L1;L1;2;1}.\\
Here is the program {\tt FACTPRIMES}:
\begin{verbatim}
INPUT N;"N";;;1:
ERASE:
0 ->K:
CLRVAR L1:
WHILE N MOD 2 == 0 REPEAT
1+K -> K:
N/2 -> N:
END:\end{verbatim}
{\tt IF K $\neq$ 0 THEN}\begin{verbatim}
{2,K} ->L1:
END:
3 ->D:\end{verbatim}
{\tt WHILE D*D $\leq$ N REPEAT}\begin{verbatim}
0 -> K:
WHILE N MOD D == 0 REPEAT
K+1 -> K:
N/D -> N:
END:\end{verbatim}
{\tt IF K $\neq$ 0 THEN}\begin{verbatim}
CONCAT (L1,{D,K}) -> L1:
END:
2+D -> D:
END:\end{verbatim}
{\tt IF N $\neq$ 1 THEN}\begin{verbatim}
CONCAT (L1, {N,1}) -> L1:
END:
DISP 3; "FACT" L1:
FREEZE:
\end{verbatim}
\section{Calculating $ A^P \  mod\ N$}\label{sec:puimod}
\subsection{Algorithmic syntax}
- First algorithm\\
This algorithm uses two local variables, {\tt POWER} and {\tt I}.\\
Write an iterative program such that at each stage, {\tt POWER} represents 
${\tt A^I \ (\bmod \ N)}$.
\begin{verbatim}
function powermod (A, P, N)
local POWER, I
1 -> POWER
for I  = 1 to P  do
   A*POWER mod N -> POWER
endfor
Result: POWER
endfunction\
\end{verbatim} 
- Second  algorithm\\
This algorithm uses a single local variable {\tt POW}, but it varies {\tt P}
 such that at each stage of the iteration we have:\\
${\tt result =  POW * A^P \  (bmod  N)}$
\begin{verbatim}
function powermod (A, P, N)
local POW
1 -> POW
While P>0 do
   A*POW mod N -> POW
   P-1 ->P
endwhile
Result: POW
endfunction
\end{verbatim} 
- Third algorithm\\
One can easily modify this program by taking into account that:\\
${\tt A^{2*P} = (A*A)^P}$.\\
Therefore when P is even, we have the relation:\\
${\tt PUI*A^P = PUI*(A*A)^{P/2} \ (\bmod \ N)}$\\
and when P is odd, we have the relation:\\
${\tt PUI*A^P = PUI*A*A^{P-1}\ (\bmod \ N)}$.\\
We are left with a very fast algorithm for ${\tt A^P \ (\bmod \ N)}$.
\begin{verbatim}
function powermod (A, P, N)
local POW
1->POW
While P<0 do
   If P mod 2=0 then
      P/2->P
      A*A mod N->A
   Else
      A*POW mod N ->POW
      P-1->P
   endif
endwhile
Result: POW
endfunction
\end{verbatim} 
It goes without saying that if {\tt P} is odd, then {\tt P-1} is even.\\
One can then write:
\begin{verbatim}
function powermod (A, P, N)
local POW
1->POW
While P<0 do
   If P mod 2=1 then      A*POW mod N->POW
      P-1->P
   endif
   P/2-(>P
   A*A mod N->A
endwhile
Result: POW
endfunction
\end{verbatim} 
\subsection{{\tt HP40GS} syntax}
The calculation of ${\tt A^p \bmod N}$ is treated in the program on the 
probability method of Mr Rabin. Please refer to the {\tt HP40GS} version of 
that program (cf \ref{sec:rabin}).
\section{The function "isprime"}
\subsection{Algorithmic syntax}
- Initial algorithm

Write a Boolean function of {\tt N} that is equal to {\tt TRUE} when {\tt N}
 is prime and {\tt FALSE} when it is non-prime.\\
For this, find whether {\tt N} has a divisor $\neq$ 1 and $\leq$
${\tt  FLOOR(\sqrt N)}$ (the whole part of the square root of {\tt N}).\\
The case where {\tt N=1} is treated separately!\\
Here, the Boolean variable {\tt PRIME} is used, which is {\tt TRUE} by default,
 and which is set to {\tt FALSE} if a divisor of {\tt N} is found.
\begin{verbatim}
Function isprime(N)
local PRIME, I, J\end{verbatim}
${\tt  FLOOR((\sqrt N)->J}$
\begin{verbatim}If N = 1 then
   FALSE->PRIME 
else
   TRUE->PRIME 
endif
2->I\end{verbatim}
{\tt While PRIME and I $\leq$ J do}
\begin{verbatim}   If N mod I=0 then
      FALSE->PRIME
   else
      I+1->I
   endif
endwhile
Result: PRIME
endfunction
\end{verbatim}
- First improvement\\
Of course, we can test to see if {\tt N} is even, then look only for odd 
divisors of {\tt N}.
\begin{verbatim}
function isprime(N)
Local PRIME, I, J\end{verbatim}
${\tt FLOOR(\sqrt N)->J}$\\
{\tt  If (N = 1) or (N mod 2 = 0) and (N$\neq$2) then}\begin{verbatim}
   FALSE->PRIME
else
   TRUE->PRIME
endif
3->I\end{verbatim}
{\tt While PRIME and I $\leq$(J do}
\begin{verbatim}   If N mod I = 0 then
      False -> PRIME}
   else
      I+2->I
   endif
endwhile
Result: PRIME
endfunction
\end{verbatim}
- Second improvement\\
We can test to see if {\tt N} is divisible by 2 or 3, then look only for 
divisors of {\tt N} that are of the form $6 \times k-1 $ oo  $6 \times k+1 $.

\begin{verbatim}
function isprime(N)
local PRIME, I, J\end{verbatim}
${\tt  FLOOR(\sqrt N)->J}$
\begin{verbatim}If (N = 1) or (N mod 2 = 0) or (N mod 3 = 0) then
   FALSE-(PRIME
else
   TRUE->PRIME
endif
If N=2 or N=3 then
   TRUE->PRIME
endif
5->I\end{verbatim}
{\tt While PRIME and I $\leq$ J do}
\begin{verbatim}  If (N mod I = 0) or (N mod (I + 2) = 0) then
      FALSE->PRIME
   else
      I + 6 -> I
   endif
endwhile
Result: PRIME
endfunction
end{verbatim}
\subsection{{\tt HP40GS} syntax}
\begin{verbatim}
INPUT N;"N";;;1:
IF N MOD 2== 0 OR N MOD 3==0 OR N==1 THEN
0 ->P:
ELSE
1->P:
END:
IF N==2 OR N==3 THEN
1->P:
END:
5->I:\end{verbatim}
${\tt FLOOR(\sqrt {N})->J:}$\\
{\tt WHILE I $\leq$ J AND P REPEAT}\begin{verbatim}
IF N MOD I==0 OR N MOD (I+2)==0 THEN 
0 ->P:
ELSE
I+6 ->I:
END:
END:
ERASE:
DISP 5;P:
FREEZE: 
\end{verbatim}
\section{Mr Rabin's probability method}\label{sec:rabin}
If $N$ is prime, then all numbers $K$ less than $N$ are prime with $N$, so 
according to  Fermat's Little Theorem we have:\\
$ K^{N-1} = 1 \  (\bmod\  N)$\\
If  $N$ is not prime, the integers $K$ such that:\\
$ K^{N-1} = 1 \  (\bmod\  N)$ \\
are very few indeed.\\
A number $N$ such that $ K^{N-1} = 1 \  (\bmod\  N)$ for 20 random tries of $K$
 is called a pseudo-prime number. The probability method of Rabin consists of 
choosing a random number $K$ ($1< K < N $) and calculating:\\
$ K^{N-1}  \  (\bmod\  N)$ \\
If $ K^{N-1} = 1 \  (\bmod\  N)$), another random number is tried, whereas if
$ K^{N-1} \neq  1 \  (\bmod\  N)$, it is certain that $N$ is not prime.\\
If $ K^{N-1} = 1 \  (\bmod\  N)$ is obtained for 20 tries of $K$, one can 
conclude that $N$ is prime with a very small probability of error.


Naturally, this method is used to test whether large numbers are pseudo-primes,
but the command {\tt ISPRIME?} use the Miller-Rabin method. This method
use also Fermat's Little Theorem and is also a probabilist method.
It conclude that $N$ is prime with a very small probability of error
 (less than $(0.25)^{20}$ if you make 20 random tries of $K$ or on the order of
 $10^{-12}$).
\subsection{Algorithmic syntax}
Let us suppose that:\\
{\tt Random(N)} returns a random whole number between 0 and $N-1$.\\
Calculation of:\\
$ K^{N-1}  \bmod\  N$\\
is carried out using the very fast algorithm developed earlier 
(cf page \pageref{sec:puimod}.\\
{\sc Note} the statement:\\
{\tt powermod(K, P, N)}, the function that calculates ${\tt K^P  \bmod\  N}$.
\begin{verbatim}
Function isprime(N)
local K, I, P
1->I
1->>P
While P = 1 and I < 20 do
   Random(N-2)+2->K
   powermod(K, N-1, N)->P
   I+1->I
endwhile
If P =1  then
   Result: TRUE
else
   Result: FALSE
endif
endfunction
\end{verbatim}
\subsection{{\tt HP40GS} syntax}
\begin{verbatim}
PROMPT N:
RANDSEED TIME:
1->I:
1->P:
WHILE I < 20 AND P==1 REPEAT
  FLOOR( RANDOM * (N-2))+2->K:
  N-1->M:
  @ Calcul de K puissance M mod N dans P.
  1->P:
  WHILE  0 < M REPEAT
    IF M MOD 2 == 0 THEN
      M / 2 -> M :
      (K * K)  MOD N ->K :
    ELSE
      K*P MOD N -> P:
      M - 1 -> M:
    END:
  END: 
  @ P contient K puissance M mod N et M=N-1.
  I+1 ->I:
END:
ERASE:
IF P==1 THEN
  DISP 3;"PREMIER " N: 
ELSE 
  DISP 3;"NON PREMIER " N:
END:
FREEZE:
\end{verbatim}
{\sc Remark}:
You can also use the computer algebra function {\tt POWMOD}, substituting:\\
{\tt MODSTO(N):}\\
{\tt POWMOD(K,N-1) -> P:}\\
for the statements between the comments ( @ ). This results in :
\begin{verbatim}
PROMPT N:
RANDSEED TIME:
1->I:
1->P:
WHILE I < 20 AND P==1 REPEAT
  FLOOR( RANDOM * (N-2))+2->K:
  MODSTO(N):
  POWMOD(K,N-1)-> P:
  I+1 ->I:
END:
ERASE:
IF P==1 THEN
  DISP 3;"PREMIER " N: 
ELSE 
  DISP 3;"NON PREMIER " N:
END:
FREEZE:
\end{verbatim}

\chapter{GNU Free Documentation License} \label{sec:fdl}
{\tiny
Version 1.1, March 2000

Copyright (C) 2000  Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

0. PREAMBLE

The purpose of this License is to make a manual, textbook, or other written
document "free" in the sense of freedom: to assure everyone the effective
freedom to copy and redistribute it, with or without modifying it, either
commercially or noncommercially. Secondarily, this License preserves for the
author and publisher a way to get credit for their work, while not being
considered responsible for modifications made by others.

This License is a kind of "copyleft", which means that derivative works of
the document must themselves be free in the same sense. It complements the
GNU General Public License, which is a copyleft license designed for free
software.

We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free program
should come with manuals providing the same freedoms that the software does.
But this License is not limited to software manuals; it can be used for any
textual work, regardless of subject matter or whether it is published as a
printed book. We recommend this License principally for works whose purpose
is instruction or reference.

1. APPLICABILITY AND DEFINITIONS

This License applies to any manual or other work that contains a notice
placed by the copyright holder saying it can be distributed under the terms
of this License. The "Document", below, refers to any such manual or work.
Any member of the public is a licensee, and is addressed as "you".

A "Modified Version" of the Document means any work containing the Document
or a portion of it, either copied verbatim, or with modifications and/or
translated into another language.

A "Secondary Section" is a named appendix or a front-matter section of the
Document that deals exclusively with the relationship of the publishers or
authors of the Document to the Document's overall subject (or to related
matters) and contains nothing that could fall directly within that overall
subject. (For example, if the Document is in part a textbook of mathematics,
a Secondary Section may not explain any mathematics.) The relationship could
be a matter of historical connection with the subject or with related
matters, or of legal, commercial, philosophical, ethical or political
position regarding them.

The "Invariant Sections" are certain Secondary Sections whose titles are
designated, as being those of Invariant Sections, in the notice that says
that the Document is released under this License.

The "Cover Texts" are certain short passages of text that are listed, as
Front-Cover Texts or Back-Cover Texts, in the notice that says that the
Document is released under this License.

A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the general
public, whose contents can be viewed and edited directly and
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or for
automatic translation to a variety of formats suitable for input to text
formatters. A copy made in an otherwise Transparent file format whose markup
has been designed to thwart or discourage subsequent modification by readers
is not Transparent. A copy that is not "Transparent" is called "Opaque".

Examples of suitable formats for Transparent copies include plain ASCII
without markup, Texinfo input format, LaTeX input format, SGML or XML using
a publicly available DTD, and standard-conforming simple HTML designed for
human modification. Opaque formats include PostScript, PDF, proprietary
formats that can be read and edited only by proprietary word processors,
SGML or XML for which the DTD and/or processing tools are not generally
available, and the machine-generated HTML produced by some word processors
for output purposes only.

The "Title Page" means, for a printed book, the title page itself, plus such
following pages as are needed to hold, legibly, the material this License
requires to appear in the title page. For works in formats which do not have
any title page as such, "Title Page" means the text near the most prominent
appearance of the work's title, preceding the beginning of the body of the
text.

2. VERBATIM COPYING

You may copy and distribute the Document in any medium, either commercially
or noncommercially, provided that this License, the copyright notices, and
the license notice saying this License applies to the Document are
reproduced in all copies, and that you add no other conditions whatsoever to
those of this License. You may not use technical measures to obstruct or
control the reading or further copying of the copies you make or distribute.
However, you may accept compensation in exchange for copies. If you
distribute a large enough number of copies you must also follow the
conditions in section 3.

You may also lend copies, under the same conditions stated above, and you
may publicly display copies.

3. COPYING IN QUANTITY

If you publish printed copies of the Document numbering more than 100, and
the Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover Texts:
Front-Cover Texts on the front cover, and Back-Cover Texts on the back
cover. Both covers must also clearly and legibly identify you as the
publisher of these copies. The front cover must present the full title with
all words of the title equally prominent and visible. You may add other
material on the covers in addition. Copying with changes limited to the
covers, as long as they preserve the title of the Document and satisfy these
conditions, can be treated as verbatim copying in other respects.

If the required texts for either cover are too voluminous to fit legibly,
you should put the first ones listed (as many as fit reasonably) on the
actual cover, and continue the rest onto adjacent pages.

If you publish or distribute Opaque copies of the Document numbering more
than 100, you must either include a machine-readable Transparent copy along
with each Opaque copy, or state in or with each Opaque copy a
publicly-accessible computer-network location containing a complete
Transparent copy of the Document, free of added material, which the general
network-using public has access to download anonymously at no charge using
public-standard network protocols. If you use the latter option, you must
take reasonably prudent steps, when you begin distribution of Opaque copies
in quantity, to ensure that this Transparent copy will remain thus
accessible at the stated location until at least one year after the last
time you distribute an Opaque copy (directly or through your agents or
retailers) of that edition to the public.

It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give them
a chance to provide you with an updated version of the Document.

4. MODIFICATIONS

You may copy and distribute a Modified Version of the Document under the
conditions of sections 2 and 3 above, provided that you release the Modified
Version under precisely this License, with the Modified Version filling the
role of the Document, thus licensing distribution and modification of the
Modified Version to whoever possesses a copy of it. In addition, you must do
these things in the Modified Version:

   * A. Use in the Title Page (and on the covers, if any) a title distinct
     from that of the Document, and from those of previous versions (which
     should, if there were any, be listed in the History section of the
     Document). You may use the same title as a previous version if the
     original publisher of that version gives permission.
   * B. List on the Title Page, as authors, one or more persons or entities
     responsible for authorship of the modifications in the Modified
     Version, together with at least five of the principal authors of the
     Document (all of its principal authors, if it has less than five).
   * C. State on the Title page the name of the publisher of the Modified
     Version, as the publisher.
   * D. Preserve all the copyright notices of the Document.
   * E. Add an appropriate copyright notice for your modifications adjacent
     to the other copyright notices.
   * F. Include, immediately after the copyright notices, a license notice
     giving the public permission to use the Modified Version under the
     terms of this License, in the form shown in the Addendum below.
   * G. Preserve in that license notice the full lists of Invariant Sections
     and required Cover Texts given in the Document's license notice.
   * H. Include an unaltered copy of this License.
   * I. Preserve the section entitled "History", and its title, and add to
     it an item stating at least the title, year, new authors, and publisher
     of the Modified Version as given on the Title Page. If there is no
     section entitled "History" in the Document, create one stating the
     title, year, authors, and publisher of the Document as given on its
     Title Page, then add an item describing the Modified Version as stated
     in the previous sentence.
   * J. Preserve the network location, if any, given in the Document for
     public access to a Transparent copy of the Document, and likewise the
     network locations given in the Document for previous versions it was
     based on. These may be placed in the "History" section. You may omit a
     network location for a work that was published at least four years
     before the Document itself, or if the original publisher of the version
     it refers to gives permission.
   * K. In any section entitled "Acknowledgements" or "Dedications",
     preserve the section's title, and preserve in the section all the
     substance and tone of each of the contributor acknowledgements and/or
     dedications given therein.
   * L. Preserve all the Invariant Sections of the Document, unaltered in
     their text and in their titles. Section numbers or the equivalent are
     not considered part of the section titles.
   * M. Delete any section entitled "Endorsements". Such a section may not
     be included in the Modified Version.
   * N. Do not retitle any existing section as "Endorsements" or to conflict
     in title with any Invariant Section.

If the Modified Version includes new front-matter sections or appendices
that qualify as Secondary Sections and contain no material copied from the
Document, you may at your option designate some or all of these sections as
invariant. To do this, add their titles to the list of Invariant Sections in
the Modified Version's license notice. These titles must be distinct from
any other section titles.

You may add a section entitled "Endorsements", provided it contains nothing
but endorsements of your Modified Version by various parties--for example,
statements of peer review or that the text has been approved by an
organization as the authoritative definition of a standard.

You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list of
Cover Texts in the Modified Version. Only one passage of Front-Cover Text
and one of Back-Cover Text may be added by (or through arrangements made by)
any one entity. If the Document already includes a cover text for the same
cover, previously added by you or by arrangement made by the same entity you
are acting on behalf of, you may not add another; but you may replace the
old one, on explicit permission from the previous publisher that added the
old one.

The author(s) and publisher(s) of the Document do not by this License give
permission to use their names for publicity for or to assert or imply
endorsement of any Modified Version.

5. COMBINING DOCUMENTS

You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified versions,
provided that you include in the combination all of the Invariant Sections
of all of the original documents, unmodified, and list them all as Invariant
Sections of your combined work in its license notice.

The combined work need only contain one copy of this License, and multiple
identical Invariant Sections may be replaced with a single copy. If there
are multiple Invariant Sections with the same name but different contents,
make the title of each such section unique by adding at the end of it, in
parentheses, the name of the original author or publisher of that section if
known, or else a unique number. Make the same adjustment to the section
titles in the list of Invariant Sections in the license notice of the
combined work.

In the combination, you must combine any sections entitled "History" in the
various original documents, forming one section entitled "History"; likewise
combine any sections entitled "Acknowledgements", and any sections entitled
"Dedications". You must delete all sections entitled "Endorsements."

6. COLLECTIONS OF DOCUMENTS

You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in the
collection, provided that you follow the rules of this License for verbatim
copying of each of the documents in all other respects.

You may extract a single document from such a collection, and distribute it
individually under this License, provided you insert a copy of this License
into the extracted document, and follow this License in all other respects
regarding verbatim copying of that document.

7. AGGREGATION WITH INDEPENDENT WORKS

A compilation of the Document or its derivatives with other separate and
independent documents or works, in or on a volume of a storage or
distribution medium, does not as a whole count as a Modified Version of the
Document, provided no compilation copyright is claimed for the compilation.
Such a compilation is called an "aggregate", and this this License does not
apply to the other self-contained works thus compiled with the Document, on
account of their being thus compiled, if they are not themselves derivative
works of the Document. If the Cover Text requirement of section 3 is
applicable to these copies of the Document, then if the Document is less
than one quarter of the entire aggregate, the Document's Cover Texts may be
placed on covers that surround only the Document within the aggregate.
Otherwise they must appear on covers around the whole aggregate.

8. TRANSLATION

Translation is considered a kind of modification, so you may distribute
translations of the Document under the terms of section 4. Replacing
Invariant Sections with translations requires special permission from their
copyright holders, but you may include translations of some or all Invariant
Sections in addition to the original versions of these Invariant Sections.
You may include a translation of this License provided that you also include
the original English version of this License. In case of a disagreement
between the translation and the original English version of this License,
the original English version will prevail.

9. TERMINATION

You may not copy, modify, sublicense, or distribute the Document except as
expressly provided for under this License. Any other attempt to copy,
modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However, parties who
have received copies, or rights, from you under this License will not have
their licenses terminated so long as such parties remain in full compliance.

10. FUTURE REVISIONS OF THIS LICENSE

The Free Software Foundation may publish new, revised versions of the GNU
Free Documentation License from time to time. Such new versions will be
similar in spirit to the present version, but may differ in detail to
address new problems or concerns. See http://www.gnu.org/copyleft/.

Each version of the License is given a distinguishing version number. If the
Document specifies that a particular numbered version of this License "or
any later version" applies to it, you have the option of following the terms
and conditions either of that specified version or of any later version that
has been published (not as a draft) by the Free Software Foundation. If the
Document does not specify a version number of this License, you may choose
any version ever published (not as a draft) by the Free Software Foundation.

How to use this License for your documents

To use this License in a document you have written, include a copy of the
License in the document and put the following copyright and license notices
just after the title page:

      Copyright (c)  YEAR  YOUR NAME.
      Permission is granted to copy, distribute and/or modify this document
      under the terms of the GNU Free Documentation License, Version 1.1
      or any later version published by the Free Software Foundation;
      with the Invariant Sections being LIST THEIR TITLES, with the
      Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
      A copy of the license is included in the section entitled "GNU
      Free Documentation License".

If you have no Invariant Sections, write "with no Invariant Sections"
instead of saying which ones are invariant. If you have no Front-Cover
Texts, write "no Front-Cover Texts" instead of "Front-Cover Texts being
LIST"; likewise for Back-Cover Texts.

If your document contains nontrivial examples of program code, we recommend
releasing these examples in parallel under your choice of free software
license, such as the GNU General Public License, to permit their use in free
software.
}

\appendix
\chapter{Index}
Skip 2 pages.
\twocolumn  
%\newpage
{\tt \printindex}
\chapter{Table of contents}
Skip 2 pages
%\newpage\twocolumn
\tableofcontents
\end{document}

