Skip to content

XCAS in Basthon ​

Open the console or the notebook in XCAS (URL parameter kernel=xcas). Examples are in the gallery.

The XCAS kernel relies on Giac, the computer algebra engine of XCAS. Results are shown in mathematical form and plots (plot) as images; 3D plots are not available yet.

factor(x^4 - 1)
plot(x^2, x=-2..2, color=red)

What you can do ​

The introduction notebook of the gallery tours the kernel (try it, post).

Exact computation ​

1/3 + 1/6
evalf(pi, 100)
50!

Equations, factorizations, series ​

solve(x^2 - 1)
cfactor(x^4 - 1)
series(exp(x))

Derivatives and antiderivatives ​

A notebook carries out the full study of a function: factored derivative, table of variations (tabvar), limits, tangent plotted with the curve, area under the curve (plotarea) (try it).

integrate((2x + 2) / (x^2 + x + 1))
f(x) := ln(x^2 + x + 1) + 2 / sqrt(3) * arctan((2x + 1) / sqrt(3))
simplify(f'(x))

Linear algebra ​

A := [[1, 0, 1], [1, 1, 1], [0, 1, 0]]
ker(A)
factor(charpoly(A, X))

Plots ​

plot(x^2, x=-2..2, color=red)
plot(cos(exp(x)))

Sequences and programs ​

XCAS can be programmed, with English keywords (for, while, if…) or French ones (pour, tantque, si…). A notebook studies sequences: a cobweb plot drawn by a program, general term (rsolve), threshold algorithm, Collatz sequence (try it):

threshold(s) := {
  local n, u;
  n := 0;
  u := 1;
  while u <= s do
    u := 0.5*u + 3;
    n := n + 1;
  od;
  return n;
}

Arithmetic ​

Integers have no size limit: prime numbers (isprime, nextprime, ifactor), Bézout (iegcd), modular powers (powmod). A notebook uses them to encrypt and decrypt a message with RSA (try it).

Differences with XCAS on a computer ​

Basthon adds no command to Giac:

  • there is no XCAS interface (spreadsheet, interactive geometry, program editor): only the commands, in the console or the notebook;
  • 3D plots are not available yet;
  • there is no filesystem, and a result cannot be downloaded.

Completion ​

The Tab key completes Giac's commands, French synonyms included (fact offers factor, factorial, factoriser…), the keywords (if, for, while, si, pour, tantque…) and the variables and functions defined.

Files and modules ​

The XCAS kernel has neither a filesystem nor modules: extra files and modules are not available.

Downloading a file ​

The XCAS kernel cannot download a file for now.