Welcome to axcas.net. This quick tutorial should get you up and running with ax. When ax is started it prints a welcome message and waits for input. End each line with a semi-colon and ax will print the result along with an equation label (@0, @1, @2, etc).
Integers and rational numbers have arbitrary length, while floating point numbers have 15 digits of precision by default. The digits command enables the use of software floating point routines at higher precision.
ax) Welcome to ax: a computer algebra system | development version for Linux (64-bit) 10+10; 20 10^4; 10000 24/36; 2/3 2.0/3; 0.666666666666667 digits(50); 50 pi(); 3.1415926535897932384626433832795028841971693993751
Numbers and formulae can be assigned to variables using the equals sign. To remove an assignment, set the variable equal to itself.
a = 2; a; 2 2+3*a; 8 a = a; 2+3*a; 2+3*a
Symbolic formulae contain unassigned variables such as x. One example is a polynomial. Here we multiply out (x-1)*(x+1).
expand((x-1)*(x+1)); -1+x^2
It often helps to assign symbolic expressions to variables. Below we assign the polynomial to f, replace x by 3*y-1, and expand the result. The length command returns the size of an expression and square brackets are used to access each term.
f = expand((x-1)*(x+1)); g = replace(f,x,3*y-1); g; -1+(3*y-1)^2 h = expand(g); h; -6*y+9*y^2 length(h); 2 h[0]; -6*y h[1]; 9*y^2
Next we plot a graph of f(x) = (x-1)*(x+1) from -5 <= x <= 5 and -10 <= y <= 10. The plot command creates an image file on the server and provides a link to it.
f = (x-1)*(x+1);The plotimplicit command plots the solutions of f(x,y)=0. Here we let f(x,y) = x^2+y^2-1 and graph the unit circle.
f = x^2+y^2-1;There are also commands for computing with vectors and matrices. To input a vector, use square brackets and separate elements with commas. A matrix is entered as a vector of row vectors.
v = [1,2,3]; w = [4,5,6]; v*w; # dot product 32 # solve A*x = v A = [[2,3,5],[7,11,13],[17,19,23]]; A \ v; [-5/39,-3/26,25/78] determinant([[a,b],[c,d]]); -b*c+a*d
The save command generates a text file of a formula for download. Use this when a computation leads to a large result that you want to keep.
f = expand((1+x+y+z)^20);