Mathematics:
____________________________

All angles are in radians.

ABS(x) - Absolute value of x
COS(x) - Cosine of x
SIN(x) - Sine of x
TAN(x) - Tangent of x
ACOS(x) - Arc cosine of x
ASIN(x) - Arc sine of x
ATAN(x) - Arc tangent of x
ATAN2(x,y) - Arc tangent
  of two variables

Hyperbolic functions:

COSH(x), SINH(x), TANH(x)
ACOSH(x), ASINH(x), ATANH(x)

EXP(x) - the value of e
  raised to the power of x
LOG(x) - natural logarithm
  of x
LOG10(x) - the base-10
  logarithm of x

POW(x,y) - x raised to
  power of y
SQR(x) - square root of x

INT(x) - rounds x downwards
  to the nearest integer
FIX(x) - rounds x upwards
  to the nearest integer
ROUND(x [,decs])
  rounds the x to the
  nearest integer or
  fp with 'decs' decimal
  digits.

SGN(x) - sign of x
  +1 for positive,
  -1 for negative and
   0 for zero

DEG(x) - radians to degrees
RAD(x) - degrees to radians

____________________________

MAX(...), MIN(...)
ABSMIN(...), ABSMAX(...)

Maximum/Minimum value of
parameters. Parameters can
be anything (arrays, ints,
reals, strings).

ABSMIN/ABSMAX returns the
absolute min/max value.

Example:
? MAX(3,4,8)
? MIN(array(),2,3)
? MAX("abc","def")
____________________________

SUM(...)
    Sum of value

SUMSQ(...)
    Sum of square value 

STATMEAN(...)
    Arithmetical mean

STATMEANDEV(...)
    Mean deviation

STATSPREADS(...)
    Sample spread

STATSPREADP(...)
    Population spread

Notes:
Sample standard deviation:
    SQR(STATSPREADS(array))

Population standard 
   deviation:
    SQR(STATSPREADP(array))
____________________________

LINEQN(A, B [, toler])

Returns an array
with the values of the 
unknowns.
This function solves
equations by using the
Gauss-Jordan method.

A = equations
B = results
toler = tolerance number
  (the absolute value
  lowest acceptable number)
  default = 0 = none

  |x| <= toler : x = 0

Note: The result is a
matrix Nx1. For the SB that
array is two-dimension
array.
____________________________

INVERSE(A)

returns the inverse matrix
of A.
____________________________

DETERM(A[, toler])

Determinant of A

toler = tolerance number
  (the absolute value
  lowest acceptable number)
  default = 0 = none

  |x| <= toler : x = 0
____________________________

INTEGRAL low, high, segs,
  maxerr, BYREF result,
  BYREF errcode USE expr

Simpson's rule.

Example:

FUNC f(x)
  f = 4/(1+x^2)
END

INTEGRAL 0, 1, 1000, 1e-6, 
    rs, er USE f(x)
IF er > 0 THEN
  ? "Value of integral="; rs
ELSE
  ? "Integral did not"
  ? " converge"
ENDIF
____________________________

ROOT low, high, segs,
  maxerr, BYREF result,
  BYREF errcode USE expr
____________________________

DERIV x, maxtries, maxerr
  BYREF result,
  BYREF errcode USE expr
____________________________

DIFFEQN x0, y0, xf, maxseg,
  maxerr, BYREF yf, BYREF er
  USE expr

Runge-Kutta method
____________________________

2D Algebra
____________________________

SEGCOS(Ax,Ay,Bx,By,
                Cx,Cy,Dx,Dy)

SEGSIN(Ax,Ay,Bx,By,
                Cx,Cy,Dx,Dy)

sinus or cosine of 2 
line segments (A->B, C->D).
____________________________

PTDISTSEG(Bx,By,Cx,Cy,Ax,Ay)

Distance of point A from 
line segment B-C

PTDISTLN(Bx,By,Cx,Cy,Ax,Ay)

Distance of point A from 
line B, C
____________________________

PTSIGN(Ax,Ay,Bx,By,Qx,Qy)

The sign of point Q from
line segment A->B
____________________________

SEGLEN(Ax,Ay,Bx,By)

Length of line segment
____________________________

POLYAREA(poly)

Area of polyline
____________________________

POLYEXT poly(), BYREF xmin, 
    BYREF ymin, BYREF xmax, 
    BYREF ymax

