> From: Brian Schott
>
> 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
This doesn't give you the boxed output that you want but might be useful?
rhub=: 32 26 21 18 16 14 12 11
ccog=: 28 38 48
ccog (/: {:"1)@(4&$. ,. 5&$.)@:$.@(%/) rhub
0 0 0.875
0 1 1.07692
1 0 1.1875
0 2 1.33333
1 1 1.46154
2 0 1.5
0 3 1.55556
0 4 1.75
1 2 1.80952
2 1 1.84615
0 5 2
1 3 2.11111
2 2 2.28571
0 6 2.33333
1 4 2.375
0 7 2.54545
2 3 2.66667
1 5 2.71429
2 4 3
1 6 3.16667
2 5 3.42857
1 7 3.45455
2 6 4
2 7 4.36364
Or if you want cogs numbered from 1:
ccog (/: {:"1)@(>:@:(4&$.) ,. 5&$.)@:$.@(%/) rhub
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm