# Triangle-Generating Functions

This section describes the functions that generate a periodic signal with a triangular wave form (referred to as “triangle”) of a given frequency, phase, magnitude, and asymmetry.

A real periodic signal with triangular wave form x[n] (referred to as a real triangle) of a given frequency rFreq, phase value phase, magnitude magn, and asymmetry h is defined as follows:

`x[n] = magn * cth(2π* rFreq*n + phase)`, n = 0, 1, 2,...

A complexl periodic signal with triangular wave form x[n] (referred to as a complex triangle) of a given frequency rFreq, phase value phase, magnitude magn, and asymmetry h is defined as follows:

`x[n] = magn * [cth(2π* rFreq*n + phase) + j * sth(2π* rFreq*n + phase)]`, n = 0, 1, 2,...

The cth () function is determined as follows:

H = π + h

`cth (α + k* 2π) = cth (α)`, k = 0, ±1, ±2, ...

When H = π , asymmetry h = 0, and function cth() is symmetric and a triangular analog of the cos() function. Note the following equations:

`cth (H/2 + k*π) = 0`, k = 0, ±1, ±2, ...

`cth (k* 2π) = 1`, k = 0, ±1, ±2, ...

`cth (H + k* 2π) = -1`, k = 0, ±1, ±2, ...

The sth () function is determined as follows:

`sth (α + k* 2π) = sth (α)`, k = 0, ±1, ±2, ...

When H = π , asymmetry h = 0, and function sth() is symmetric and a triangular analog of the sine function. Note the following equations:

`sth (α) = cth (α + (3π + h)/2)` , k = 0, ±1, ±2, ...

`sth (k* π) = 0`, k = 0, ±1, ±2, ...

`sth ((π -h)/2 + k* 2π) = 1`, k = 0, ±1, ±2, ...

`sth ((3π +h)/2 + k* 2π) = -1`, k = 0, ±1, ±2, ...

For more complete information about compiler optimizations, see our Optimization Notice.