next up previous contents
Next: Printing and outputing tex Up: Xcas tutorial Previous: Scripts   Contents

Programming editor

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

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

The mode buttons bar will help you enter runstream control instructions (instruction group {}, end instruction ;, newline, if test, for loop, return end of function). The ->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 myprog(a,b) := a+b; ), xcas will research in the history a similar affectation and replace it with the current one and will recompute the following history levels. The exec button can be used to run in history the current line (like for scripts). The parse button can be used to verify the syntax correctness of the program.

In the Xcas) programming style, the syntax is similar to C. The main differences are :

Be warned that the respective priorities of := and , will require using parenthesis if you affect local variables during declaration :
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
debug(function_name(arguments))
Note that this functionnality is not available under Windows. You can see variables evolution, set breakpoints, ... For example load the bezout file of the directory examples/arit and run debug(pgcd(15,25)).


next up previous contents
Next: Printing and outputing tex Up: Xcas tutorial Previous: Scripts   Contents
giac documentation written by Bernard Parisse