<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb}
%\usepackage[francais]{babel}
\usepackage{times}
\usepackage{xspace}
\usepackage{makeidx}
\usepackage{ifpdf}
\ifpdf
 \usepackage[colorlinks,pdftex]{hyperref}
\else
 \usepackage[ps2pdf,breaklinks=true,colorlinks=true,linkcolor=red,citecolor=green]{hyperref}
\fi
\newcommand{\bs}{\symbol{92}}
\newtheorem{thm}{Theorem}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{defn}[thm]{Definition}
\makeindex

% \renewcommand{\cuttingunit}{subsection} (add HEVEA after % for hacha)
\input{giac.tex}
\ifhevea
\(
\newcommand{\R}{{\mathbb{R}}}
\newcommand{\C}{{\mathbb{C}}}
\newcommand{\Z}{{\mathbb{Z}}}
\newcommand{\N}{{\mathbb{N}}}
\newcommand{\Q}{{\mathbb{Q}}}
\newcommand{\tr}{\mbox{tr\,}}
\)
\else
\newcommand{\R}{{\mathbb{R}}}
\newcommand{\C}{{\mathbb{C}}}
\newcommand{\Z}{{\mathbb{Z}}}
\newcommand{\N}{{\mathbb{N}}}
\newcommand{\Q}{{\mathbb{Q}}}
\newcommand{\tr}{\mbox{tr\,}}
\fi
%HEVEA\htmlfoot{Back to \ahref{http://www-fourier.univ-grenoble-alpes.fr/\home{parisse}/giac.html}{Giac/Xcas} homepage.}
\giacmathjax
%HEVEA\renewcommand{\footertext}{}

\begin{document}
\title{$\chi$CAS for the TI84 Plus CE}
\author{Bernard.Parisse@univ-grenoble-alpes.fr}
\date{2024}

\begin{giacjshere}


\maketitle

%{\bf Beware: work in progress: this document is adapted from the Casio KhiCAS manual. It is still in alpha stage.}

\begin{abstract}
This document explains how to run $\chi$CAS,
an (extra)-light version of the 
\ahref{https://www-fourier.univ-grenoble-alpes.fr.fr/\home{parisse}/giac.html}{Giac/Xcas} computer algebra system (CAS) for the TI84 calculator.
The app is like a second calculator, a CAS calculator, inside your TI84+CE.
\end{abstract}

A few screenshots to illustrate that $\chi$CAS is not just a CAS, but
really a second calculator~:
the shell, input of a 2d expression, result of another 
calculation displayed in 2d, \\
\includegraphics[width=7cm]{83shell1}
\includegraphics[width=7cm]{84eqw4}
\includegraphics[width=7cm]{84eqw11}\\
graph of a function (with 60\% more pixels), speed and
normal pointing to the center of the osculating circle,
a parametric curve\\
\includegraphics[width=7cm]{83plot1}
\includegraphics[width=7cm]{83plot2}
\includegraphics[width=7cm]{83plot3}\\
%example of online help, and result of running the examples\\
%\includegraphics[width=7cm]{83help1}
vector field plot\\
\includegraphics[width=7cm]{83field1}
\includegraphics[width=7cm]{83field2}\\
unit conversion and computation\\
\includegraphics[width=7cm]{84unit1}
\includegraphics[width=7cm]{84unit2}

{\em This document is interactive, you can modify and run commands by clicking
in the \framebox{ok} button or by hitting Enter.}

\tableofcontents

%\printindex

\section{Introduction}
The first time porting Xcas to the 84 was reported on the tiplanet forum, 
it was an April fool. It seemed indeed almost impossible to do
on this ez80 CPU, an evolution of the z80 created about 50 years ago.
TI itself choosed a 68000 processor for the TI92/voyage 200 CAS 
and later an arm32 processor for the ti nspire family and they recently
choosed to add a coprocessor to the 84 in order to run MicroPython.
But the expert users community of the ti84 did a wonderful job,
using and creating free software, with a huge work 
of reverse engeneering, they made
it possible to port KhiCAS. It required several months of development
on my side, but it is now a reality: KhiCAS is available on the ti84+ce.

There is however a price to pay: I had to remove a lot of functionnalities
compared to other KhiCAS ports. I tried to keep the essential features,
that should be sufficient for highschool students and probably also
later. The CPU speed is also slow compared to calculator of
other manufacturers, be prepared to wait a few seconds for every
non trivial computation, and sometimes more. But the execution
environment is safer than with other calculators: you can easily
archive sessions and programs, and a simple reset will not loose any
data on recent OSes.

\section{Installation} \label{sec:install}
KhiCAS installation is not a straightforward install like other apps
because it is not a TI app.
{\bf [Legal stuff]
Beware: the install process was checked several times, but I can
not warrant that everything will work without issues on your
calculator, therefore the author declines all responsability. 
[End of legal stuff]. \\
Please follow carefully the install process below. First of all
check your current OS version (2nd mem 1).}
If your calculator freezes during the install process, don't panic.
It is possible to restore factory defaults by pressing 2nd and del and
reset the calc while keeping 2nd and del pressed, then release 2nd and del,
press cancel and send the 
\ahref{https://tiplanet.org/forum/archives_list.php?cat=OS+ce}{same OS version} again.
Check that it is exactly the same version of your OS, smaller versions
will not install, and if you install a higher version, you will not
be able to downgrade anymore, which means more restrictions (e.g. running ASM
programs will become more complicated), and might render KhiCAS incompatible
with your calculator. {\bf Do not install OS from TI website  before
checking that it remains compatible with KhiCAS. After discussions
with TI, it has been agreed that KhiCAS would not run on the latest
OS version.}

{\bf KhiCAS install process}\\
\begin{enumerate}
\item Before beginning,
check which OS version is installed on your calc with 2nd mem 1,
on the following screen capture it is 5.3.1\\
\includegraphics{83ver1}
\includegraphics{83ver2}\\
Download the very same
\ahref{https://tiplanet.org/forum/archives_list.php?cat=OS+ce}{OS version}
from tiplanet, in case there is a problem during install and you would have
to reflash the calculator OS after 2nd-del-reset cancel.
\item Now get
\ahref{https://www-fourier.univ-grenoble-alpes.fr/\home{parisse}/ti/khicas84.zip}{$\chi$CAS
  for TI84+CE}. 
\item The current install process requires that you purge the
archive memory of your calculator, including language packages.
Therefore backup your data and applications and lang packs with
TI Connect CE.\\
Then \verb|2nd mem 7| rightarrow 3 2\\
\includegraphics{83reset1}
\includegraphics{83reset2}\\
\includegraphics{83reset3}
\includegraphics{83reset4}\\
%Removing lang packs may require additional del in 2nd mem 2 1.
\item 
Send INST, artifice and
all the files of the app folder to the calculator, in order.\\
Alternative, only valid for Windows users: 
send \ahref{https://www-fourier.univ-grenoble-alpes.fr/\home{parisse}/ti/khicas84.b84}{khicas84.b84} to the calc. \\
Alternative with \ahref{https://github.com/debrouxl/tilp_and_gfm}{TILP}
under Unix~: run the script transfert_tilp.sh
(don't use the GUI, it would send the files in reversed order).
\item Note that the install process
below will clear remaining apps and language packs.
\item 
If you have OS version strictly smaller than 5.5, you can run INST from
prgm key and skip the rest of this item.\\
If you have OS version 5.5 or greater, you must first enable ASM.
Procedure: send
\ahref{https://tiplanet.org/forum/archives_voir.php?id=168570}{CabriJr},
open Cabri from \verb|app|, type enter then F1 then down to Open,
and open \ahref{https://yvantt.github.io/arTIfiCE/}{artifice} (from
YvanTT).
This will ``jailbreak'' the calculator, restoring ASM.
Now select INST
\\
\includegraphics{83inst1}
\includegraphics{83inst2}
\includegraphics{83inst3}\\
\includegraphics{83inst4}
\includegraphics{83inst5}
\includegraphics{83inst6}\\
\includegraphics{83inst7}
\includegraphics{83inst8}
\includegraphics{83inst9}
%% \ahref{https://github.com/jacobly0/asmhook}{ASMHOOK} 
%% (from Jacob Young), and type enter. This enables running ASM programs
%% after Cabri is removed.\\
%% Type mode and check ASM is working by running ASMHOOK from prgm.\\
%% Now remove artifice from 2nd mem alpha B (AppVar) and
%% CabriJr from 2nd mem alpha A (App)~: move the selection on artifice or
%% Cabri then type Enter and confirm. Beware, keep ASMHOOK!\\
%% Now you should be able to run APPINST from prgm.
%% \item APPINST may ask you to run GarbageCollect,
%% to do so press 2nd catalog then the G key. After that, run APPINST
%% from prgm.
%% If the same error message appears, check that you removed 
%% artifice and Cabri (but not asmhook).
\item {\bf Important~}: the calc will reboot after INST is finished, 
but this is not enough, 
you must clear the RAM with 2nd mem 7 1 2 before calling KhiCAS (app key)\\
\includegraphics{83inst10}
\includegraphics{83inst11}
\includegraphics{83inst12}\\
\includegraphics{83inst13}
\includegraphics{83inst14}
\item You can now remove remaining install AppVars
(2nd mem 2 alpha B) and restore your lang pack if it's not English.
This should leave you with 128K to 256K of archive (depending on
the final configuration).
%% \item It seems KhiCAS is compatible with TI OS and other apps,
%% except with Python app. If you want to run the Python app after
%% running KhiCAS, you should do a reset by pressing the reset
%% button.
\end{enumerate}

{\bf Beware}
\begin{itemize}
\item After discussions
with TI, it has been agreed that KhiCAS would not run on the latest
OS version.\\
{\bf Do not upgrade your calculator OS from TI site.} 
If you want to upgrade your calculator OS, get a version from
\ahref{https://tiplanet.org/forum/archives_list.php?cat=OS+ce}{tiplanet}
after you have checked that
it remains compatible with $\chi$CAS on 
\ahref{https://tiplanet.org}{tiplanet} or on 
\ahref{https://www.cemetech.net/forum/}{cemetech}.
\item
{\bf CAS is not allowed at some exams in some countries}.
It is your responsability to check if CAS calculators are allowed
before
running $\chi$CAS in a test. The authors decline all responsabilities
for any misuse.\\
For example, as of 2024 November 16th, \ahref{https://satsuite.collegeboard.org/sat/what-to-bring-do/calculator-policy}{CAS are allowed at SAT tests}, 
but \ahref{https://www.act.org/content/act/en/products-and-services/the-act/test-day/calculator-policy.html}{CAS are not allowed at ACT tests}.\\
Therefore you can have KhiCAS installed on your TI84+CE for SAT (note that the CAS 
feature is {\bf not} included in Desmos calculator, 
it is only available on CAS calculators like TI Nspire CXII CAS or HP prime
and KhiCAS compatible calculators like TI84+CE, Casio fxcg50 and Numworks). 
But don't forget to remove it from your TI84+CE for ACT.
\end{itemize}

\section{First steps}
Type app and 2 to run KhiCAS. 
This opens the ``shell'' (or history) where you can write
Xcas commands. The math key will open a menu of important 
CAS commands, the most commonly CAS commands may be
retrieved with fast menus obtained by pressing the 5 keys
below the screen, these keys may be prefixed with 2nd or alpha,
according to the legend at the bottom. The application menu 
(save/restore sessions,
...) is assigned to the graph key (alpha label F5).

For example, type
\verb|1/2+1/6|
then enter, you should see the result \verb|2/3| 
displayed below.

Hint~: If you can not find a character on the calculator keyboard, press
\verb|trace| (chartab).

You can copy a level from the history of commands by hitting the
up and down arrow keys (once or more) and enter. Then you can
modify the command and run it with enter. For example, up arrow twice,
enter, replace \verb|1/6| by \verb|1/3| and hit enter.
Another example as a screenshot\\
\includegraphics[width=7cm]{84eqw8}
\includegraphics[width=7cm]{84eqw9}
\includegraphics[width=7cm]{84eqw10}

If the result of your command is an expression, like \verb|x+1|, it will be
displayed in the 2d expression editor. Type cancel to leave the expression
editor. \\
\includegraphics[width=7cm]{84eqw11}

It is recommended to store the result in a variable if you want
to reuse it later. There are two ways to store a value in a
variable
\begin{itemize}
\item right-store with \verb|=&gt;| using the
\verb|sto| key 
for example \verb|2=&gt;a| stores 2 in variable a.
Now, every time you write \verb|a| in a computation, it
will be replaced by 2.
\item left-store with \verb|:=|. 
Since it requires many keystrokes, \verb|=| (2 keystrokes: window 8
or sto del) is accepted as a synonym for
most simple commands.
\end{itemize}
Type the var key to display the current variables assigned. This
will also display the total amount of contiguous 
RAM available for computations. If this value is near 0,
you should leave KhiCAS and enter it again (this will
garbage collect the RAM available for CAS computations).
%If you begin a commandline by hitting $\rightarrow$,
%the system will automatically insert \verb|Ans=&gt;|, 
%it is therefore easy to store a result in a variable.

The most popular Xcas commands are available from fast menus
shortcuts~: Y= (F1, algebra),
window (F2, calculus) and 2nd-F1 to F5 or alpha F1 to F5 short menus,
or from the math key menu, where
there is a short online help with an example for each command.\\
Example 1~: type the window key, move to the desired item then enter
or type it's number\\
\includegraphics[width=7cm]{84eqw1}
\\
Example 2~: hit math, choose a submenu, 
e.g. \verb|Algebra|, hit enter,
move the selection to a command,  for example \verb|factor|.
Now type graph (F5) to display a short help with an example. Hit F2 or F3
to copy the example in the commandline.
You can run the example as is (enter) or modify it and run it (enter) if
you want to factor another polynomial.
If you have already entered the command in the commandline,
type the down cursor key or the key on the row above $x^2$ 
to open the catalog at
this command and F5 to get help (if available, unfortunately
there is not enough room to store help for all commands).

If you prefer entering an expression in 2-d mode, type 2nd X,T,...
For example, enter $\frac{\sin(x)}{x}$ like this: 2nd X,T,.., this will display
0 selected, type x enter, this will replace the selection by $x$,
type the sin key, this will apply sin on the selection and
display $\sin(x)$ selected, type the division key, this will
display $\frac{\sin(x)}{0}$ with 0 selected, type x enter and 
you get $\frac{\sin(x)}{x}$. Type enter when you are finished,
this will copy the expression in the commandline. Another example
in screenshots~:\\
\includegraphics[width=7cm]{84eqw2}
\includegraphics[width=7cm]{84eqw3}
\includegraphics[width=7cm]{84eqw4}\\
\includegraphics[width=7cm]{84eqw5}
\includegraphics[width=7cm]{84eqw6}
\includegraphics[width=7cm]{84eqw7}

The KhiCAS File menu (F5) has an item \verb|Clear| that will erase
the history. This will not clear the variables, to achieve that
type the \verb|var|, select the last item \verb|restart|
and confirm with enter.

Hit 2nd quit to leave $\chi$CAS.
Variables and history are saved each time you run a command with enter, 
they will be restored if you come back to $\chi$CAS.


\section{Common CAS commands}
\subsection{Expand and factor}
From math commands catalog, select \verb|Algebra|, or type 2nd-1.
\begin{itemize}
\item \verb|factor|~: factorization. Shortcut \verb|=&gt;*|
(\verb|sto| key then *),
for example \giacinputmath{x^4-1=&gt;*}.
Run \verb|cfactor| to factor over $\C$.
\item \verb|partfrac|~: expands a polynomial or
performs partial fraction expansion over a fraction.
Shortcut \verb|=&gt;+| (\verb|sto| then + key), 
for example \giacinputmath{ (x+1)^4=&gt;+} 
or \giacinputmath{1/(x^4-1)=&gt;+}.
\item \verb|simplify|~: tries to simplify an expression.
Shortcut \verb|=&gt;/| (\verb|sto| key then /), 
for example \giacinputmath{sin(3x)/sin(x)=&gt;/}
\item \verb|ratnormal|~: rewrite as an irreducible fraction.
\end{itemize}

\subsection{Calculus}
From math commands catalog, select \verb|Calculus|, or type 2nd-2
\begin{itemize}
\item \verb|diff|~: derivative. 
Shortcut \verb|'| for derivative with respect to $x$, example
\giacinputmath{diff(sin(x),x)} and \giacinputmath{sin(x)'} are equivalent.
For $n$th-derivative, add $n$,
for example 3rd derivative \giacinputmath{diff(sin(x^2),x,3)}.
\item \verb|integrate|~: antiderivative (1 or 2 or 4 arguments)
for example 
\giacinputmath{integrate(sin(x))} or \giacinputmath{integrate(1/(t^4-1),t)}
for $\int \frac{1}{t^4-1} \ dt $\\
Defined integration with  4 arguments, for
example \giacinputmath{integrate(sin(x)^4,x,0,pi)}
computes $\int_0^\pi \sin(x)^4 \ dx$.
For an approximate computation, enter one boundary as
an approx number, for example
\giacinputmath{integrate(sin(x)^4,x,0.0,pi)}
\item \verb|limit|~: limit of an expression.
Example \giacinputmath{limit((cos(x)-1)/x^2,x=0)}
\item \verb|taylor| and \verb|series|~: Taylor expansion
or asymptotic serie expansion, for example
\giacinput{taylor(sin(x),x=0,5)}\\
Add \verb|polynomial| if you do not want to have the remainder term.
\item \verb|sum|~: discrete summation, for example
\giacinputmath{sum(k^2,k,1,n)} computes $\sum_{k=1}^n k^2$,
\giacinputmath{sum(k^2,k,1,n)=&gt;*} computes the sum and 
rewrites it factored.
\end{itemize}

\subsection{Solvers}
From math commands catalog, select \verb|Solve|.
\begin{itemize}
\item \verb|solve| solves an equation exactly. Takes the variable
to solve for as second argument, unless it is \verb|x|, for
example \giacinputmath{solve(t^2-1=0,t)}.\\
If exact solving fails, run \verb|fsolve|
for approx solving, either with an iterative method
starting with a guess \giacinputmath{fsolve(cos(x)=x,x=0.0)}
or by dichotomy \giacinputmath{fsolve(cos(x)=x,x=0..1)}\\
For complex solutions, run \verb|csolve|.\\
It is possible to restrict solutions using assumptions on the variable,
for example \giacinputmath{assume(m&gt;1)} then \giacinputmath{solve(m^2-4=0,m)}.
\item \verb|solve| can also solve (simple) polynomial systems,
enter a list of equations as 1st argument and a list of variables
as 2nd argument, for example intersection of a circle and a line:
\giacinputmath{solve([x^2+y^2+2y=3,x+y=1],[x,y])}
\item Run \verb|linsolve| to solve linear systems.
enter a list of equations as 1st argument and a list of variables
as 2nd argument, example:
\giacinputmath{linsolve([x+2y=3,x-y=7],[x,y])}
\item Run \verb|desolve| to solve exactly a differential equation.
for example, to solve $y'=2y$, type \verb|desolve(y'=2y)|.\\
Another example with an initial condition:\\
\verb|desolve([y'=2y,y(0)=1],x,y)|\\
% Run \verb|odesolve| for approx solving or \verb|plotode| 
% for a graphic representation of the approx. solution. 
% \item \verb|rsolve| solves some recurrence relations
%  $u_{n+1}=f(u_n,...)$,
% for example to solve the arithmetico-geometric recurrence
%  $u_{n+1}=2u_n+3, u_0=1$, type:
% \giacinputmath{rsolve(u(n+1)=2*u(n)+3,u(n),u(0)=1)}
\end{itemize}

\subsection{Arithmetic}
When required, the distinction between integer arithmetic 
and polynomial arithmetic is done by a prefix \verb|i| for
integer commands. For example \verb|ifactor| for integer factorization
and  \verb|factor| for polynomial factorization
(or \verb|cfactor| for polynomial factorization over $\C$).
Some commands work for integers and polynomials, like
\verb|gcd| and \verb|lcm|. 

\subsubsection{Integers}
From math catalog, select \verb|Arithmetic, Crypto|. 
\begin{itemize}
\item \verb|iquo(a,b)|, 
\verb|irem(a,b)| quotient and remainder of euclidean division
of two integers.\\
\giacinputmath{iquo(23,13),irem(23,13)}
\item \verb|isprime(n)| checks whether $n$ is prime.
This is a probabilisitic test for large values of $n$.
\giacinputmath{isprime(2^64+1)}
\item \verb|ifactor(n)| factorizes an integer
(not too large, since algorithms used are trial division and
Pollard-$\rho$, there is not enough RAM for quadratic sieve),
for example
\giacinputmath{ifactor(2^64+1)}\\
Shortcut \verb|sto| then * (\verb|=&gt;*|)
\item \verb|gcd(a,b)|, \verb|lcm(a,b)| GCD and LCM
of two integers or polynomials.\\
\giacinputmath{gcd(25,15),lcm(25,15)}\\
\giacinputmath{gcd(x^3-1,x^2-1),lcm(x^3-1,x^2-1)}
\item \verb|iegcd(a,b)| (integer extended GCD)
returns 3 integers  $u,v,d$ such that
$au+bv=d$ where $d$ is the GCD of $a$ et $b$, $|u|&lt;|b|$ and
$|v|&lt;|a|$.\\
\giacinputmath{u,v,d:=iegcd(23,13); 23u+13v}
\item \verb|ichinrem([a,m],[b,n])| returns (if possible)
$c$ such that $c=a \pmod m$ and $c=b \pmod n$ (if $m$ are $n$
coprime, $c$ exists).
\giacinputmath{c,n:=ichinrem([1,23],[2,13]); irem(c,23); irem(c,13)}
\item \verb|powmod(a,n,m)| returns $a^n \pmod m$ 
computed by the fast modular powering algorithm\\
\giacinputmath{powmod(7,22,23)}
\item \verb|asc|  converts a string to a list of
ASCII code, \verb|char| converts back a list to a string.
These commands may be used to easily write cryptographic algorithms
with string messages.
\end{itemize}

\subsubsection{Polynomials}
From math catalog, select \verb|Polynomials|.

The default variable is $x$, otherwise you can specify it as last 
optional argument. For example \verb|degree(x^2*y)|
or \verb|degree(x^2*y,x)| return 2, 
\verb|degree(x^2*y,y)| returns 1.

Polynomials may have
coefficients in the rationals (example \verb|2/3*x+1|), or floats 
(example \verb|0.5*x+1|),
or in $\mathbb{Z}/p\mathbb{Z}$ 
(example \verb|3*x+5 mod 7|) 
or in a Galois fields (example, call once \verb|GF(2,4)|
to define the finite field with 16 elements with generator
\verb|g| by default, then
\verb|g^2*x+g+1|)

\begin{itemize}
\item \verb|coeff(P,n)| coefficient of $x^n$ in $P$, \verb|lcoeff(P)|
leading coefficient of $P$, for example
\giacinputmath{P:=x^3+3x; coeff(P,1); lcoeff(P)}
\item \verb|degre(P)| degree of polynomial $P$
\giacinput{degree(x^3)}
\item \verb|quo(P,Q)|, \verb|rem(P,Q)| quotient and remainder
of euclidean division of \verb|P| by \verb|Q|
\giacinputmath{P:=x^3+7x-5; Q:=x^2+x; quo(P,Q); rem(P,Q)}
\item \verb|proot(P)|~: approx. roots of $P$
(all roots, real and complex)\\
\giacinput{proot(x^5+x+1)}
%Graphic representation\\
%\giacinput{point(proot(x^5+x+1))}
\item \verb|interp(X,Y)|~: for two lists of the same size,
returns the interpolating polynomial $P$ such that $P(X_i)=Y_i$. \\
\giacinputmath{X,Y:=[0,1,2,3],[1,-3,-2,0]; P:=interp(X,Y)=&gt;+}
%Graphic representation\\
%\giacinput{scatterplot(X,Y); plot(P,x,-1,4)}
\item \verb|resultant(P,Q)|~: resultant of polynomials
$P$ and $Q$
\giacinput{P:=x^3+7x-5; Q:=x^2+x; resultant(P,Q)}
% \item \verb|hermite(x,n)|~: $n$-th Hermite polynomial 
% (orthogonal for the density $e^{-x^2}dx$ on $\R$)
% \item \verb|laguerre(x,n,a)|~: $n$-th Laguerre polynomial 
% \item \verb|legendre(x,n)|~: $n$-th Legendre polynomial 
% (orthogonal for the density $dx$ on $[-1,1]$)
\item \verb|tchebyshev1(n)| and \verb|tchebyshev2(n)|
Tchebyshev polynomials of 1st and 2nd kind
defined by~:
$$T_n(\cos(x))=\cos(nx), \quad U_n(\cos(x))\sin(x)=\sin((n+1)x)$$
%\item \verb|bernoulli(n,x)| polynomial de Bernoulli
\end{itemize}

\subsection{Linear algebra, vectors, matrices}
Xcas does not make distinction between vectors and lists. For
example,
\begin{giaconload}v:=[1,2]; w:=[3,4]\end{giaconload}
defines 2 vectors $v$ and $w$, then \verb|dot| will compute
the scalar product of $v$ and $w$:
\giacinput{dot(v,w)}

A matrix is a list of lists of the same size.
You can enter a matrix element by element using the
matrix editor (2nd-7 enter or 2nd-enter i). Enter a new variable
name to create a new matrix 
or the name of an existing variable to edit a matrix.
The \verb|,| key may be used to insert a line or column, and
the \verb|Del| key erases the line or column of the selection.
Type \verb|2nd-3| if you want to undo one edition step.
For small matrices, it is also convenient to enter them directly in the
commandline, for example to define
$$ A=\left(\begin{array}{cc} 1 &amp; 2 \\ 3 &amp; 4 \end{array}\right)$$
type \begin{giaconload}A:=[[1,2],[3,4]]\end{giaconload} 
or \giacinputmath{[[1,2],[3,4]]=&gt;A}
It is recommended to store matrices in variables!

If a matrix is defined by a formula, then it's better to use the
\verb|matrix| command (2nd-7 enter Cancel), for example:
\giacinputmath{matrix(2,2,(j,k)-&gt;1/(j+k+1))} 
returns the matrix where coefficient line $j$ and column $k$
is $\frac{1}{j+k+1}$ (beware, indices begin at 0).

Run \verb|idn(n)| to get the identity matrix of order $n$
and  \verb|ranm(n,m,law,[parameter])| to
get a matrix with random coefficients with dimensions $n,m$.
for example 
\giacinputmath{U:=ranm(4,4,uniformd,0,1)}
\giacinputmath{N:=ranm(4,4,normald,0,1)}

For basic arithmetic on matrices, use keyboard operators
(\verb|+ - *|, inverse). Otherwise, open catalog and
select \verb|Matrices|
\begin{itemize}
\item \giacinputmath{egvl(A)}
\giacinputmath{egv(A)} 
eigenvalues and eigenvectors of matrix $A$.
\item \giacinputmath{P,D:=jordan(A)} 
finds the Jordan normal form of matrix $A$, returns
matrices $P$ and $D$ such that
$P^{-1}AP=D$, with $D$ upper triangular (diagonal if $A$ is
diagonalizable)
\item \giacinputmath{Ak:=matpow(A,k)} computes
matrix $A$ to the $k$-th power, where $k$ is symbolic.
\item \verb|rref|: row reduction to echelon form
\item \verb|lu|: $LU$ factorization of matrix $A$,
returns a permutation $P$ and two matrices $L$ (lower)
and $U$ (upper) such that
$PA=LU$. The result of
\giacinput{P,L,U:=lu(A)} 
may be passed as an argument to the command \giacinput{linsolve(P,L,U,v)}
to solve a system $Ax=b$ by solving two triangular systems
(in $O(n^2)$ instead of $O(n^3)$).
% \item \verb|qr| $QR$ factorization of matrix $A$,
% $Q$ is orthogonal and $R$ upper triangular, $A=QR$.
% \item \verb|svd(A)| singular value decomposition of matrix $A$
% returns $U$ orthogonal, $S$ vector of singular values, $Q$
% orthogonal such that \verb|A=U*diag(S)*tran(Q)|. \\
% The ratio of the largest and the smallest singular value of $S$
% is the condition number of $A$ relative to the Euclidean norm.
\end{itemize}


\section{Spreadsheet, statistics}
Type the stat key to open the spreadsheet. The spreadsheet UI
can display some graphics including statistic graphics.

The spreadsheet is using usual notations, with one little exception,
row indices begin at 0 (like in programming).

Shortcuts for \verb|=| and \verb|$|~: like with TI cellsheet, press
sto or 2nd sto.

Cell edit: type any character (this will erase the previous cell content)
or type [trace] 4 (edit cell item).
%(shortcut: the key above the $x^2$ key).

For cell cross-reference in a commandline, you can key in
the cell name (lowercase is accepted for row index) or the
cell range. Or press the up or down arrow key,
then move to the cell and press enter. If you want to input a
range, instead of pressing enter, press stats or [trace] 2 (fast menu for edit,
select), and move to the opposite cell of the rectangular selection,
and press enter. Or alternatively, type alpha \verb|:|, then
up or down cursor, move to the opposite cell.

Statistics on a range~: move to the first cell of the data, press
stats, move to the last cell in the same column or in an adjacent
column and press stats again. If the selection is on 1 column,
this will display 1-d stats (mean, standard deviation, min, first
quartile, median, third quartile, max), if the selection is on 2
columns, this will display covariance and correlation. If you want
to do further computations with these values, leave the spreadsheet
(2nd quit) to the shell and type 2nd ins.
If you want to have statistics that are updated each time you change
the data, then move to an unused cell, type sto (to enter =) and
select a stats command from stat1d/stat2d or from the catalog then the range
of the data.

Copy/paste of a range~: 
Move to a vertex of a rectangular range, type stats (or [trace] 2 for the
select item of edit menu), move to the opposite vertex
and type [trace] 2. The selection can be pasted
with 2nd ins in the spreadsheet, or in the shell (in that
case the cell values are pasted as a matrix).

If you want to have a graphic representation from data in the
spreadsheet, go to a cell that is currently not used, type \verb|=|
(sto key), then enter a command (using the menus), then make a selection
like explained above. Type 2nd stat plot to display the graph. \\
Example: scatterplot and linear regression plot for some data in columns 1 and 2\\ Enter data, move to an unused cell, type sto then window (stat2d) enter\\
\includegraphics[width=7cm]{84sheet1}
\includegraphics[width=7cm]{84sheet2}
\includegraphics[width=7cm]{84sheet3}\\
last screenshot after move to the range begin, 
then type stat and move to the range end, then enter\\
\includegraphics[width=7cm]{84sheet4}
\includegraphics[width=7cm]{84sheet5}
\includegraphics[width=7cm]{84sheet6}\\
2nd graph stat will display the points, type - to zoom out and see all the points\\
\includegraphics[width=7cm]{84sheet7}
\includegraphics[width=7cm]{84sheet8}
\includegraphics[width=7cm]{84sheet9}\\
move to another unused cell, type window (stats2d), select item 4,
enter the range (entered from keyboard in the screenshot),
enter, then 2nd graph stats\\
\includegraphics[width=7cm]{84sheet10}
\includegraphics[width=7cm]{84sheet11}
\includegraphics[width=7cm]{84sheet12}\\
Leave the spreadsheet to see the line equation and the $r^2$ coefficient.

N.B.: for probability distributions, please go back to TI OS shell, there
is not enough room in user flash to provide an implementation inside KhiCAS.

% \subsection{Random numbers}
% From math catalog, select \verb|Probabilities|
% then \giacinput{rand()} (real in $[0,1)$) or 
% \giacinput{n:=6:; randint(n)} 
% (integer between 1 and $n$). 
% Other commands with prefix \verb|rand| are available, followed
% by the name of the law, for example \verb|randbinomial(n,p)| 
% returns a random integer according to binomial law of parameters $n,p$.
% For a random vector or matrix, run
% \verb|ranv| or \verb|ranm| (from \verb|Alglin, Matrice| submenu), 
% for example for a vector with 10 random
% reals according to normal law (mean 0, stddev 1), type\\
% \giacinputmath{ranv(10,normald,0,1)}

% \subsection{Probabilities}
% From math catalog, select \verb|Probabilities| (8).
% There you will find a few distribution laws: 
% \verb|binomial|, \verb|normald|, \verb|exponentiald|
% and \verb|uniformd|. Other distribution must be keyed in
% or entered with the
% help of the main catalog (math enter):
% \verb|chisquared|, \verb|geometric|, \verb|multinomial|,
% \verb|studentd|, \verb|fisherd|, \verb|poisson|.

% To get the cumulated distribution function, enter the law name then
% the \verb|_cdf| suffix (shortcut: select 
% \verb|cdf| in the catalog at the end and press 2nd-1).
% Inverse cumulated distribution function follows the same principle
% with \verb|_icdf| suffix (shortcut:
% select \verb|cdf| in the catalog and press 2nd-2).

% Example~: find the centered interval $I$ for the normal law of
% mean 5000, standard deviation 200, such that the probability
% to be outside $I$ is 5\%
% \giacinput{M:=5000; S:=200; normald_icdf(M,S,0.025);normald_icdf(M,S,0.975)}

% \subsection{1-d statistics}
% The statistic functions are taking lists as arguments,
% for example \begin{giaconload}l:=[9,11,6,13,17,10]\end{giaconload}
% From math catalog, select \verb|Statistics|:
% \begin{itemize}
% \item \giacinput{mean(l)}~: arithmetic mean of a list
% \item \giacinput{stddev(l)}~: standard deviation of a list.\\
% Run
% \giacinput{stddevp(l)} to get an unbiaised estimate of the standard
% deviation of a population from a sample \verb|l|
% \item \giacinput{median(l)}, \giacinput{quartile1(l)}, 
% \giacinput{quartile3(l)}
% returns respectivly the median, first and third quartile
% of a list.
% \end{itemize}
% For 1-d statistics with frequencies, replace \verb|l|
% by two lists of the same length, the first list being the
% values of the serie, the second list the frequencies.
% For graphic representations, open catalog, \verb|Graphic| 
% and select \verb|histogram| or \verb|barplot|.

% \subsection{2-d statistics}
% From math catalog, select \verb|Statistics|:
% \begin{itemize}
% \item \verb|correlation(X,Y)|: correlation of two 
% lists $X$ and $Y$ of the same length.
% \item \verb|covariance(X,Y)|:: covariance of two 
% lists $X$ and $Y$ of the same length.
% \item regression computations:
% run commands with suffix \verb|_regression(X,Y)|,
% for example \verb|linear_regression(X,Y)| returns
% coefficients $m,p$ of the linear regression line
% $y=mx+p$.
% \item \verb|linear_regression_plot(X,Y)| 
% and all commands
% of suffix \verb|_regression_plot|
% will display the line (or curve) of the regression.
% These commands will also print the $R^2$ coefficient
% that give information on the quality of adjustment
% ($R^2$ near 1 is good).
% \end{itemize}

\section{Graphics}
Inside KhiCAS, one gets a graphical representation by entering
a command that returns a graphic object (see next section \ref{sec:graphcmds}), 
then this graphic object will be displayed in the graphic application
(see section \ref{sec:graphui}).
The whole display, except the status area, will be used to display
the graphic object, i.e. 320$\times$222 pixels instead of 265$\times$165
pixels for TI OS graphical application, 62\% more pixels!

\subsection{Graphic commands} \label{sec:graphcmds}
From math catalog, select \verb|Graphics| 
(or type the plot fast menu shortcut [zoom])
and choose a graphic command. If you want to have more than one curve
on the same graphic, enter several commands with \verb|;| as separator.\\
\includegraphics[width=7cm]{84plot1}
\includegraphics[width=7cm]{84plot2}
\includegraphics[width=7cm]{84plot3}\\
\includegraphics[width=7cm]{84plot4}
\includegraphics[width=7cm]{84plot5}\\
{\em Screenshots illustrating access to a parametric plot command: first press
zoom (plot fast menu), then move to plotparam enter (or type 5), 
then press the key above the $x^2$ key, then the graph key to get help,
then F2 to copy the example.}
\begin{itemize}
\item \verb|plot(f(x),x=a..b)| plot expression $f(x)$ for $x\in [a,b]$.
Discretization option: \verb|xstep=|,
for example \giacinput{plot(x^2,x=-4..4,xstep=1)}
Default is 384 evaluations per plot (one per horizontal pixel).
\item \verb|plotseq(f(x),x=[u0,a,b])| webplot for a recurrent
sequence $u_{n+1}=f(u_n)$ of first term $u_0$,
for example if $u_{n+1}=\sqrt{2+u_n}, u_0=6$, with a plot
on $[0,7]$
\giacinput{plotseq(sqrt(2+x),x=[6,0,7])}
\item \verb|plotparam([x(t),y(t)],t=tm..tM)| parametric plot
$(x(t),y(t))$ for $t\in [t_m,t_M]$. Discretization option: \verb|tstep=|.
Example
\giacinput{plotparam([sin(2t),cos(3t)],t,0,2*pi)}
\item \verb|plotpolar(r(theta),theta=a..b)| polar plot
of $r(\theta)$ for $\theta \in [a,b]$,
for example
\giacinput{plotpolar(sin(3*theta),theta,0,2*pi)}
\item \verb|plotlist(l)|: plot a list \verb|l|,
i.e. draws a polygonal line 
with vertices $(i,l_i)$ (index $i$ starts at 0).\\
\verb|plotlist([X1,Y1],[X2,Y2],...)| 
polygonal line with vertices the points of coordinates $(X_i,Y_i)$ 
\item \verb|scatterplot(X,Y)|, \verb|polygonscatterplot(X,Y)|
for two lists \verb|X,Y| of the same size,
draws the points or a polygonal line of vertices $(X_i,Y_i)$ 
\item \verb|histogram(l,class_min,class_size)|
plots the histogram of data in \verb|l|, class size
\verb|class_size|, first class starts at
\verb|class_min|. Example: check the random generator quality\\
\giacinput{l:=ranv(500,normald,0,1); histogram(l,-4,0.25); plot(normald(x),x,-4,4)}
%\item \verb|plotcontour(f(x,y),[x=xmin..xmax,y=ymin..ymax],[l0,l1,...])|
%plot implicit curves $f(x,y)=l_0, f(x,y)=l_1,...$.
\item \verb|plotfield(f(t,y),[t=tmin..tmax,y=ymin..ymax])|
plot the field of tangents for the differential equation
$y'=f(t,y)$. Add the optional last parameter \verb|,plotode=[t0,y0]|
to plot simultaneously the solution with initial condition
 $y(t_0)=y_0$. Example $y'=\sin(ty)$ for $t \in [-3,3]$
and $y \in [-2,2]$\\
\giacinput{plotfield(sin(t*y),[t=-3..3,y=-3..3],plotode=[0,1])}
N.B.: \verb|plotode| may be used outside of \verb|plotfield|.
\item For simultaneous plots, write commands separated by \verb|;|
\end{itemize}

\subsection{Graphic app user interface.} \label{sec:graphui}
If a command returns a graphic output, the graphic application
will be run.\\
\includegraphics[width=7cm]{84plot6}
\includegraphics[width=7cm]{84plot7}\\
{\em Screenshots illustrating the trace mode of the graphic application}
\begin{itemize}
\item If a command returns an arc of curve, the trace mode is active by
default. In this mode, typing the left or right key will move a
pointer on the active arc of curve, and display the pointer
coordinates (and the parameter value for parametric curves), and
a tangent vector (speed). If there are several arcs of curve, press up or
down to change active arc. \\
Type the trace key to display the speed vector (tangent), a
normal, and/or the osculating circle. The default trace mode is
faster than other trace modes, because the graph does not 
need to be redisplayed.\\
Beware, if you keep a cursor key pressed too long, the calculator
might reset.
\item
Type [y=] to get info on the active curve,
then enter to see a table of value.\\
Or type directly 2nd table to see the table of value.
\item Type the window key to modify the window. 
Type + or - to zoom in or out. Type * to autoscale, / to orthonormalize
\item 
Press x,t,... to get the curve study menu. 
From the curve study menu, you can move
the pointer to a location, or to a remarkable point: root, horizontal
or vertical tangent, inflexion point, intersection with another curve
arc. You can also compute an arc length or
the area under the curve between pointer and mark.
\end{itemize}

After a \verb|plot| or \verb|plotparam| command, 
the variables \verb|x0,x1,x2,y0,y1,y2|
are set with the expressions of position, speed and acceleration
of $x(t)$ and $y(t)$ (for a function curve $x=t$). When
you search a root, horizontal tangent, inflexion, arc length or area
under curve, some variables are set with the last computed value.
Note that \verb|plotpolar| will purge these variables and only
store the affix of the point \verb|z0|=$r(\theta)e^{i\theta}$.

For display options, you can enter an optional argument at the end
of the plot command, 
\begin{itemize}
\item \verb|display=color| color option: 
for example to get
\giacinput{plot(sin(x),display=red)}
type \verb|2nd-3 enter sin x| then cursor right, \verb|, math enter d i s p enter 2nd = math , r e d|
\item \verb|display=line_width_2| to \verb|display=line_width_8|:
change segments width (including inside polygonal line used to
plot a curve).
Simultaneous display options should be added with \verb|+|.
For example \verb|display=red+line_width_2|
\item Circles and rectangles with edges parallel to the coordinate
axis may be filled with 
\verb|display=filled| (this attribute might be added to other attributes)
\item If you want to define the display window (overwriting
the autoscale computation), select \verb|gl_x| or/and \verb|gl_y| 
and add an $x$ or $y$ interval, for example 
\giacinput{gl_x=-2..2;gl_y=-1..4;plot(exp(x))}
Note that \verb|gl_| commands must preced the plotting command.
\item
If you want to remove axes, select  \verb|axes| and press 2nd-2
(\verb|axes=0|). Like \verb|gl_| commands, \verb|axes=0|
must preced the plotting command. Axes can be removed interactively
when the graph screen is displayed by pressing the \verb|sin| key.
\end{itemize}

\section{Programs}
You can program either with Xcas-like syntax 
or with Python-like syntax.

A function may be defined by an algebraic expression\\
\verb|funcname(parameter):=expression|\\
First example~: define the simple confidence interval 
for a frequency $p$ in a sample
of size $N$, type from the shell commandline\\
\giacinput{f(p,n):=[p-1/sqrt(n),p+1/sqrt(n)]}\\
Then test with \giacinput{f(0.4,30)}

Second example~: more precise confidence interval for a frequency $p$
in a sample of size $N$:\\
\giacinput{f(p,n):=[p-1.96*sqrt(p*(1-p)/n),p+1.96*sqrt(p*(1-p)/n)]}
To avoid computing twice the same quantity, one should insert
a local variable. 
The commandline is not well adapted to write these kinds
of functions. For non algebraic functions, it is best to run the 
program editor. Press prgm, then enter the following
(type enter to enter a newline, and trace (char/io menu)
to enter the \verb|=| sign)~:
\begin{giacprog}
def f(p,n):
  d=1.96*sqrt(p*(1-p)/n)
  return [p-d,p+d]
\end{giacprog}
\includegraphics[width=7cm]{84prog1}
\includegraphics[width=7cm]{84prog2}\\
Type 2nd enter to check the syntax. Once
the program is correct, save it (F5 2), then type 2nd quit
to leave the program editor. Now you
can call your program from the commandline like this\\
\verb|f(0.5,30)|\\
You can enter \verb|f| either with alpha f or var then f item.

Third example~: a loop printing integer squares
from 1 to $n$ in Python syntax.
From the shell type prgm to open the Script Editor,
Type F5 then Clear
if there is some old script source,
Select \verb|def| from window fast menu key
(or from math, Program, function def), 
you should get \verb|def f(x):|.
Replace \verb|x| by \verb|n| 
move to the end of the line and press enter to input a newline.
Type window then enter, then j space, then
window then 3. Type \verb|1,n+1| 
%then trace select \verb|:|. 
Go to the next line (if it is not empty, move
to the end of line and ype enter to insert a newline),
trace, select print,
then type enter, type \verb|j,j^2)| then enter.
\begin{giacprog}
def f(n):
  for j in range(1,n+1):
    print(j,j**2)
  return
\end{giacprog}
Inside Xcas \verb|^| means power, \verb|**| is also accepted like in
Python.\\
\includegraphics[width=7cm]{84prog3}
\includegraphics[width=7cm]{84prog4}
\includegraphics[width=7cm]{84prog5}\\
\includegraphics[width=7cm]{84prog6}
\includegraphics[width=7cm]{84prog7}

Now, type 2nd enter. If the syntax is correct,
the statusline will briefly display \verb|Parse OK|. Otherwise, the
first error line number and token will be displayed and the cursor will
be positionned at the line where the error was detected. Note that
the error may be before this line but it was only detected later. Note
also that if you are using Python syntax compatibility, programming
structures are translated into Xcas syntax, and errors are displayed after
translation, therefore you might see token errors like \verb|end|
that were added by the translator.

If the program is correct, you can save it with the graph (F5 key) menu 
(save or save as). Go back to the shell (2nd quit or cancel key).
You can run the program from the commandline by entering
\verb|f(10)| (press \verb|var| to select the function f),
this should display all squares from 1 to 10.

If your program has runtime errors or if you want
to see it run step by step, run \verb|debug| on it,
for example\\
\verb|debug(f(10))|\\
\includegraphics[width=7cm]{84prog8}
\includegraphics[width=7cm]{84prog9}
\includegraphics[width=7cm]{84prog10}\\
\includegraphics[width=7cm]{84prog11}
\includegraphics[width=7cm]{84prog12}
\includegraphics[width=7cm]{84prog13}

Another example of non algebraic function: the euclidean algorithm
to compute the GCD of two integers. 
Press enter to insert a newline. \verb|!| is in the
submenu \verb|Programmation_cmds| (11, shortcut $X,\theta,T$)
or in the test 2nd-4 menu.
\begin{giacprog}
def pgcd(a,b):
  while b!=0:
    a,b=b,a % b
  return a
\end{giacprog}
Check with \giacinput{pgcd(12345,3425)}

You can use all Xcas commands and data types in your programs.
There is also a small
pixelised graphic commands set
(\verb|draw_pixel(x,y,c)|, \verb|clearscreen()|, \verb|draw_line(x1,y1,x2,y2,c)|, 
\verb|draw_polygon([[x1,y1],[x2,y2],...],c)|,
\verb|draw_rectangle(x,y,w,h,c)|, \verb|draw_circle(x,y,r,c)|,
the color+width+filled \verb|c| parameter is optional,
\verb|draw_arc(x,y,rx,ry,t1,t2,c)| draws an ellipsis arc).

\section{The 2d editor.}
If a computation returns an expression, it will be displayed in the 2d 
expression editor. This also happens if you press 2nd-$\tan$
when the selected
level is an expression, or if you press 2nd-$\tan$ 
from the commandline if the line
is empty or contains a syntaxically correct expression.

Once the 2d editor is open, the expression is displayed in full screen and
all or part of the expression is selected. One can run a command
on the selection (from the menus or a keyboard shortcut), or edit 
(in 1d mode) the selection. This is an efficient way to rewrite
expressions or edit them.

Example 1~: enter
$$ \lim_{x \rightarrow 0} \frac{\sin(x)}{x}$$
From an empty commandline, type 2nd-$\tan$, you should see 0 selected.
Type x then enter, this will replace 0 by x selected. Type \verb|sin|, now
$\sin(x)$ should be selected. Type the division key (above -), you
should see $\frac{\sin(x)}{0}$ with 0 selected, type x then enter,
you should now see $\frac{\sin(x)}{x}$ with x (below the fraction)
selected. Type the up arrow key, now $\frac{\sin(x)}{x}$
should be selected. Now type window 4 (for limit). The expression
is ready to eval, type enter to copy it to the commandline and enter
again to eval it. For the same limit at $+\infty$, before leaving
the 2d editor with enter,
move the selection with the right arrow key, then type [y=] 8 (oo) enter.

Example 2~: 
$$ \int_0^{+\infty} \frac{1}{x^4+1} \ dx $$
From an empty commandline, type 2nd-$\tan$, then window 3 (integrate),
you should see:
$$ \int_0^1 0 \ dx$$
with $x$ selected. We must modify the 1 (upper bound) and
the 0 (integrand). Press left arrow key, this will select the
integrand 0, type \verb|1/(x^4+1)| enter, then left arrow key [y=] 8 enter.
Type again enter to copy to commandline, enter again to run the computation,
the result will be displayed in the 2d editor, enter will leave the 2d
editor, with the integral and its value in the history.

Example 3~: compute and simplify
$$ \int \frac{1}{x^4+1} \ dx $$
From an empty commandline, type 2nd-$\tan$, then window 3 (integrate),
you should see
$$ \int_0^1 0 \ dx$$
Move the selection to the lower bound 0 (right arrow key), 
type Del, you should see
$$ \int 0 \ dx$$
selected. With the down arrow key, select 0, type \verb|1/(x^4+1)| enter,
enter copy to the commandline, enter to run the compuation, the result
is now displayed in the 2d editor.\\
With the arrow key, select one of the arctangent, type [y=] enter (simplify),
this will make a partial simplification, do the same on the second
arctangent.\\
For a more complete simplification, we will collect the logarithms.
The first step is to exchange two terms of the main sum so that the
logarithms are grouped. Select one of the logarithm with the arrow keys,
then type 2nd-left or right arrow key
this will exchange the selection with the right or left sibling.
Now type ALPHA right or left arrow key to extend the selection adding
the right or left sibling. Once the two logarithm terms are selected,
press 2nd-1 2 enter (factor), decrease the selection to the numerator,
type math enter (All), type the letters l, n, c, this moves in the
catalog to the first command beginning with \verb|lnc|, select
\verb|lncollect|, enter and trace (eval).

\section{Managing sessions}
\subsection{Modifying a session}
With the up/down cursor keys, you can move in the history, the current
level is printed with reverse colors.

You can move one level in another position with ALPHA-up and ALPHA-down.
You can delete a level with the Del key (the level is copied into 
the clipboad).

You can display an existing level with left 2nd or right 2nd.
Type Cancel to leave.

\subsection{Variables}
Press \verb|vars| to see which variables are assigned to a value. 
Select a variable
name, press enter to copy it to the commandline, 
%Del will input the command that erases the variable (confirm with enter). 
\verb|restart| will
purge all variables at once (press \verb|cancel| twice to clear the history
and start a fresh new session). \verb|assume| is a command to 
make assumptions on a variable, like \verb|assume(x&gt;5)|.

Observe the numeric value near the title, this is the amount
of contiguous RAM available for CAS computations. If this value
is near 0, it is recommended to leave KhiCAS and run it again,
this will garbage collect the memory available.

\subsection{Archiving and exchanging with Xcas}
On the calculator, type cancel to go back to the shell if you are in the
programming editor. 
From the F5 menu, you can save/restore sessions. In the script editor,
you can save scripts from the F5 menu, they will have a variable
name ending with a \verb|_| suffix and will be treated like Python
scripts by the calculator.

\section{Importing expressions/matrices from TI OS}
You can import expressions inside Y1 to Y9 with
2nd 1 to 2nd 9, or by keying [A] to [I] for matrices.

After a computation inside KhiCAS, the returned expression (if it's a scalar)
will be stored in Y2. You can also explicitly store it in Y1 to Y9 by
appending to the commandline \verb|=&gt;Yk|, where \verb|=&gt;|
is obtained by pressing the sto key and Y1 to Y9 with 2nd 1 to 9.
From KhiCAS shell, press 2nd quit to leave KhiCAS, then the
Y= key (twice the same key) to open the function application.

\section{Keyboard shortcuts.} \label{sec:shortcuts}
2nd on will turn off the calculator, but this is not recommended for a
long period of time. It's better to leave KhiCAS (2nd quit) and turn
off from TI OS to spare the batteries.

If KhiCAS freezes inside a long computation, you should be able to interrupt
it by pressing Cancel. If it does not interrupt, try the reset button.

These shortcuts are valid inside the shell and text programming
editor. With default configuration:
\begin{itemize}
\item 2nd quit : from shell, leava KhiCAS to TI OS shell,
otherwise leave editor or spreadsheet to shell
\item key above $x^2$ key in the shell: open catalog 
at a position depending of the commandline.
\item Cancel: cancel (if there is something to cancel)
or switch from editor to shell
\item math: maths commands menu
\item F5: $\chi$CAS menu
\item F3: table of ASCII characters
\item var: variables list
\item 2nd-F1-2nd-F5 and alpha-F1 to alpha-F5: see legend at screen bottom,
\item matr: matrix fast menu
\item stat: OS matrix input menu
\end{itemize}

In programming editor
\begin{itemize}
\item key above $x^2$ key: indent
\item 2nd then cursor key: move to begin/end of line or file
\item F4: edit menu. Procedure to select text: choose select.
Move the cursor to the selection end, type Cancel to remove the selection
(it will be copied to clipboard) or again F4 select to copy selection
to clipboard without removal.
Type Cancel to cancel selection.
\item enter: if a search/replace is currently active (math 6)
find next word occurence. Otherwise parse/execute.
\item enter: add a newline, 2nd enter: parse program.
\item Del: remove selection or previous character if no selection active
\end{itemize}


\section{Copyright and Thanks to.}
\begin{itemize}
\item Giac and $\chi$CAS, computing kernel (c) B. Parisse 
and R. De Graeve, 2024.
\item $\chi$CAS interface adapted by B. Parisse from
Eigenmath source code by Gabrial Maia for the Casio Prizm.
\item
$\chi$CAS license GPL2~:
\ahref{https://www.gnu.org/licenses/old-licenses/gpl-2.0.html}{GPL2}
on the Free Software Foundation website.
The source code of $\chi$CAS is available at
\ahref{https://www-fourier.univ-grenoble-alpes.fr/\home{parisse}/ti/khicas.tgz}{here}, released under the GPL2 (except for \verb|allocator_standard.c|,
released under the GPL3 like the CE toolchain).
\item The installation program INST is (c) B. Parisse, it is closed source.
It can be run and redistributed freely for non commercial use. It contains
code (c) Matt Waltz:
\begin{verbatim}
; Copyright 2015-2021 Matt "MateoConLechuga" Waltz
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice,
;    this list of conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice,
;    this list of conditions and the following disclaimer in the documentation
;    and/or other materials provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors
;    may be used to endorse or promote products derived from this software
;    without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
; POSSIBILITY OF SUCH DAMAGE.
\end{verbatim}
\item The Cabri document artifice is (c) YvanTT,
\ahref{https://yvantt.github.io/arTIfiCE/}{web site}.
\item Adaptation for the ti83/84 calculators thanks to the help and
  tools of the ti83/ti84 devel community (c/c++ compiler, cemu emulator).
Special thanks to Adrien Bertrand (countless mail exchanges,
ressources pointers ...), 
Jacob Young, commandblockguy, Matt Waltz, YvanTT.
\item Thanks to the active members
of tiplanet. Special thanks to critor
for articles, tests and advertising and for the time helping
me when I locked my ti83.
\end{itemize}



\section{Developer section: compiling your own version of KhiCAS}
First install the 
\ahref{https://github.com/CE-Programming/toolchain/releases/tag/nightly}{
CE compilation toolchain}, and look at the
\ahref{https://ce-programming.github.io/toolchain/}{documentation},
then \ahref{http://www-fourier.ujf-grenoble.fr/\home{parisse}/ti/khicas.tgz}{KhiCAS source code}.


In order to have access to more RAM, I have modified the memory allocator
so that malloc may use the upper part of LCD RAM, and I have also 
modified malloc to
abort instead of returning NULL because Giac/ustl does not
handle a null pointer returned by malloc. I also made optimizations
in transcendental functions computations, all available in this
\ahref{http://www-fourier.ujf-grenoble.fr/\home{parisse}/ti/celibc.tgz}{archive}. 
Therefore you will have to install the toolchain source, untar this archive
in \verb|toolchain/src/libc/|,
run \verb|make|
and \verb|make install|, as explained in the
\ahref{https://ce-programming.github.io/toolchain/static/contributing.html}{documentation}.

After that, edit the \verb|mkappen| script file (\verb|mkappfr|
is for French highschool, \verb|mkappl2| for my students). This
script will run the toolchain and build a normal app, then remove
relocations (using a desktop program build from reloc.cc, 
this save about 25\% of the flash required), then
segment the stripped app in several appvars for the INST 
installation program.

It is possible to build a custom KhiCAS application by playing with
the compile flags \verb|-DWITH_| 
in \verb|makefile.en|. For example physical units handling in the
shell commandline is enabled by the \verb|-DWITH_UNITS| compile flag,
and requires about 40K of additional user flash.
Note that the app size is modified 64K flash page by 64K flash page.

If you want to improve the shell and programming editor interface,
it is recommended to get the 
\ahref{http://www-fourier.ujf-grenoble.fr/\home{parisse}/ti/shell.tgz}{``fake giac'' source code}. This will compile exactly the same UI, but without
linking to giac, and instead of a 6 minutes build, it will build in about 20
seconds.

\end{giacjshere}
\end{document}
</pre></body></html>