Skip to content

Trigonometry

Angles are in radians; DEG and RAD convert.

Each value is the expression evaluated on its own; a random call draws from a stream seeded 0.

ACOS

ACOS(x): 1 argument.

math.acos, radians.

Example: ACOS(0.5) gives 1.047.

ASIN

ASIN(x): 1 argument.

math.asin, radians.

Example: ASIN(0.5) gives 0.5236.

ATAN

ATAN(x): 1 argument.

math.atan, radians.

Example: ATAN(1) gives 0.7854.

ATAN2

ATAN2(y, x): 2 arguments.

math.atan2, radians in (-pi, pi].

Example: ATAN2(1, 1) gives 0.7854.

COS

COS(x): 1 argument.

math.cos, radians.

Example: COS(PI()) gives -1.

Used in the bundled models Boids flock (continuous, heading).

COSH

COSH(x): 1 argument.

math.cosh, radians.

Example: COSH(1) gives 1.543.

DEG

DEG(x): 1 argument.

radians to degrees.

Example: DEG(PI()) gives 180.

PI

PI(): no arguments.

3.14159.

Example: PI() gives 3.142.

RAD

RAD(x): 1 argument.

degrees to radians: COS(RAD(self.heading)).

Example: RAD(180) gives 3.142.

Used in the bundled models Boids flock (continuous, heading).

SIN

SIN(x): 1 argument.

math.sin, radians.

Example: SIN(PI() / 6) gives 0.5.

Used in the bundled models Boids flock (continuous, heading).

SINH

SINH(x): 1 argument.

math.sinh, radians.

Example: SINH(1) gives 1.175.

TAN

TAN(x): 1 argument.

math.tan, radians.

Example: TAN(RAD(45)) gives 1.

TANH

TANH(x): 1 argument.

math.tanh, radians.

Example: TANH(1) gives 0.7616.

See also