markovChainLength function

int markovChainLength(
  1. num temperature, {
  2. required num tStart,
  3. required num tEnd,
  4. int chainLengthStart = 5,
  5. int chainLengthEnd = 20,
})

Returns an integer linearly interpolated between chainLengthStart and chainLengthEnd.

  • markovChainlength(tStart) = mStart,
  • markovChainlength(tEnd) = mEnd.
  • The following must hold: tStart <= temperature <= tEnd.

Implementation

int markovChainLength(
  num temperature, {
  required num tStart,
  required num tEnd,
  int chainLengthStart = 5,
  int chainLengthEnd = 20,
}) =>
    ((chainLengthStart - chainLengthEnd) *
            (temperature - tStart) ~/
            (tStart - tEnd) +
        chainLengthStart);