Returns the polyline's
extents
____________________________

INTERSECT Ax, Ay, Bx, By,
          Cx, Cy, Dx, Dy,
          BYREF type,
          BYREF Rx, BYREF Ry

Calculates the intersection
of the two line segments
A-B and C-D

Returns:
Rx,Ry = cross

type = cross-type
0 = No cross 
    (R = external cross)
1 = One cross
2 = Parallel
3 = Parallel (many crosses)
4 = The cross is one of the
        line segments edges.
____________________________

2D: 3x3 Matrices

M3IDENT	BYREF m3x3

M3ROTATE BYREF m3x3, 
               angle, x, y

M3SCALE BYREF m3x3, 
               x, y, fx, fy

M3TRANS BYREF m3x3, x, y

M3APPLY m3x3, BYREF poly

Example:

DIM poly(24)
DIM M(2,2)
...

M3IDENT M
M3ROTATE M, pi/2, 0, 0
M3SCALE M, 0, 0, 1.24, 1.24

' Draw the original polyline
DRAWPOLY poly

' Draw the polyline
' rotated by pi/2 from 0,0
' scaled by 1.24 
M3APPLY M, poly
DRAWPOLY poly
____________________________

Strings:
____________________________

LEN(s) - length of string
SPC(n)/SPACE$(n) 
  - returns a string
  of 'n' spaces

OCT$(x) - octal value string
  of x
HEX$(x) - hexadecimal value
  string of x
VAL(s) - numeric value of
  string s
STR$(x) - convert x to 
  string
ASC(s) - ASCII code of first
  character of s
CHR$(x) - returns one-char
  string of character with
  ASCII code x
____________________________

LCASE$(s), UCASE$(s)

Converts the string s to 
lower/upper case

Example:
? LCASE$("Hi"):REM hi
? UCASE$("Hi"):REM HI
____________________________

LTRIM$(s), RTRIM$(s),
                    TRIM$(s)

Removes leading/trailing
spaces from string s

? LEN(LTRIM$("  Hi")):REM 2

TRIM is equal to 
LTRIM(RTRIM(s))
____________________________

LEFT$(s,n), RIGHT$(s,n)

Returns the n number of
leftmost/rightmost chars
of string s
____________________________

LEFTOF$(s1,s2),
RIGHTOF$(s1,s2)

Returns the left/right part
of s1 at the position of the
first occurrence of the
string s2 into string s1

Note: s2 does not included
on new string.
____________________________

LEFTOFLAST$(s1,s2),
RIGHTOFLAST$(s1,s2)

Returns the left/right part
of s1 at the position of the
last occurrence of the
string s2 into string s1

Note: s2 does not included
on new string.
____________________________

MID$(s, start [,length])

Returns the part (length)
of the string s starting
from 'start' position

If the 'length' parameter is
omitted, MID$ returns the
whole string from the pos.
'start'.
____________________________

INSTR([start,] s1, s2)

Returns the position of the
first occurrence of the
string s2 into string s1
(starting from the position
'start')

If there is no match, INSTR
returns 0
____________________________

REPLACE$(source, pos, str
    [, len] )

Writes the 'str' into 'pos'
of 'source' and returns the
new string.

This function replaces
only 'len' characters. The
default value of 'len' is
the length of 'str'.

Examples:

s="123456"

' Cut
? replace$(s,3,"",len(s))

' Replace
? replace$(s,2,"bcd")

' Insert
? replace$(s,3,"cde",0)

' Replace & insert
? replace$(s,2,"RRI",2)
____________________________

STRING$(len,{ascii|str})

Returns a string that is 
contains 'len' times of 
string 'str' or the 
character 'ascii'.
____________________________

SPLIT string, delimiters,
  words() [USE expr]

Returns the words of the
specified string into 
array 'words'

Example:

s$="/etc/temp/filename.ext"

SPLIT s$, "/.", v()
FOR i=0 TO UBOUND(v)
  PRINT i;" [";v(i);"]"
NEXT

displays:
0 []
1 [etc]
2 [temp]
3 [filename]
4 [ext]
____________________________

JOIN words(), delimiters,
  string

Returns the words of the
specified string into 
array 'words'

Example:

s$="/etc/temp/filename.ext"

SPLIT s$, "/.", v()
JOIN v(), "/", s$
PRINT "[";s$;"]"

displays:
[/etc/temp/filename/ext]


