```> I have a matrix that looks something like this
>
>
>       85        90       100       125        150         175
> 8     1.183    1.118     1.006     0.805      0.671      0.575
> 10    1.847    1.744     1.57      1.256      1.047      0.897
> 12    2.659    2.511      ..        ..           ...        ...
> 16    ...       ...        ..     ...           ...        ..
>
> Say, I have a value of 1.1, I want it to automatically choose the
> closest bigger value i.e. 1.118 and say 8 mm diameter at 90 mm spacing.
> How can this be implemented? I thought of creating hashes. but it seems
> too complicated. If anyone is wondering about the formula it goes like
> this.
>
> value = 2 x area of circle / spacing

This sounds an awful lot like homework.

If there is a finite list of spacings, you can figure out the
ideal diameter for each one (by reversing the formula), round each up to
the closest permited diamiter, and choose the one cooresponding to
the smallest computed value (using the given formula).  Look at
Array#collect, Array#find, Array#sort, and Array#first.

-- MarkusQ

```