BlockWerk Documentation
📋

Lookup Table

Math

1-D lookup table with linear interpolation. Maps input values to output values using a set of breakpoints and corresponding table data.

Simulate in BlockWerk

Interactive sandbox directly in your browser — zero installation, WASM-powered.

Simulate in BlockWerk →

Mathematical Model

Given breakpoints x₀ < x₁ < ... < xₙ and table values y₀, y₁, ..., yₙ:

y=yi+(yi+1−yi)x−xixi+1−xiy = y_i + (y_{i+1} - y_i) \frac{x - x_i}{x_{i+1} - x_i}

Extrapolation:

  • clip: output = y₀ if x < x₀, yₙ if x > xₙ
  • linear: extend interpolation slope from nearest interval

Inputs & Outputs

Direction ID Label Type Status
→ In in In number Required
← Out out Out number Output

Parameters

Parameters Label Type Default Description
breakpoints Breakpoints text 0 1 2 3
tableData Table Data hidden 0 1 4 9
interpolation Interpolation select linear
extrapolation Extrapolation select clip

Usage Examples

With breakpoints 0 1 2 3 and table data 0 1 4 9:

  • Input 0.5 → Output 0.5 (interpolated between 0 and 1)
  • Input 1.5 → Output 2.5 (interpolated between 1 and 4)
  • Input 5.0 with clip → Output 9 (clamped to last value)
  • Input 5.0 with linear → Output 19 (extrapolated)

Remarks & Best Practices

  • Breakpoints monotonic: Breakpoints must be strictly increasing; non-monotonic breakpoints produce undefined results
  • Table size: Table data length must exactly match the breakpoints length
  • Extrapolation — clip: Safer for most applications; prevents output from exceeding the defined range
  • Extrapolation — linear: Useful when the trend beyond the last breakpoint is known to continue linearly
  • Performance: O(log n) lookup via binary search; efficient even with thousands of breakpoints

Related Components