Basic mathematical operators |
Addition ...................... x := y + z;
Subtraction ................... x := y - z;
Multiplication ................ x := y * z;
Division ...................... x := y / z;
A D V E R T I S E M E N T
Integer division .............. x := y div z;
Modulo arithmetic ............. x := y mod z;
Integer Division: One integer is divided by another and the integer part of
the result is returned.
Modulo Arithmetic (Remainder Arithmetic): x := y mod z;
The above finds the remainder of y/z and puts it into x.
Mathematical functions
SQR
Syntax:
Explanation:
SQR returns the square of the real variable that is passed to it, pretty simple
really.
Example:
x := SQR(y)
;
This finds the square of y and puts the result in x.
SQRTSyntax:
Explanation:
SQRT returns the square root of the real variable that is passed to it, pretty
simple really.Example:
x := SQRT(y)
;
This finds the square root of y and puts the result in x.
SINSyntax:
Explantation:
SIN returns the sin of the number that is passed to it. Unfortunately this is in
radians(stupid radians).
2*pi radians is equal to 360 degrees, so to convert from degrees to radians it
is degrees/180 * pi,
and from radians to degrees it is radians/pi * 180. It is a bit of a
hassle but nevermind.
Example:
x := SIN
(y);
This finds the sin of y(radians) and puts the value in x.
COSSyntax:
Explantation:
COS returns the cos of the number that is passed to it. This is also in radians.
If you want to know how to convert
radians into degrees and vice-versa then read the explanation of SIN.
Example:
x := COS(y)
;
This finds the cos of y(radians) and puts the value in x.
ARCTANSyntax:
Explantation:
ARCTAN returns the inverse tanget of the number that is passed to it.
It returns the angle in radians (gasp).
Example:
x := ARCTAN(y);
This finds the inverse tangent, in radians, of y and puts the value in x.
Finding TANGENTTo find tanget just divide sin(Y)
by cos(Y).
e.g x := sin(y)/cos(y);
finds the tangent of y and puts it
in x (remember radians).
Finding INVERSE SIN/COSTo find INVERSE SIN or
INVERSE COS do the following...
INVERSE SIN = ARCTAN(y/sqrt(1-sqr(y)))
INVERSE COS = ARCTAN(sqrt(1-sqr(x))/x)
So x := arctan(y/sqrt(1-sqr(y)));
finds the inverse sin
of y and puts it in x.
So x := arctan(sqrt(1-sqr(x))/x);
finds the inverse cos of y
and puts it in x.