That's really nice Martin!
It would make a nice Wiki article.
> From: Martin Neitzel
>
> Brian Schott:
> > I am trying to produce a printout of gear ratios
> >for a 24-speed bicycle.
>
> You must have to tackle some steep mountains... I'm more into road
> racing, and this is my code and gear. The code works for both my
> double and your triple cranks, of course.
>
> NB. First, keep output simple by limiting decimal places.
> NB. Two places after the decimal point seem sufficient here.
>
> 9!:11 ] 2
>
> f =. 39 53
> r =. 25 23 21 19 17 16 15 14 13
> r2=. 27 24 21 19 17 15 14 13 12
> r3=. 21 19 18 17 16 15 14 13 12
>
>
> markers =. {&'.|'@=
> markers r
> |........
> .|.......
> ..|......
> ...|.....
> ....|....
> .....|...
> ......|..
> .......|.
> ........|
>
> marker_combos =. ;:^:_1@(,/)@(;"1/&markers)
> f marker_combos r
> |. |........
> |. .|.......
> |. ..|......
> |. ...|.....
> |. ....|....
> |. .....|...
> |. ......|..
> |. .......|.
> |. ........|
> .| |........
> .| .|.......
> .| ..|......
> .| ...|.....
> .| ....|....
> .| .....|...
> .| ......|..
> .| .......|.
> .| ........|
>
> ratios =. ,@(%/)
> f ratios r
> 1.6 1.7 1.9 2.1 2.3 2.4 2.6 2.8 3 2.1 2.3 2.5 2.8 3.1 3.3 3.5 3.8 4.1
>
> f (marker_combos /: ratios) r
> |. |........
> |. .|.......
> |. ..|......
> |. ...|.....
> .| |........
> |. ....|....
> .| .|.......
> |. .....|...
> .| ..|......
> |. ......|..
> |. .......|.
> .| ...|.....
> |. ........|
> .| ....|....
> .| .....|...
> .| ......|..
> .| .......|.
> .| ........|
>
> f (marker_combos (([ ,. 6j2&":@,....@]) /: ]) ratios) r
> |. |........ 1.56
> |. .|....... 1.70
> |. ..|...... 1.86
> |. ...|..... 2.05
> .| |........ 2.12 <-- not to be used
> |. ....|.... 2.29
> .| .|....... 2.30 <-- not to be used
> |. .....|... 2.44
> .| ..|...... 2.52
> |. ......|.. 2.60
> |. .......|. 2.79 <-- not to be used
> .| ...|..... 2.79
> |. ........| 3.00 <-- not to be used
> .| ....|.... 3.12
> .| .....|... 3.31
> .| ......|.. 3.53
> .| .......|. 3.79
> .| ........| 4.08
>
> A few remarks:
>
> I found Catalogue to be a helpful starting point here, too:
>
> { f ; r
> +-----+-----+-----+-----+-----+-----+-----+-----+-----+
> |39 25|39 23|39 21|39 19|39 17|39 16|39 15|39 14|39 13|
> +-----+-----+-----+-----+-----+-----+-----+-----+-----+
> |53 25|53 23|53 21|53 19|53 17|53 16|53 15|53 14|53 13|
> +-----+-----+-----+-----+-----+-----+-----+-----+-----+
>
> Oblique chain runs are to be avoided since the result in excessive
> wear on the chain. Out of the theoretical 2x9 or 3x8 positions,
> one would avoid "largest chain wheel + first or second largest
> sprocket", "smallest chain wheel + first or second smallest sprocket",
> "middle chain wheel + smallest or largest sprocket". (See markers
> above.)
>
> Fitting in a J expression to filter out such illicit gear combos
> is probably another nice exercise.
>
> Martin
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm