def create_mapping_function(input_range, output_range): """ Create a function to map a value from an input range to an output range. Parameters: input_range (tuple): The range of input values (min, max). output_range (tuple): The range of output values (min, max). Returns: function: A function that converts values from the input range to the output range. """ input_min, input_max = input_range output_min, output_max = output_range scale = (output_max - output_min) / (input_max - input_min) offset = output_min - input_min * scale def mapping_function(x): return x * scale + offset return mapping_function