\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{stmaryrd}
\usepackage{makeidx}
\usepackage{times}
\usepackage{mathptmx}
%Uncomment next line for pdflatex and use includegraphics with eps file
% for latex2html don't use the option [width=\textwidth]
% check that xfig files are exported magnif 100%
\usepackage{ifpdf}
\ifpdf
 \usepackage[pdftex]{hyperref}
\fi
\usepackage[T1]{fontenc}
%\DeclareGraphicsExtensions{.pdf, .png, .mps, .eps}
\usepackage{amsmath,amsfonts,amssymb}
\newcommand{\R}{{\mathbb{R}}}
\newcommand{\C}{{\mathbb{C}}}
\newcommand{\Z}{{\mathbb{Z}}}
\newcommand{\N}{{\mathbb{N}}}
\begin{document}

\title{Xcas tutorial}
\author{Bernard Parisse\\ Institut Fourier\\CNRS UMR5582 \\ 
Université Grenoble I}

\maketitle

\begin{abstract}
This paper explains briefly the most important points of {\tt xcas},
a free computer algebra system with a graphical interface combining
2-d mathematical input/output, a spreadsheet and dynamical geometry.
\end{abstract}

\tableofcontents

\section{Introduction}
Giac is a C++ library for computer algebra system distributed
under the GPL license, Xcas groups in the same graphical user interface 
the CAS functionnalities of giac, a small spreadsheet and interactive
geometry. Both are under active development, the implemented math
functionnalities can today be used at undergraduate level. Programmation
can be done using the interpreted language available in several flavours
compatible with popular CAS (Maple, Mupad, TI89), or directly in C++
(either as a standalone program using the giac library or as dynamically
linked libraries to be loaded at runtime in an xcas session).
In xcas, you can display several views of a same object, e.g.
for a geometrical point, the point in a figure and it's coordinates
in the computation screen.
{\tt xcas} outputs \LaTeX\ files, it is therefore easy to
insert figures or function graphs inside your own \LaTeX\ files. \\
%\includegraphics[width=\textwidth]{xcas9en.png}
\includegraphics[width=\textwidth]{xcas9en}

\section{Installation.} \label{sec:install}
See the homepage for detailled instructions~:\\
\verb|http://www-fourier.ujf-grenoble.fr/~parisse/giac.html|\\
I provide a Windows self-extracting executable, a Mac OS X disk image
or packages for Gnu/Debian Linux, Mandrake or RedHat Linux or
Linux binaries (for Intel ix86 or ARM). 

\subsection{Windows installation}
Get~:\\
\verb|ftp://ftp-fourier.ujf-grenoble.fr/xcas/xcaszip.exe|\\
double-click on the file, this launch the self-extracting archive,
it will propose to unarchive {\tt xcas}
in the same directory as the file {\tt xcaszip.exe}.
Do not accept this choice, put instead
\verb|C:\| so that {\tt xcas} will be unzipped in the directory
\verb|C:\xcas|. If you unzip 
{\tt xcas} in another directory, you will have to modify the files
\verb|xcasen.bat| and \verb|runxcas.en| to reflect the correct paths
(see below).
You can make a global install by adding the xcas directory to the
\verb|PATH| variable.
For example, if you have unzipped {\tt xcas} on the harddisk \verb|D:|
directory {\tt Maths}\\
\verb|xcasen.bat: set PATH=%PATH%;d:\Maths\xcas|\\
\verb|runxcas.en: export XCAS_ROOT=/cygdrive/d/Maths/xcas|\\

For printing purpose, it is recommended to install
\LaTeX, see e.g. \verb|http://www.fptex.org/|. The current version
of {\tt xcas} has only minimal standalone printing functionnality.

HTML Online help will be displayed on Windows NT or 2000 or XP using
Internet Explorer, you can modify the browser by adding the line
\verb|export BROWSER=browser_command_name| in the {\tt runxcas.en} file.

\subsection{Xcas under MacOSX}
Get~\\
\verb|ftp://ftp-fourier.ujf-grenoble.fr/xcas/xcas_image.dmg.gz|\\
It should uncompress itself, and the disk image should mount itself
so that an \verb|xcas| icon appears on the Finder desktop (if not, double-click
on the \verb|xcas_image.dmg| icon). Double-click on the \verb|xcas|
disk icon to open the disk, then on the \verb|xcas| program icon
to run \verb|xcas|. HTML Online help is not yet available by default (unless
you have a browser named mozilla in the path or you run {\tt xcas}
from a {\tt tcsh} shell and run a command like {\tt setenv BROWSER ...}
before running {\tt xcas}).

\subsection{Installation under Linux}
\subsubsection{Gnu/Debian}
Install the {\tt .deb} package with {\tt dpkg -i}. If additionnal
packages are required, you can use {\tt apt-get} to get them.

\subsubsection{Mandrake Linux or RedHat Linux}
Install the {\tt .rpm} package with {\tt rpm -U}.
You will probably need to install extra packages (like pari,...),
see your distribution or on the net e.g. \verb|http://rpmfind.net|.

\subsubsection{Linux binaries}
If you have root access, you can get~:\\
\verb|ftp://ftp-fourier.ujf-grenoble.fr/xcas/xcas_root.tgz|\\
save it in the \verb|/tmp| directory.
Open a terminal and type~:\\
\verb|su|\\
then the root password and the Enter key.
Now type~:\\
\verb|cd /|\\
\verb|tar xvfz /tmp/xcas_root.tgz|\\
\verb|ldconfig|\\
\verb|exit|\\
To run the program, type~:\\
\verb|xcas &|\\
If the program is not found, logout and login again and try again.
If it still does not work, add~:\\
{\tt export PATH = "\$PATH:/usr/local/bin/" } \\
in the \verb|/etc/profile| file or in your own \verb|~/.bashrc| file,
logout and login and try again. If it still does not work, become
root again ({\tt su}), open the file {\tt /etc/ld.so.conf}
with your prefered editor, add the line\\
{\tt /usr/local/lib}\\
save the file, and run again\\
{\tt ldconfig}\\

If you don't have root access, get~;\\
\verb|ftp://ftp-fourier.ujf-grenoble.fr/xcas/xcas_user.tgz|\\
save it in your home directory.
In a terminal window, type~:\\
\verb|cd ~|\\
\verb|tar xvfz xcas_user.tgz|\\
To run the program, type~:\\
\verb|./xcas &|

