Welcome to Xcas for Firefox or compatible browser
(c) 2020, B. Parisse and R. De Graeve, Institut Fourier,
Université de Grenoble. Type python or javascript to
switch to MicroPython (Damien P. George et al)
or Javascript
(QuickJS engine by
Fabrice Bellard and Charlie Gordon)
Type a computation or program in the commandline, for
example 1/3+1/6.
You can select the Xcas,
MicroPython
or Javascript interpreter from the
settings (button at the top left). The default Javascript interpreter is
QuickJS in math mode unless the commandline starts
with @ (QuickJS without math mode) or
@@ (browser Javascript interpreter).
Helpers are available by pressing Math
or Prog or 123 (scientific keyboard).
Press enter or hit ✅ to run the computation.
Find commandnames with the helpers or by reading the sections
below or in the
Xcas manual.
To get online help on a command, enter the commandname and press
the ? button or F1 key.
You can share a session by clicking on the ⠪ button.
You can exchange Xcas sessions by email. Fill in once the email
fields in the Settings (topleft button).
You can send a session by clicking on the ✉ link, modify the To
field if necessary (if you are using a webmail that is not gmail, copy
the x2 link content inside a mail or configure your browser settings for
this webmail).
When you receive an Xcas session by email, click on the link, this
should open the session in your browser. You can modify the
session and send it back with the ✉ link.
When you send a session by email, the filename of the session
will be modified by prefixing the sender email, except if the
sessionname contains @ (it remains unchanged, except if the filename begins
with @, then the leading @ is removed).
Example: a teacher sends to his students a session named
@exercise with a mail alias or by sharing on the forum (⠪),
the students filename session will be exercise,
they do the work and send it back to the teacher (✉ link),
the session received by the teacher is named with the email
address of the student prefixed, it's easy for him to know
who he is correcting. The teacher can send the session back,
the session name remains unchanged.
You can optionally install Xcas on your device, in order to run it
in airplane mode (without Internet connection).
To install Xcas for Firefox on a mobile device, download
xcashtml.zip,
unzip it (for example with Androzip on Android),
search the xcasenjs.html file and open it with your
browser (Firefox recommended). You can create a shortcut
on your welcome screen for easy access.
On PC/Mac: if you have Xcas native >1.4.9-57 already installed, Xcas for
Firefox is already installed, otherwise do like on mobile.
Windows: locate the file xcasen.html
in the doc subdirectory inside the install directory
of Xcas, by default c:\xcas.
Groebner basis
cyclic6.
For more intensive computations, activate
wasm in the settings and open
cyclic7 (modular).
If you want to see informations while a computation is running, run first
debug_infolevel:=1 (or more), then open the browser console.
For really large computations, use native Xcas versions.
Arithmetic on multivariate polynomials (requires a browser
compatible with Web-Assembly, like Firefox ≥ 58).
Fateman benchmark for n=20
a panel of buttons: settings, save/restore session,
helpers (Xcas logo maths, programming, scientific keyboard, documentation).
Some buttons or links are not visible at startup like the x2 or
✉ links:
the x2 (resp. local) link may be used to replicate a
session, right-click to copy/paste the link in Xcas native or
on a static web
page. It is also useful if you stop a computation that would
take too long.
the ✉ link lets you share your session by e-mail.
a help area, where you will see short descriptions of the
commands you asked the syntax. You can clear the help area with
the erase button at the right of the help search field.
the history area contains levels (0 at the
beginning), a level is a pair commandline (written in
black)/answer (in blue).
You can move levels with the ↑ and ↓ buttons.
You can modify an existing commandline, update it with the
✅ button or Enter key at the beginning of the field.
You can throw a level to the trash with the erase button at the
right of the level. You can restore levels from the trash with
the Restore button at the bottom of the history, or empty
the trash.
The link + right to the Empty button lets you open
a new empty session in a new tab.
a commandline,
type your command or program there, then tap ✅
or hit Enter (type Ctrl-Enter if your input has several lines, or
Enter on a blank line).
If you want to force a new line, hit Shift-Enter or tap the \n button.
For example, type 1/2+1/3
or sin(pi/4) or sin(pi/4.0).
The Math, prog and 123
buttons may be used to help you fill the commandline.
If you know a commandname, type it (or its first letters),
for example factor then press
the key or the
button. This will display a
short help on the command if it exists
or give some commandname hints if it does not or is incomplete.
For example, click on math then rewrite then
factor then ?, look at the short help at the top,
click on one example or complete with x^4-1 then type Enter.
You can
select text with the beg
and end buttons, remove selection
with del and paste selection with cp.
If you evaluate a blank commandline, this will add a
comment field. You can convert
a commandline into a comment (or a comment into a commandline):
type /// at the beginning then Enter.
You can comment an exisiting level by pressing
the ✎ key. You can write boldface, italic, etc. in a comment
using the buttons below the comment or typing HTML code.
If you want to render maths, you have two methods
enter a valid Xcas input between two dollars
($...$), the input will be parsed unevaled and converted to MathML for 2d
display. For example $x[n+1]^2$ will display x with
exponent n+1, $A=[[1,2],[3,4]]$ will display a matrix
(it will not modify A), $integrate(sin(x),x,0,pi)$
will display the integral of sin(x) between 0 and pi (the integral will not be
computed), vector(u), vector(A,B) will display an arrow
over u or AB.
Symbols of sets like ℤ,ℕ may be obtained by entering
$ZZ$, $NN$, for example type $x in QQ$ to get x∈ℚ. HTML code may
also help like ∀ for ∀,
∃, ⊕, ⊗,
∉, ∅, ∂, etc.
or copy/paste a symbol from
here.
or enter a comment containing at least one pair of
double dollars ($$...$$), the whole comment will be
rendered as a LaTeX formatted comment by loading MathJax
(beware that this will not work offline).
a console that will display CAS messages,
syntax errors or step by step computation for commands that
support step by step (like derivative).
The console is not displayed if it is empty. You can clear
the console or adjust it's height.
a graph 3d area for 3d commands. This area
is not displayed if it is empty.
You can save the history by hitting the 💾
button. The filename of the session is displayed in a modifiable text
field at the right of the 💾 button, it is session
by default. You can open a saved session by hitting the Load
button.
You can export your worksheet on desktops, this
will save the whole HTML code (instead of the commandlines for a
session).
2d graphs can be saved as SVG 1.2 files (save button at the right of
the level).
If you have a native Xcas session, you can open it in Xcas for Firefox
(native Xcas menu menu File, Clone or from commandline
xcas --online nom_fichier.xws).
Note that Chrome (or the builtin browser of your device) is
much slower than Firefox (about 5 times). Moreover Chrome
does not have builtin support to display 2d maths with
MathML, an additional javascript library (Mathjax) must
be retrieved from Internet which is slower and does not
work in airplane mode.
It is therefore recommended to run Xcas for Firefox from Firefox
Keyboard shortcuts with Alt (or Ctrl if Alt-key is already
interpreted by the browser or the OS)
D, cursor right: move focus to the right (or down)
G, cursor left: move focus to the left (or up)
cursor down: move focus to the right/down twice
curseur up: move focus to the left/up twice
B: move focus to commandline
C: copy current field to command line and move focus to commandline
A: move focus to help field
TAB: display help on the command at the left of the cursor
in the commandline.
M: display or hide Math menu
P: display or hide Program menu
T: show turtle menu
E or F: exec history
N: clears console
Click on the button at the topleft to modify settings. You can
change
the default digits number, the angle unit, the step by step mode,
etc.
If you have a compatible browser, like Firefox≥58, you can
enable the wasm option (Web-Assembly), this makes most
computations faster and give access to PARI-GP commands after
running pari().
Xcas manals
Most of the documentation is in French, not yet translated.
The "hard disk" version of the documentation is available on
Linux if you have giac installed.
Otherwise, please select the Internet version.
xcasen.html is a javascript interface, optimized for Firefox, of the
Giac
computer algebra system compiled with emscripten. The text editors
are using the CodeMirror
javascript library.
Unlike many CAS web-interfaces, once the page is loaded,
it does not require a server,
it runs entirely locally with the javascript engine of your browser.
It is slower than native code, about 2 times slower for numeric code,
up to 8 times slower for symbolic code.
If you run large computations, consider installing
Xcas native!
Giac/Xcas (c) 2018 B. Parisse, R. De Graeve, Institut Fourier, Université
de Grenoble, GPL3 license. For commercial license,
contact us.
Optimization, signalprocessing, graph theory code: Luka Marohnić.
Mathml and SVG code initially written by
J.P. Branchard.
MicroPython (c) Damien P. George et al
QuickJS (c)
Fabrice Bellard and Charlie Gordon.
There is no universal method to simplify an expression,
sometimes it's better to expand, sometimes to factor, sometimes
linearize, etc.. It is therefore important to know
some rewriting
commands, the most important are available by hitting Math then rewrite.
For example, hit math, rewrite, simpl
this will insert the command
,
type the expression you want to expand and simplify, then Enter.
,
,
are somewhat similar, less powerfull and faster: normal
does not search relations between trigonometric functions,
ratnormal does only rational simplifications.
reorder reorders a polynomial according to a list of variables.
factorizes over R
over C
partial fraction decomposition over R,
over C.
expand trigonometrics, exponentials and logarithms,
linearizes exponentials,
linearizes trigonometrics,
substitution of one or more variables by one or more values
Trigonometric conversions ,
,
,
,
Others: ,
,
To create a vector, type the coordinates with comma as separator and
[] as delimiters.
scalar product,
cross product in dimension 2 or 3
Matrices are vectors of vectors of the same size and can be typed in
the commandline like A:=[[1,2],[3,4]]. Alternatively, you can
hit Math then matrix to open the matrix assistant
or rand for a matrix with random coefficients.
Line and column indices begin at 0 when indexed by [] and 1 when
indexed by [[]], for
example
or .
You can use +,-,* and
for usual arithmetic operations on matrices.
transposed, : transconjugate,
identity;
linear system,
:
row reduction to echelon form,
: determinant,
: inverse,
: LU decomposition, can be used in
,
characteristic polynomial
minimal polynomial,
eigenvectors and eigenvalues,
Matrix factorizations
,
,
,
Norms
,
,
:
(w.r.t L1, L2 or Linf vector space norm)
Hit math then arit.
Some commands work on integers and polynomials, for example
gcd or lcm.
Otherwise, there are two versions,
the one working on integers begins with
i, like irem (euclidean
remainder for integers) vs rem (euclidean remainder for polynomials).
,
GCD and LCM
,
,
:
remainder and quotient (euclidean integer division)
extended GCD for integers
integer solutions of au+bv=c,
pseudo-primality test,
,
integer factorization,
indicatrix,
fast modular powering.
,
,
:
remainder and quotient for polynomial euclidean division.
The default variable is x, it can be specified as 3rd argument.
extended gcd for polynomials
polynomial solutions for au+bv=c
Horner evaluation,
polynomial interpolation
Use infix mod to work in ℤ/nℤ, for
example x^3+5x-11 mod 17
is a polynomial with coefficients in ℤ/17ℤ.
If you must work in a non prime finite field, run
Equation and system solving:
Hit math
then solve, select exact or approx. and real or
complex,
or enter the commands
)
Differential equation/system solving:
Hit math
then calc
exact solver,
approx. solver, or math, graph
approx. graph.
Recurrent sequences:
hit math then u_n.
The
command tries to find an explicit expression for a recurrent sequence.
Hit math then f(x)
to study a function, or u_n for a sequence,
or calc for calculus commands and assistants for
discrete sums (∑), limits (limit),
derivatives (∂),
antiderivatives and definite integrals (∫),
series expansions
(series).
For example, let's define an univariate function
f, hit prog then
func, set
f as function
x as list of arguments and sin(x^2) as
returned value. Or type in the commandline
Once f is defined, we can compute the value of the function
and derivative like this:
.
' denotes the derivative with respect to x,
for other variables, use
.
The antiderivative command is
, for
example ,
or for a definite integral
.
The et
commands compute a limit or Taylor series (or asymptotic series expansion)
for example
Hit mathrand opens an assistant that build
random numbers.
Continuous distributions commands
,
,
,
,
,
,
,
,
.
Discrete distributions commands
,
,
,
.
Cumulated distributions commands have a
_cdf suffix, one can also get them by passing the
distribution law and arguments to the command.
Inverse cumulated distributions have an
_icdf suffix, there is also an command.
The
will display an histogram of a list of value
(default class minimum 0, default class
size 1, otherwise pass them as arguments).
The
command splits a Markov chain transition matrix.
Hit math then graph
(see also f(x) for function variations).,
Examples of commands
displays the 2d graph of two expressions simultaneously
(sin(x) and x-x^3/6),
displays the 3d graph of x^2-y^2 together with a plane.
You can move the viewpoint with the mouse.
Some geometry commands:
,
,
,
,
,
,
,
,
,
,
, ...
The Prog displays assistants
that will help you enter programmation structures
(test, loop, function). You can add newlines with the \n
button, or with Shift-Enter (or Enter alone if you modify an
existing level). →| indents the current line.
Hit debug to run a function in step by step mode,
this will display local variables, it's very useful to debug
a function.
You can choose syntax compatibility with C/javascript or Python.
Example of program: sum of squares in Xcas syntax
function f(x)
local y,s;
if x > 100000 then return "Number too large"; fi;
s:=0;
for y from 1 to x do
s:=s+y^2;
od
return s;
end:;
Python compatible syntax def f(x):
# local y,s
if x > 100000:
return "Number too large"
s=0
for y in range(x+1):
s=s+y**2
return s
The turtle is a small robot that moves following the user commands,
it will trace the moves with a pen with a selectable color. It may
be used to learn programming.
Click on Prog then Turtle then new
Two levels are created, the first one is for programs/functions that
will be used to make a figure, the second field begins with the
command clearscreen, it will contain the move commands, including
calls to functions defined in the first level.
At the right of the new button, you can select move commands,
forward
(turtle moves forward n steps, default n=10),
backward, tright
(right n degrees, default n=90), etc.
For example, click on the line after clearscreen,
then forward then tleft, press Enter, the turtle
moves 10 pixels left and will turn left, heading to the top.
The first field is a normal level where you can write utilities
functions,
with the help of the prog assistants (test, loop, func).
Example: square, regular polygons
Xcas or
Python,
Merry Xcas,
Merry Xcas (Python version)
The French turtle
manual explain all these commands and contains many examples
of scenarios to teach programming to young childrens.