Trigonometry

Shipping
trigonometry

Element-wise trig/inverse/hyperbolic with degree/radian conversion

Signature

Inputs

  • signalSignalrequired

Outputs

  • resultSignal

Parameters

KeyTypeDefaultNotes
functionenumsinone of: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh
input_unitenumradiansone of: radians, degrees
output_unitenumradiansone of: radians, degrees

Description

Trigonometry applies a single trigonometric, inverse-trigonometric, or hyperbolic function element-wise to every sample of a Signal. The operation is chosen by the function parameter (sin, cos, tan, asin, acos, atan, sinh, cosh, tanh) and is evaluated independently per sample; timestamps and sample rate pass through unchanged.

The node is angle-aware. input_unit (radians/degrees) controls how the incoming samples are interpreted before evaluation, and output_unit controls the angular convention of the result. For the forward angular functions () the input is an angle, so input_unit=degrees triggers a conversion before the math; the output is a dimensionless ratio, so output_unit has no angular effect. For the inverse functions () the roles reverse: the input is a dimensionless ratio and the result is an angle, so output_unit=degrees scales the returned radians by .

The node is stateless — each block is computed purely from its inputs with no history, so it is safe for real-time streaming and produces identical results regardless of block boundaries. Uncertainty (sigma) is propagated by first-order linearization: , so the output standard deviation is the input sigma scaled by the local slope of the chosen function.

Mathematics

Examples

Generate a sine wave from a phase ramp

Feed a linear phase ramp (in radians) into Trigonometry with function = sin, input_unit = radians. Each sample becomes , turning a sawtooth phase into a clean sinusoid while preserving the original timestamps and sample rate.

Angle of arrival in degrees

Given a normalized ratio channel , use function = asin, output_unit = degrees to recover an incidence angle directly in degrees:

function    = asin
input_unit  = radians   # ignored: input is a ratio
output_unit = degrees   # result scaled by 180/pi

A sample of yields instead of .

Applications

  • Synthesizing and demodulating carriers in signal-processing chains (phase-to-amplitude via sin/cos, quadrature generation).
  • Converting sensor ratios back to physical angles (arcsin/arccos/arctan) in IMU, encoder, and direction-of-arrival pipelines, with output directly in degrees.
  • Evaluating hyperbolic functions (sinh/cosh/tanh) for catenary/cable models, soft-clipping nonlinearities, and transmission-line analysis.
  • Building nonlinear transfer stages inside simulation graphs where an angular quantity must be mapped through a trig curve before further processing.

Neat

Because uncertainty propagates as $\sigma_y = |f'(x)|\,\sigma_x$, a `cos` node automatically zeroes output sigma at its peaks and troughs ($x = k\pi$, where $f'=0$) — the flat extremum is genuinely insensitive to small input perturbations.

The `output_unit` control only bites on the inverse functions and `input_unit` only bites on the forward angular functions; the irrelevant selector is silently a no-op for the chosen function rather than an error.

Known issues

`tan` diverges near $x = \pi/2 + k\pi$ and inherits IEEE-754 behavior there, returning very large finite values or non-finite results as the argument approaches the asymptote.

`asin` and `acos` are only defined for inputs in $[-1,1]$; ratio samples pushed slightly outside this range (e.g. by upstream noise or rounding) yield NaN rather than being clamped.

See also

trigonometryelement-wiseanglehyperbolicnonlinearstateless