\subsubsection{On-line help}
On-line help is displayed using {\tt mozilla} or the browser
program named found in the environment variable {\tt BROWSER}.
To change browser, modify \verb|~/.bashrc| or the global file
{\tt /etc/profile} and add the line, e.g.~:\\
{\tt export BROWSER=konqueror}\\
(replace {\tt konqueror} above by your preferred browser).

If this does not work at next login, you are probably using the {\tt tcsh}
shell, then you must change the file \verb|~/.tcshrc| and add the line~:\\
{\tt setenv BROWSER konqueror}

\subsubsection{Printing}
You need a working \LaTeX\ installation. Take your distribution CD's
and install the \verb|tetex*| packages~:
tetex, tetex-latex, tetex-xdvi, tetex-dvips.

\subsubsection{Commandline version}
The Linux packages provide also a commandline version named \verb|giac|.
It can be used standalone or inside an emacs session 
(install \verb|mupacs| available at \\
\verb|http://mupacs.sourceforge.net|
and use \verb|giac --emacs| as session launcher instead of \verb|mupad|)
or inside a TeXmacs session ({\tt http://www.texmacs.org}).

\section{Updating {\tt xcas}}
To update {\tt xcas} (works is you installed Linux binaries or under
Windows)~:
\begin{itemize}
\item Under Linux, Windows NT, windows 2000, windows XP 
check that you have writing permission in {\tt xcas} installation
directory.
\item Open you Internet connection if needed
\item Under Windows, click on the {\tt update.bat} file in
the {\tt xcas} directory. Under Linux,
run {\tt xcas} and choose in the menu {\tt File->update xcas}.
\end{itemize}

\section{Note for Maple users.}
{\tt giac/xcas} has some Maple compatibility. 
It may be active if you answered Maple at {\tt xcas} first run
({\tt Choose initial configuration}). You can activate it
at any time in a session using \\
{\tt Edit->Preferences->Cas configuration}\\
click on {\tt Prog style} choose {\tt Maple}
then click {\tt OK}. Run {\tt File->Save config} to keep this mode
for the next sessions.

You can run simple Maple worksheet using 
{\tt File->Import session->maple worksheet}.

To run a text file with a Maple program, choose 
{\tt File->Import session->Maple text}. In Maple mode, you can also
use the \verb|read| command.

I recommend to read the section \ref{sec:premier_pas}
(First steps) below, the main differences in the interface are~:
\begin{itemize}
\item a new command is entered in 2-d mode in history or in 1-d
mode in the commandline
(see figure in section \ref{sec:premier_pas})
\item if you modify one entry in the history, all commands
will be recomputed instead of just this one
\item graphical commands output their graphical answer in
a separate window (click on the yellow geo button for 2-d graphs,
click on the yellow hist button to go back to history). 
The graphic window is not erased
between graphical commands (that's mandatory for dynamical geometry).
Use the {\tt erase} button and validate to erase the 2-d plot. Maple-like plot
commands will insert a line in the history that tells {\tt xcas}  
to print the plot when asked. Geometry commands will not make a print
(you must use the {\tt graph2tex()} command to print a geometry figure).
\item \% is understood, but not \%\% or \%\%\%, please use 
{\tt ans(-2)} or {\tt ans(-3)} instead.
\item The {\tt print} instruction does not output in the interactive
history window but in the io (input/output) window. Use the {\tt io}
or {\tt ia} button to switch from interactive to input/output mode in
the history or geometry window.
The history prints
the return value of a program (following {\tt RETURN} or last evaluation). 
This way return value and printed value are not confused.
\item Some commands of maple are not yet implemented, some other
will not return exactly the same answers, and a few require modifications
in the way arguments are entered (e.g. {\tt sum} arguments should not
be quoted). Some valid maple identifiers are reserved word in {\tt xcas}
(e.g. {\tt base}, {\tt list}) or may not be unprotected yet.
\end{itemize}

\section{Note for TI89/TI92/TI Voyage 200 users.}
{\tt xcas} has a compatibility mode with TI graphing calculators. 
It may be active if you choosed TI89 at {\tt xcas} first run
({\tt Choose initial configuration}). You can activate it
at any time in a session using \\
{\tt Edit->Preferences->Cas configuration}\\
click on {\tt Prog style} choose {\tt TI89}
then click {\tt OK}.

You can load programs for TI89/TI92/Voyage 200
in grouped archive format (file ending
with {\tt .89g} or {\tt .92g}), or program/function format 
({\tt .89f}, {\tt .92f}, {\tt .89p}, {\tt .92p}), or text format.
If you are copying a program in a book, use a text editor (like
Wordpad, Notepad, Ultraedit, emacs, vi, nedit) and copy the
text verbatim including the {\tt :} at the line begin.

Please read section \ref{sec:premier_pas} below, {\tt xcas} interface
is slightly different from a TI calculator, especially for
graphical commands.

\pagebreak

\section{First steps} \label{sec:premier_pas}
To run {\tt xcas} under Unix, open a terminal and type ~:\\
\verb|xcas &|\\
Under Windows, using the Explorer, go in the {\tt xcas} directory
and double-click on {\tt xcasen.bat}
(you can also make a shortcut).

At the first time you run {\tt xcas}, you will be asked to
choose an initial configuration between Xcas, Maple ou TI89 (it
is the preferred syntax for the programming language). If you know
Maple or the TI89 choose the corresponding mode, if you are familiar
with C/C++, choose Xcas.

You should now see a window like one the figure below
(click on the {\tt kbd} button 
--the third button from the right at the bottom-- to
switch on or switch off the keyboard)~:\\
\includegraphics[width=\textwidth]{xcas_tut0bisen}\\
\includegraphics[width=\textwidth]{xcas0en}\\
The window is divided in the following areas~:
\begin{itemize}
\item menu bar
\item depending on mode, equation editor (eqw), 
graphic window (geo), on-line help (help),
history (hist), messages (msg),
programming editor (prg), spreadsheet and matrix editor (mtrw), 
debugger. Up to 3 views can be seen simultaneously
(menu Edit->Windows->1/2/3 Windows).
\item a button bar (depending on the current mode)
\item a file status bar or a button bar similar to HP and Casio calculators 
menu-system, and a yellow buttons bar to switch mode
\item the commandline
\item status line and buttons to change xcas status
\item message line (click on the yellow msg button to see long messages)
\item depending on the configuration, the calculator scientific, numeric
keyboard and direction pad. 
\end{itemize}
In a typical session, you enter commands in the commandline or
directly in the history, using the online help and
editors (eqw, mtrw, prog) if needed.

For example, to compute {\tt 1234*5678}, type in the commandline
{\tt 1234*5678} then {\tt Enter}. This is the same input method
as in popular CAS.

The software commands are grouped by themes in the menu bar.
For example, to factor an integer, go in the menu {\tt Alg}, 
submenu {\tt Integers}, item {\tt ifactor}. 
The message line shows a brief explanation of what the command
does. The online help can be invoked (yellow button help)
to see some examples (that you can modify and paste in
the command line), or related commands. 
The global index of {\tt xcas} commands is at the left. Under Windows
and Linux, you can also find a word in all HTML help files using the menu 
(Help->Find word in HTML help)\\
%\includegraphics[width=\textwidth]{xcas1en.png}
\includegraphics[width=\textwidth]{xcas1en}\\
You can also type a command directly in the commandline or history
if you know the commandname, and using the tabulation 
key\footnote{Completion does not work under Mac OS X} at the
right of the Q key on a US keyboard (or clicking
on the completion key) you will get the possible
completions of uncomplete commands.

If you don't see
the upper part of the ``bandeau'', you can activate it using
the menu {\tt Edit -> Preferences -> Cas} or the red cas button.
The upper part of the ``bandeau'' groups commands like in the menu-bar, but
the commands are shown in a persistent manner, which is very useful
if you invoke several times the same command. It does not show
on-line help, it is for more advanced users and is not activated
by default. 

The equation editor ({\tt eqw}) is used to enter or manipulate equations in
2-d mode, you don't need to use parenthesis in this mode. It
is also the input mode of the history.

The graphic mode ({\tt geo}) is used to display graph of functions or
geometry figures.

The spreadsheet ({\tt mtrw})
is somewhat minimal compared to a usual spreadsheet,
but it is a CAS spreadsheet, a cell can be any expression, including
user-defined functions. It can be used for example to show
table of values of a function or of a sequence defined by recurrence.
It may also be used to edit matrices (with simple entries,
for complex algebraic entries, the equation editor may be more
useful).

The programming editor ({\tt prg}) may be used to enter small program using 
{\tt xcas} programming language (it is not yet available under Mac OS X). 
For more complex
programs, a ``true'' editor like {\tt emacs}, {\tt vi} or 
{\tt nedit} should be used, and the file should be loaded using
the {\tt read} command in the commandline. For very simple programs, you
can also enter them directly in the commandline or in the 2-d
history.
It is possible to execute a program step by step using the
debugger, and see how variables content change, making error
fix much easier. 

\section{The equation writer}
To run it, choose in the menu bar Edit->Windows->Equation
or click on the yellow {\tt eqw} button. Press the yellow {\tt hist}
key to go back to the history.
You can also select an expression 
in the history and click on the blue {\tt ->eqw} button.\\
%\includegraphics[width=\textwidth]{xcas2en.png}
\includegraphics[width=\textwidth]{xcas2en}

In this mode, expressions are stored as graph with operator
as nodes, and arguments as end vertices.
To modify an argument, click on it, modify and type the up
arrow or click somewhere else. You can modify an expression
by selecting it, this will copy it to the commandline,
modify the commandline and type Enter to replace the
selection by the commandline. Note that in selection mode,
the direction keys change the selection according to the move
in the graph of the expression.
It is also possible to~:
\begin{itemize} 
\item exchange the selection to the left or right (see the mode button bar),
if it is the argument of a sum or a product 
\item apply an operator to the selection (for example
click on {\tt eval} to evaluate a subexpression in place,
or select {\tt simplify} in the menu to simplify the
selection, or {\tt factor} to factor the selection, etc.).
This is very useful to rewrite an expression.
\item remove a unary operator at the top of the selection
by typing on the {\tt backspace} key
\item if the cursor is active, pressing the {\tt "} key switches
from the expression to the string representing the expression.
\end{itemize}
If you want to copy a subexpression elsewhere, select it, then click
on {\tt copy} in the mode buttons bar, select where you want to copy,
and click on {\tt paste}.

To leave this mode, you can click on {\tt ->cmd} (copies the whole
expression in commandline) or shift {\tt ->cmd} 
(copies only the selection). Of course you can also click on
a yellow button of the bandeau.

Example~: enter {\tt eqw}, type \verb|x| then up arrow, then
\verb|^|, then \verb|100|, up arrow, up arrow again to select the whole
expression ($x^100$), then \verb|-| then 1, then up arrow
twice to select $x^100-1$
(remark~: you can also enter directly \verb|x^100-1|
and up arrow, the method above was shown because for more
complex expressions it is less error prone).
Select {\tt factor} in the {\tt Cas} menu, then down arrow, 
right arrow, etc. to move the selection.
Select $x^2+1$ with the arrow keys or with the mouse, 
click on \verb|^|
then \verb|2| then up arrow twice.

Remark~: you can edit the history entries in the same manner. 
Note that when you press Enter, all changes are activated and xcas will
recompute all answers (starting from the first modification).
If you press Esc, all changes are cancelled.

\section{Geometry and graphics}
This mode is activated automatically when you enter a command
that has a graphical output. You can activate it with the yellow
{\tt geo} button (click on the yellow {\tt hist}
key to go back to the history).\\
%\includegraphics[width=\textwidth]{xcas3en.png}
\includegraphics[width=\textwidth]{xcas3en}\\
In this mode you can interact with the history but graphically,
e.g. add or move a point. It is also possible to define scalar
parameters, then add objects depending on this parameters and
move the parameter dynamically to see the effect on the graphical objects.
You can define the window parameters using the red configuration {\tt geo}
button or sometimes directly for example for zooming.

\subsection{Geometry constructions}
A mouse click will draw a point and add it in the history.
To draw a segment, push the mouse at the first vertex, move
it and release it at the second vertex.
To move a point (and all constructions depending on this point)
click on the point, then push the mouse again on the point and
move it, release it at the new position. To cancel a move,
release the mouse outside of the graphic area.

Example~:\\
Push one mouse button, move the mouse, release the button,
you have drawn a segment~: the system will define in the
history 2 points ({\tt A} and {\tt B}) and the command
to draw a segment between these 2 points. Do it again from
one of the two points, the system recognize that you pointed
from one known point. It is therefore easy to draw a triangle,
draw the last segment. Know click on $A$, and move $A$
with the mouse, the figure should follow.

Other constructions (e.g. circles, conics, special triangles, ...)
are made using commands that are in the \verb|Geo| menu.

\subsection{Parameters.}  \label{sec:quad_explorer}
The right part of the geometric view is the parameter area, just below
the current mouse coordinates
(\verb|x:|,\verb|y:|, note that if the coordinates do not
appear, you can resynchronize the mouse with the coordinate
system by clicking in the parameter area). Each parameter has
a range value drawn as an horizontal segment and a current value
drawn as a vertical segment. Click on the horizontal segment
to change the parameter value (you can also drag to move
the current value). Parameters are defined in the command line
using the {\tt element} command (in the \verb|Geo| menu).
For example~:\\
\verb|a:=element(-2..2,1)|\\
\verb|b:=element(-3..3)|\\
\verb|c:=element(-1..1)|\\
\verb|plotfunc(a*x^2+b*x+c)|\\
Now move \verb|a|, \verb|b| and \verb|c| and see the effect
on the parabola $y=ax^2+bx+c$.

\subsection{Graphic windows configuration} \label{sec:config_graph}
To zoom or move the window, use the mode button bar.
You can also zoom by clicking on the {\tt io} button,
the coordinates of the mouse are now on a green background,
then push the mouse, move it and release it at the other
rectangle vertex, this defines the new zoomed window.

And of course, the red {\tt geo} button lets you configure
completely the graphic window~:\\
%\includegraphics[width=\textwidth]{xcas8en.png}
\includegraphics[width=\textwidth]{xcas8en} 

\section{The spreadsheet}
Click on the yellow {\tt mtrw} button to activate the 
spreadsheet/matrixwriter (click on the yellow {\tt hist}
key to go back to the history).\\
%\includegraphics[width=\textwidth]{xcas4en.png}
\includegraphics[width=\textwidth]{xcas4en}

Cell formula are similar to popular spreasheet. Use a letter
for the column, a number for the row, the \$ sign before a
row/column indicates an absolute reference, the {\tt =} sign
at the beginning of the cell indicates a formula. For an area
of cells, write the reference to the up, left cell,
then  {\tt :} then the reference to the down right cell
for example {\tt =mean(A1:B4)} will compute the mean of the
cells rows 1 to 4, columns A and B.

Using the {\tt table} and {\tt tableseq} of the {\tt Edit->Spreadsheet}
 menu, it is easy to make table values of functions or sequences.

You can select a submatrix with the mouse and copy it elsewhere. 
It is also possible to extract more complex submatrices
using the input area in the mode button bar, for example {\tt B3:B7,D,E}.
The menu bar in the middle may be used to do statistics on the selection.

\section{Scripts}
It is often interesting to execute several times the same sequence
of commands. For example, you make a geometry construction or
you fill certain variables with values before making a computation.
For demonstration purpose, you want to execute each command
separately (and not all at once like with Run file), 
but you do not want to enter them again and again.
This is the purpose of Load script in the File menu.
Make a text file with all your commands (e.g. by saving your session),
then run File->Load script, this will enable 2 views, the first one
is the equation writer with your script and its first line selected.
Use the yellow button to select the appropriate second view (for
example geo for a geometric construction).
Now click on the {\tt exec} button in the mode button bar of the
eqw, this runs this command and move the selection to the next
command.

\section{Programming editor}
Click on the yellow {\tt prg} button (click on the yellow {\tt hist}
button to go back to the history).
You can now type the text of a small program\\
%\includegraphics[width=\textwidth]{xcas5en.png}
\includegraphics[width=\textwidth]{xcas5en}

For larger programs, using a true editor like emacs, vi, nedit, ...
in combination with the {\tt read} command is recommended.

The mode buttons bar will help you enter runstream control instructions
(instruction group \verb|{}|,  end instruction \verb|;|, newline, 
\verb|if| test, \verb|for| loop, \verb|return| end of function).
The \verb|->cmd| button leaves the programming editor and
copies the program in the commandline, type Enter to put
it in the history.
If your program begins by an affectation instruction (example 
{\tt myprog(a,b) := a+b; }), {\tt xcas} will research in the
history a similar affectation and replace it with the current
one and will recompute the following history levels.
The \verb|exec| button can be used to run in history the
current line (like for scripts). The \verb|parse| button
can be used to verify the syntax correctness of the program.

In the {\tt Xcas}) programming style, the syntax is similar to C.
The main differences are~:
\begin{itemize}
\item variables are not typed, by default they are global
unless you declare them as local using {\tt local } followed
by their names at the beginning of the function definition.
\item affectation is done by {\tt :=}, ({\tt =} is used for
equations)
\item the fonction declaration syntax looks like\\
\verb|f(x,y):={ local z; instructions; }|. 
\end{itemize}

Be warned that the respective priorities of {\tt :=} and {\tt ,} 
will require using parenthesis if you affect local variables
during declaration~:\\  
\verb|f(x,y):={ local (z:=0),v,w; ... }|. 

If you choosed Maple, Mupad or TI89/92 syntax in the red cas configuration
screen, please refer to these software programming syntax. Note
that this choice will affect all the software, for example
$\sqrt{-1}=I$ in Maple/Mupad mode and $\sqrt{-1}=i$ in xcas mode.

If your program does not behave like you think, you can execute
it step by step (under Linux and Mac OS X) using the command\\
\verb|debug(function_name(arguments))|\\
Note that this functionnality is not available under Windows.
You can see variables evolution, set breakpoints, ...
For example load the \verb|bezout| file of the directory
{\tt examples/arit} and run \verb|debug(pgcd(15,25))|. 

\section{Printing and outputing {\tt tex} file.}
You need a \LaTeX\ install to print {\tt xcas} history.
To print a geometry construction, you need to insert a
{\tt graph2tex()} (or {\tt graph3d2tex() for a 3-d figure}
in the history at the place where you
want to print it. Plots are automatically printed if the commandname
begins with {\tt plot}.
To print a sheet, press the {\tt ok} button in the mtrw mode button bar
then {\tt enter}. 

When you do a preview in the {\tt File->Print} menu, this will
generate a file of extension {\tt .tex} with the same basename
as the session basename (by default {\tt session.tex}).
This file can be used standalone, or you can extract parts
and put them in another {\tt tex} file. 
When you leave {\tt xcas}, the file {\tt session.tex}
contains a \LaTeX\ translation of the whole history.

\section{Configuration}
You can modify the configuration of the software using the 3 red
buttons near the status line, or from the menu {\tt Edit->Preferences}.
The graph configuration screen has been presented in section
\ref{sec:config_graph}, the cas configuration screen looks like\\
%\includegraphics[width=\textwidth]{xcas6en.png}
\includegraphics[width=\textwidth]{xcas6en} \\
and the general configuration screen looks like \\
%\includegraphics[width=\textwidth]{xcas7en.png}
\includegraphics[width=\textwidth]{xcas7en} 

There are also commands to change the configurations, like\\
{\tt epsilon:=1e-10}\\

The current session configuration can be saved using the File menu.
It will be used for the next session. The configuration is
saved in the file \verb|~/.xcasrc| (or \verb|xcas.rc|
under Windows), it can be edited with any text editor.

\section{Some xcas commands, with their Maple/Mupad equivalent}
If possible, we have choosen to give the same commandname for the
three systems. Note that there might be sometimes a simpler syntax for one
of the systems. If there is no common name, the order given is
{\bf Mupad/Maple/xcas}.

\subsection{Scalar commands} \label{sec:scalaires}
In these examples, {\tt f} is an expression 
(e.g. {\tt f:=$x^2$-1;}), not a function ({\tt f:=x->$x^2$-1}).
\begin{itemize}
\item {\tt binomial(n,k)} (${n\choose k}=C_n^k={n!\over k!(n-k)!}$),
%\item {\tt combine(f)} (Maple) regroupe les termes d'une expression $f$,
\item {\tt diff(f,x)} (derive $f$ with respect to $x$),
\item {\tt diff(f,x\$ k)}
(derive $f$ $k$ times ($0<k$ an integer) with respect to $x$),
\item {\tt DIGITS:=k: float(f)}/ Maple: {\tt Digits:=k; evalf(f);}/ both
(numeric evaluation of $f$ with $k$ digits)
\item {\tt eval(f)}: evaluate $f$
\item {\tt expand(f)} (expand $f$), 
\item {\tt factor(f)} (factorize $f$),
\item {\tt 300!} (factorial of $n$),
\item {\tt float(hold(solve)(f=0,x))}/ {\tt fsolve(f=0,x)}/{\tt fsolve(f=0,x)}\\
(find a numerical solution of $f=0$ with respect to the $x$ variable)
\item {\tt float(f)} /{\tt evalf(f)}/both\\
(numeric evaluation of $f$ using double precision)
\item {\tt ifactor(n)} (factorize an integer $n$), 
\item {\tt int(f,x)} (antiderivative of $f$ with respect to $x$)
\item {\tt int(f,x=a..b)} (integral of $f$ from $a$ to $b$),
\item {\tt limit(f,x=a)} (limit of $f$ as $x\longrightarrow a$),
\item {\tt mod} ({\tt a mod n} remainder of the euclidean integer division
of $a$ by $n$,
\item {\tt normal(f)} (write $f$ as an irreducible rational fraction)
\item {\tt plotfunc2d(f,x=a..b)} /{\tt plot(f,x=a..b)}/ bothe\\
(graph $(x,f)$ for $x\in [a,b]$, $f$ is an expression depending on $x$)
\item {\tt 'f'}/{\tt hold(f)}/both:\\ do not evaluate {\tt f}.
\item {\tt reset}/{\tt restart}/{\tt restart}\\
restart the session (clear all variables)
\item {\tt series(f,x=a,k)} (series expansion of $f$ at $x=a$ order $k$)
\item {\tt simplify(f)} (try to simplify $f$),
\item {\tt solve(f=0,x)} (find $x$ solutions of $f(x)=0$), 
\item Mupad: {\tt solve(ode(diff(y(x),x\$ 2)+y(x)=0,y(x))))}/\\
Maple: {\tt dsolve(diff(y(x),x\$ 2)+y(x)=0,y(x))}/\\
xcas: {\tt desolve(y''+y=0,y)}\\
(find the general solution of the differential equation $y''+y=0$),
\item {\tt subs(f,x=a)}/{\tt subs(x=a,f)} / both (depending on xcas mode) or
{\tt subst(f,x=a)} :
(replace $x$ by $a$ in $f$), 
\item {\tt sum(f,n=a..b)}:
compute $\sum_{n=a}^b f(n)$ for $a,b$ integers or $\pm \infty$
\end{itemize}

\subsection{Linear algebra.} \label{sec:linalg}
Warning, in Mupad and Maple, you must activate the linalg package
commands by {\tt export(linalg)} (Mupad) or {\tt with(linalg);} (Maple).
\begin{itemize}
\item {\tt A[j,k]}: element row $j$, column $k$ of
the matrix $A$. xcas accepts also the C notation {\tt A[j][k]}
\item {\tt A+B}/{\tt evalm(A\&+B)} or {\tt add(A,B)} /{\tt A+B}\\
(addition of matrices or vectors),
\item {\tt 1/A}/{\tt inverse(A)}/both
(inverse of an invertible matrix $A$),
\item {\tt A*B}/{\tt evalm(A\&*B)} or {\tt multiply(A,B)} /{\tt A*B}\\
(multiplication of 2 matrices),
\item {\tt f*A}/{\tt scalarmul(A,f)} / {\tt f*A}\\
(multiplication of the matrix or vector $A$ by the expression
$f$),
\item {\tt charpoly(A,x)} \\
(determinant of $x{\rm Id}-A$ (characteristic polynomial))
\item {\tt det(A)}\\ (determinant of a matrice $A$),
\item {\tt eigenvalues(A)}/{\tt eigenvals(A)} / both\\
(eigenvalues of the matrix $A$. If you want numerical eigenvalues,
(assuming $A$ has only numeric values), write at least one of the coefficient
of $A$ as a real or complex number (with a \verb|.|, e.g. \verb|5.0| instead
of 5).
\item {\tt eigenvectors(A)}/{\tt eigenvects(A)}/both\\
(eigenvectors of $A$, see above if you want a numeric answer)
\item {\tt A=B}/{\tt equal(A,B)}/both: equality testfor matrices
\item {\tt matlinsolve(A,b)}/{\tt linsolve(A,b)}/{\tt linsolve(A,b)}
(solve the linear equation $Ax=b$, $A$ a matrix and $b$ a vector)
\item {\tt matrix()} (create a matrix):\\
{\tt matrix(2,2,[[5,4],[6,3]])}\\
{\tt f:=(j,k)->(1/(j+k-1));matrix(2,2,f)}\\
\verb|Dom::Matrix()([[5,4],[6,3]])|/{\tt matrix([[5,4],[6,3]])}//{\tt [[5,4],[6,3]]}, \\
\item {\tt ncols(A)}/{\tt coldim(A)}/both\\
number of columns
\item {\tt nrows(A)}/{\tt rowdim(A)}/both\\ 
number of lines
\item {\tt scalarProduct(A,B)}/{\tt dotprod(A,B)}/both\\ 
(scalar product of the 2 vectors $A$ and $B$),
\item {\tt trace}/{\tt tr}/{\tt trace}: trace of a matrix
\item {\tt transpose(A)} (transposed of $A$)
\item Creating a vector~: it's a $n \times 1$ matrix (or maybe
a line matrix $1 \times n$). \\
Examples~:\\
{\tt matrix(3,1,[[1],[2],[3]])}\\
\verb|Dom::Matrix()([1,2,3])|/{\tt vector([1,2,3])}/{\tt [1,2,3]}.
\end{itemize}

To run a command on all component of a vector or a matrix, the {\tt map}
command is used, e.g.\\
\verb|map(A,normal)|\\
runs the \verb|normal| command on all components of $A$.

\subsection{A few examples}
\begin{itemize}
\item \verb|ifactor(2^128+1)| (works on version using PARI)
\item \verb|factor(x^100+x^50+1)|
\item {\tt inv(hilbert(30))}
\item {\tt [P,J]:=jordan([[-2,-2,1],[-2,1,-2],[1,-2,-2]])} 
check with {\tt P*J*inv(P)}
\item \verb|int(x*sin(x)^2*exp(x),x)|, derive, rewrite as the original 
expression
\item \verb|int((2*x^2+1)*exp(x^2),x)| (Risch algorithm)
\item \verb|int(1/(x^4+1),x,0,+infinity)| (bounds) + call to simplify
\item {\tt desolve(y''+y=sin(x))} 
\item {\tt series(sin(x)/(exp(x)-1),x=0,6)}
\item The {\tt check} subdirectory of the {\tt giac} source code
contains several other examples.
\end{itemize}

\end{document}

\section{Conteneurs}
C'est un type d'objet qui peut contenir d'autres objets: les principaux
conteneurs sont les listes, les séquences, les ensembles, les vecteurs
et les matrices (on utilise aussi les tableaux associatifs, c'est-à-dire
des tableaux indiciés par n'importe quelle valeur et pas forcément
par des entiers). Les éléments sont séparés
par des virgules, le type du conteneur est indiqué par des délimiteurs:
[] pour les listes, rien pour les suites et \{ \} pour les ensembles 
(attention en mode {\tt xcas}, {\tt xcas} utilise \verb|set[ ]| ou \%\{ \%\}
pour les ensembles, 
car \{ et \} servent de délimiteurs de bloc comme en C/C++). 
L'élément d'indice $k$
d'un conteneur $c$ est désigné par \verb|c[k]| (attention, {\tt xcas}
utilise l'indexage commençant en 0 en mode {\tt xcas}, comme en C/C++). Pour
un élément de matrice, on écrit \verb|m[j,k]|.

Quelques instructions:
\begin{itemize}
\item \verb|nops(m)| (ou \verb|size(m)| avec {\tt xcas})~: la taille
\item \verb|op(l)|~: transforme la liste en suite
\item \verb|[e, op(l)]|~: place {\tt e} en tête de liste
\item \verb|[op(l),e]|~: place {\tt e} en queue de liste
\item \verb|[op(l1),op(l2)]|~: concatène 2 listes
\item {\tt convert} (maple, xcas) ou {\tt coerce} (Mupad) permettent
de convertir un conteneur d'un type en un conteneur d'un autre type.
\item {\tt subsop}~: permet de remplacer un indice dans une liste
par une valeur, on peut utiliser la valeur {\tt NULL} si on veut 
supprimer l'élément ayant cet indice.
\end{itemize}


\subsection{Programmation.} \label{sec:controle}
Les programmes sont des fichiers texte qui sont lus pendant une session
par la commande \verb|read| avec comme argument le nom du fichier
texte entre guillements. Par convention, on utilisera un nom se terminant
par \verb|.mu| pour un programme MuPAD, \verb|.map| pour un programme
Maple\footnote{Attention, les fichiers de type session Maple {\tt .mws}
sont différents des fichiers programme Maple, {\tt xcas} permet
d'effectuer la conversion {\tt .mws} vers {\tt .map} par {\tt read}},
et \verb|.cxx| pour xcas.
Par exemple \verb|essai.mu| pour un programme \verb|MuPAD|.

Voici sur quelques exemples les principales instructions de contrôle. Notez
que \verb|xcas| accepte aussi la syntaxe Maple ou Mupad ou TI89/92
\footnote{attention
toutefois en mode xcas, les tableaux commencent à l'indice 0 et on
ne peut pas utiliser $i=\sqrt{-1}$ comme variable.}
\begin{itemize}
\item en-tête de fonction et création de variables locales~:\\
\verb|f:= proc(x) local n; begin n:= 2; n*x end_proc| (mupad)\\
\verb|f:= proc(x) local n; n:= 2; n*x end;| (maple)\\
\verb|f(x):={ local n; n:=2; return(n*x); }| (xcas)\\
\verb|:f(x):Func:Local n:  2 => n:  Return n*x:EndFunc| (TI89)
\item faire un test: \\
\verb|if x2>x1 then m:=x2; else m:=x1; end_if;| (mupad)\\
\verb|if x2>x1 then m:=x2; else m:=x1; fi;| (maple)\\
\verb|if (x2>x1) { m:=x2; } else { m:=x1; }| (xcas)\\
\verb|:If x2>x1 Then: x2 => m :Else : x1 => m :EndIf| (TI89)
\item boucle ind\'efinie :\\
\verb|while (x=0) do x:=x-1; end_while;| (mupad)\\
\verb|while (x=0) do x:=x-1; od;| (maple)\\
\verb|while (x=0) { x:=x-1; };| (xcas)\\
\verb|:While x=0 :x-1 => x :EndWhile| (TI89)
\item boucle d\'efinie :\\
\verb|for j from 1 to 15 do x:=j+x; end_for;| (mupad)\\
\verb|for j from 1 to 15 do x:=j+x; od;| (maple)\\
\verb|for (j:=1;j<=15;j++) { x:=j+x; }| (xcas)\\
\verb|:For j,1,15 :j+x => x :EndFor| (TI89)
\item {\tt break} permet de sortir d'une boucle, {\tt continue} passe
immédiatement à l'itération suivante.
\end{itemize}

\subsection{TP}
{\bf Utilisation interactive}
\begin{enumerate}
\item D\'eterminer la liste des diviseurs de 45768. \\
Factoriser 100!
\item D\'evelopper $(x+3)^7 \times (x-5)^6$.
\item Simplifier les expressions suivantes:
\[ \quad \sqrt{3+2\sqrt{2}},
\quad \frac{1+\sqrt{2}}{1+2\sqrt{2}}, \quad
e^{i\pi/6}, \quad 4\mbox{atan}(\frac{1}{5})-\mbox{atan}(\frac{1}{239}) \]
\item Factoriser sur $I\!\!R $ et $I\!\!\!\!C $:
\[ x^8-3x^7-25x^6+99x^5+60x^4-756x^3+1328x^2-960x+256 \]
\[ x^6-2x^3+1, \quad (-y+x)z^2-xy^2+x^2y \]
\item Calculez les int\'egrales et simplifiez le r\'esultat:
\[ \int \frac{1}{e^x-1} \ dx, \quad \int e^{x^2} \ dx,
\quad \int x\sin(x)e^{x} \ dx \]
V\'erifiez en d\'erivant les expressions obtenues.
\item D\'eterminer la valeur de:
\[\int _1^2\frac{1}{(1+x^2)^3}, \quad  \int _1^2 \frac{1}{x^3+1} \ dx,
\quad \int_0^x \frac{t}{\sqrt{1-t}} \ dt \]

\item Calculer les sommes suivantes
\[\sum_{k=1}^N k,\ \sum_{k=1}^N k^2,\ \sum_{k=1}^\infty \frac{1}{k^2}\]

\item V\'erifier que
\[ \sin(2x)-2\sin(x)\cos(x)=0\]
en passant en exponentielles complexes.

\item Calculer le d\'eveloppement de Taylor en $x=0$ \`a l'ordre 4
de:
\[ \ln(1+x+x^2),\quad
\frac{\exp(\sin(x))-1}{x+x^2} , \quad \sqrt{1+e^{x}}, \quad
\frac{\ln(1+x)}{\exp(x)-\sin(x)} \]

\item R\'esoudre le syst\`eme lin\'eaire:
\[ \left\{ \begin{array}{lllllll}
 x &+& y &+& az&=&1\\
 x & +& a y&+& z&=&2 \\
 ax & +&y &+& z&=&3 
\end{array}\right. \]

\item D\'eterminer l'inverse et le d\'eterminant de:
\[ A=\left(\begin{array}{llll}
 1 & 1 & 1 & a \\
 1 & 1 & a & 1 \\
 1 & a & 1 & 1 \\
 a & 1 & 1 & 1
\end{array}\right)\]
Diagonaliser la matrice $A$.
\end{enumerate}

\vspace{0.2cm}

{\bf Programmation de la m\'ethode de Horner}. 
\begin{enumerate}
\item
\'Ecrire un fonction évaluant un polynôme en un point,
on représente le polyn\^ome sous forme de la
liste de ces coefficients.

\item
En utilisant cette fonction, écrire une fonction qui calcule
le développement de Taylor complet d'un polynôme en un point.
\end{enumerate}

\pagebreak

\section{Installation de la librairie giac sous Linux}
Pour les programmeurs souhaitant utiliser les fonctionnalités
de calcul formel dans du code C++, le code source de la librairie
C++ giac sur laquelle l'interface {\tt xcas} est batie est
disponible à l'adresse~:\\
{\tt ftp://ftp-fourier.ujf-grenoble.fr/pub/hp48/giac.tgz}\\
La licence d'utilisation est la GPL 2.0 ou ultérieure (si vous diffusez
du code lié à {\tt giac}, ce code doit donc être diffusé sous license GPL).

Avant de configurer {\tt giac}, vous devrez d'abord compiler et
installer des librairies telle que FLTK, FLVW, GSL, etc. 
Vous pouvez récupérer des librairies statiques précompilées et les
fichiers en-tête correspondants pour Linux à l'adresse suivante:
\verb|ftp://ftp-fourier.ujf-grenoble.fr/pub/hp48/statlibs.tgz|\\
\verb|ftp://ftp-fourier.ujf-grenoble.fr/pub/hp48/headers.tgz|\\
pour les installer, logguez-vous en utilisateur \verb|root|
désarchivez les deux fichiers depuis le répertoire \verb|/usr/local|,
ajoutez dans votre fichier \verb|/etc/ld.so.conf| la ligne~:\\ 
\verb|/usr/local/lib|\\
puis tapez \verb|ldconfig|.

D\'ecompressez maintenant l'archive contentant {\tt giac}~:\\
\verb|tar xvfz giac.tgz|\\
\verb|cd giac-0.3.0|\\
compilez-le~:\\
\verb|./configure|\\
\verb|make|\\
et enfin installez-le~:\\
\verb|su|\\
tapez le mot de passe de \verb|root|, puis la touche \verb|Entree| puis~:\\
\verb|make install|\\
puis~:\\
\verb|exit|\\
pour revenir \`a la session normale
(vous pouvez lire les fichiers \verb|README| et \verb|INSTALL| pour plus
de d\'etails et changer la configuration par d\'efaut).

Remarque~: vous pouvez installer giac sous Windows de la même manière
avec le compilateur {\tt gcc} sous Windows \verb|cygwin|. Installez
\verb|cygwin| puis GMP, GSL, FLTK, FLVW puis Giac comme sous Unix (sauf
pour FLTK qui a une procédure d'installation spécifique décrite
dans son source).


\section{Programmation en C++ avec giac}
L'ensemble des fonctions et des types de {\tt giac} sont placés dans
l'espace de nom {\tt giac}. Un source C++ utilisant {\tt giac}
devra donc précéder les identificateurs et fonctions de \verb|giac::|
ou doit exporter l'espace de noms {\tt giac} par la ligne de source\\
{\tt using namespace giac;}.

\subsection{Le type {\tt gen}}
La librairie {\tt giac} utilise un type générique {\tt gen} pour représenter 
les différents types (entiers, réels, vecteurs, matrices, polynômes, etc.). 
{\tt gen} est un type {\tt struct}uré, composé d'un champ {\tt type}, dont la 
valeur détermine le type de l'objet, d'un champ {\tt subtype} qui permet
de distinguer par exemple un vecteur d'une matrice ou d'une liste lorsqu'ils
utilisent la même représentation interne (un {\tt vecteur}, c'est-à-dire
un \verb|std::vector<gen>| ici),
et d'un champ union anonyme pour la valeur de l'objet (ou un pointeur).
Les {\tt double} et les petits entiers sont représentés par des objets
immédiats, les autres types par des pointeurs sur des objets alloués 
dynamiquement (avec un compteur de référence). Pour accéder à la représentation
interne, on commence par tester que le type du {\tt gen} considéré est
bien le type prévu, puis on copie l'objet pointé. 

Exemple~:\\
{\tt gen g("[1,2]");}\\
déclare une variable {\tt g} de type {\tt gen} qui sera compilé comme
une ligne de commande contenant \verb|[1,2]|, donc {\tt g}
contiendra le vecteur {\tt [1,2]}. 
On a alors {\tt g.type==\_VECT}, et le vecteur
sous-jacent est {\tt vecteur v(*g.\_VECTptr);} (copie du vecteur)
ou {\tt vecteur \& v = *g.\_VECTptr;} (référence sans copie).
On a alors {\tt v.size()==2} et {\tt v[0]==gen(1)} et {\tt v[1]==gen(2)}.

Les noms de variables sont de type 
{\tt identificateur *g.\_IDNTptr} (si {\tt g.type==\_IDNT}). Ce type
structuré comporte un nom et peut avoir une valeur (ou une hypothèse assume)
locale ou globale. Les identificateurs de noms {\tt a} à {\tt z} sont 
prédéfinis.

Un objet symbolique est de type {\tt symbolic *g.\_SYMBptr}.
Ce type est composé d'un {\tt sommet} (de type {\tt unary\_function\_ptr})
qui est la fonction au sommet du graphe représentant l'objet symbolique
et d'une {\tt feuille} qui est l'argument de la fonction, s'il s'agit
d'une fonction non unaire, les arguments sont regroupés en un vecteur.
Les fonctions usuelles sont prédéfinies dans le système et ont comme
valeur {\tt at\_} suivi par le nom de la fonction.\\
Par exemple $\sin(x)$
est un objet symbolique de sommet {\tt at\_sin} et de feuille l'identificateur
prédéfini $x$ ({\tt x\_\_IDNT\_e}).

\subsection{Programmes et modules dynamiques.}
Vous pouvez créer des programmes dont vous définissez l'interface, ou
vous pouvez créer des fonctions qui s'ajoutent à la librairie {\tt giac}
ou à {\tt xcas} (que l'on charge pendant l'exécution avec l'instruction
{\tt insmod}). Dans le deuxième cas, on crée une librairie dynamique.

\section{Exemples en C++.}
\subsection{Programme (pgcd de 2 entiers).}
\begin{verbatim}
#include <giac/giac.h>
using namespace std;
using namespace giac;

gen pgcd(gen a,gen b){
  gen q,r;
  for (;b!=0;){
    r=irem(a,b,q);
    a=b;
    b=r;
  }
  return a;
}

int main(){
  cout << "Enter 2 integers";
  gen a,b;
  cin >> a >> b;
  cout << pgcd(a,b) << endl;
  return 0;
}
\end{verbatim}
Pour compiler ce programme (fichier \verb|pgcd.cc| du répertoire
\verb|doc/en|), tapez la commande~:\\
\verb|g++ -g pgcd.cc -lgiac -lgmp|

\subsection{Module dynamique.}
Il faut alors définir une nouvelle fonction (qui sera accessible depuis
{\tt xcas}). Ici cette fonction s'appellera {\tt pgcd} dans {\tt xcas}
(c'est le rôle de la ligne \\ \verb|const string _pgcd_s("pgcd");|).
La fonction
de calcul (de nom C++ \verb|pgcd|)
est identique à la précédente, la fonction de nom C++ \verb|_pgcd|
est la fonction appelée par {\tt xcas} avec comme argument les arguments
de la ligne de commande regroupés en un vecteur. Elle doit donc
vérifier que l'utilisateur appelle la fonction avec 2 arguments (donc
l'argument passé à \verb|_pgcd| doit être un vecteur ayant 2 arguments).

La compilation de ce fichier \verb|pgcd.cpp| (répertoire \verb|doc/en| du
source de {\tt giac}) se fait automatiquement
en l'ouvrant dans \verb|emacs| ou en recopiant la chaine qui suit
\verb|compile-command|.
Pour l'insérer dans une session {\tt xcas}, il faut taper la commande
{\tt insmod("/home/user/giac-0.2.2/doc/en/libpgcd.so")} (en supposant
que le source de {\tt giac} a été désarchivé dans le répertoire 
{\tt /home/user}).
\begin{verbatim}
// -*- mode:C++ ; compile-command: "g++ -I.. -fPIC -DPIC -g -c pgcd.cpp \
 -o pgcd.lo && ln -sf pgcd.lo pgcd.o && gcc -shared pgcd.lo -lc \
 -Wl,-soname -Wl,libpgcd.so.0 -o libpgcd.so.0.0.0 && \
 ln -sf libpgcd.so.0.0.0 libpgcd.so.0 && \
 ln -sf libpgcd.so.0.0.0 libpgcd.so" -*-
using namespace std;
#include <stdexcept>
#include <cmath>
#include <cstdlib>
#include <giac/giac.h>
#include "pgcd.h"

#ifndef NO_NAMESPACE_GIAC
namespace giac {
#endif // ndef NO_NAMESPACE_GIAC

  gen pgcd(gen a,gen b){
    gen q,r;
    for (;b!=0;){
      r=irem(a,b,q);
      a=b;
      b=r;
    }
    return a;
  }
  gen _pgcd(const gen & args){
    if ( (args.type!=_VECT) || (args._VECTptr->size()!=2))
      setsizeerr();
    vecteur &v=*args._VECTptr;
    return pgcd(v[0],v[1]);
  }
  const string _pgcd_s("pgcd");
  unary_function_unary __pgcd(&_pgcd,_pgcd_s);
  unary_function_ptr at_pgcd (&__pgcd,0,true);
  

#ifndef NO_NAMESPACE_GIAC
} // namespace giac
#endif // ndef NO_NAMESPACE_GIAC
\end{verbatim}

\section{Compl\'ements.}
Pour les programmeurs C++, le code source de {\tt giac}
contient un peu de documentation dans le fichier 
{\tt doc/en/giac\_us.texinfo} qui s'installe dans\\
{\tt /usr/local/info/giac\_us.info} (à lire avec {\tt emacs}
commande Ctrl-U Ctrl-H I suivi du chemin d'accès précédent).
Pour le reste, il faut consulter directement le code source (les
fichiers en-tête et source contiennent quelques commentaires).

\end{document}
