Examples - basics

Ans (last answer)

Ans is useful to eliminate common subexpressions.
(3+4+5)/2; sqrt(ans*(ans-a)*(ans-b)*(ans-c))

Variables

Real numbers, complex numbers, fractions, vectors and matrices can be stored to variables. Names of variables are not case sensitive.
x=7.3e6; a_b=3/2; abc=4+2i; v1=(-1,8,5,-4); m=(7,9,-1\2,-6,11);

Base conversions

Operators dec, hex, bin, oct, baseX are used before a number or an expression. You must prepend 0 to numbers which start with a letter.
oct 75 *  bin1011 - dec 49E3 + hex(0a6f * 8ed E12) - base36(0jiz7 + 6zpq)

Angle units conversions

Operators deg, rad, grad are used after sin, cos, tan, exp.
Operators todeg, torad, tograd are used before asin, acos, atan, ln.
sin deg 60 - tan rad(pi/3) - sec grad 150 - cos 45°;
180 - todeg(acos ans + asin 0.3) + todeg atan sqrt 3;
degtorad ans + pi/2 + torad imag ln(2+3i);
exp 60°i + exp deg(45)i - exp(5+rad(ans)i)

Engineering symbols (mili, kilo, mega, giga, ...)

0.78m + 12k - 8.6M + 2G

Precedence (priority)

sin45^2;      /* = sin(45^2) */
sin(45)^2;    /* = (sin45)^2 */
ln2#3;        /* = ln(2#3) = ln(sqrt 3) */    
ln(2)#3;      /* = (ln2)#3 = 3^(1/ln2) */
3*10 nCr 7+2; /* = 3*(10 nCr 7)+2 */
5*2<<3+1;     /* = (5*2)<<(3+1) */
5|7 xor 4;    /* = 5 or (7 xor 4) */
(a=3,4);      /* = (3,4); a=3 */

Vectors and matrices

a=(6,-7,2.5,4);     /* row vector (list) */
b=(-1\9.2\3\-6);    /* column vector */
e=(7,0,-1\4,8,3);   /* matrix: 3 columns, 2 rows */
a[2]=3;             /* change the 3rd item */
a[2,3]=(2,-3);      /* change list range */
e[1][0]=5;          /* change matrix item in the 2nd row and the 1st column */
e[0]=(4,5,2);       /* change the 1st row */
e[][2]=(-3\1);      /* change the 3rd column */
e[0,1][1,2]=(8,-2\3,7);/* change submatrix */
c=a';               /* convert row to column */
d=b';               /* convert column to row */
(a,d);              /* concatenate (join) lists */
b\c;                /* concatenate column vectors */
listfor(i,5,8,i);   /* = (5, 6, 7, 8) */
rowsfor(i,0,3,i*2+5);/* = (5\ 7\ 9\ 11) */
rowsfor(i,2,3,listfor(j,3,5,i*j));/* = (6, 8, 10 \ 9, 12, 15) */