I am trying to produce a printout of gear ratios
for a 24-speed bicycle. The first box in the next output
produces the raw gear ratios and the second box is part
of my first attempts at producing a more useful arrangement
of the ratios.  Beware of line wrap in the output: the
shape of the two boxes are 3 8 and 2 8.

   28 38 48 ( (;2 I./\])@ (%/)) 32 26 21 18 16 14 12 11
+------------------------------------------------------------+---------------+
| 0.875 1.07692 1.33333 1.55556  1.75       2 2.33333
2.54545|2 3 5 6 7 8 8 8|
|1.1875 1.46154 1.80952 2.11111 2.375 2.71429 3.16667
3.45455|2 3 4 5 6 7 8 8|
|   1.5 1.84615 2.28571 2.66667     3 3.42857       4
4.36364|               |
+------------------------------------------------------------+---------------+

        By hand, I have put the output into a more desirable
arrangement, and I would like to know how to produce a
similar output with J code. By similar I mean I don't
require boxed output or even the same order of the
boxes, but readable output. The first box in the output
are the gear indices for the rear hub. The other boxes
each contain gear ratios or blanks for each crank cog.


   ;/_4]\"1 ];._2 O   NB. O is produced below ******
+----+----+----+----+
|  1 | 0.9|    |    |
|  2 | 1.1|    |    |
|  1 |    | 1.2|    |
|  3 | 1.3|    |    |
|  2 |    | 1.5|    |
|  1 |    |    | 1.5|
|  4 | 1.6|    |    |
|  5 | 1.8|    |    |
|  3 |    | 1.8|    |
|  2 |    |    | 1.8|
|  6 | 2.0|    |    |
|  4 |    | 2.1|    |
|  3 |    |    | 2.3|
|  7 | 2.3|    |    |
|  5 |    | 2.4|    |
|  8 | 2.5|    |    |
|  4 |    |    | 2.7|
|  6 |    | 2.7|    |
|  5 |    |    | 3.0|
|  7 |    | 3.2|    |
|  6 |    |    | 3.4|
|  8 |    | 3.5|    |
|  7 |    |    | 4.0|
|  8 |    |    | 4.4|
+----+----+----+----+

        My idea for using this output would be to print it
on a piece of paper and use a highlighter to manually
emphasize a desirable shifting sequence. Actually it looks
very simple already to see the sequence I would choose,
but this seems like a challenging coding exercise.

        Beware of line wrap in O below. It is supposed to be
4 lines and would be an adequate result for the J code,
alternatively.

   O =: 0 : 0
  1   2   1   3   2   1   4   5   3   2   6   4   3   7   5
8   4   6   5   7   6   8   7   8
 0.9 1.1     1.3         1.6 1.8         2.0         2.3
2.5
         1.2     1.5             1.8         2.1         2.4
2.7     3.2     3.5
                     1.5             1.8         2.3
2.7     3.0     3.4     4.0 4.4
)

Thanks for considering this problem,

--

(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to