beautypg.com

Acos (source) – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 174

background image

Section 8. Processing and Math Instructions

8-2

ACOS (Source)

The ACOS function returns the arc cosine of a number.

Syntax
x = ACOS
(source)

Remarks
The source can be any valid numeric expression that has a value between -1
and 1 inclusive.

The ACOS function takes the ratio of two sides of a right triangle and returns
the corresponding angle. The ratio is the length of the side adjacent to the angle
divided by the length of the hypotenuse. The result is expressed in radians and
is in the range -

π

/2 to

π

/2 radians.

To convert degrees to radians, multiply degrees by

π

/180. To convert radians

to degrees, multiply radians by 180/

π

.

ACOS is the inverse trigonometric function of COSINE, which takes an angle
as its argument and returns the length ratio of the side adjacent to the angle to
the hypotenuse.

ACOS Function Example
The example uses ACOS to calculate

π

. By definition, a full circle is 2

π

radians. ACOS(0) is

π

/2 radians (90 degrees).

Public Pi

'Declare variables.

Pi = 2 * ACOS( 0 )

'Calculate Pi.

AND

Used to perform a logical conjunction on two expressions.

Syntax
result = expr1 And expr2

Remarks
If, and only if, both expressions evaluate True, result is True. If either
expression evaluates False, result is False. The following table illustrates how
result is determined:

If expr1 And expr2

The result

is

is

is

True

True

True

True

False

False

False

True

False

False

False

False

The And operator also performs a bit-wise comparison of identically
positioned bits in two numeric expressions and sets the corresponding bit in
result according to the following truth table: