Isn't it better to display the logarithm of the gear ratios, translating ratios 
into differences?

--- Den man 27/7/09 skrev Brian Schott <[email protected]>:

> Fra: Brian Schott <[email protected]>
> Emne: Re: [Jprogramming] bicycle gear ratios
> Til: "Programming forum" <[email protected]>
> Dato: mandag 27. juli 2009 13.03
> I know I am beating a dead horse, but
> cannot help myself. I'll blame
> some of my compulsion on my grandson visiting with his bike
> with only
> one crank cog. Anyhow the code is slightly more concise and
> produces
> more useful output, I believe, especially when plotted.
> 
> NB. First the basics, again, but output rearranged and
> plotted.
> 
> rhub=: 32 26 21 18 16 14 12 11
> ccog=: 28 38 48
> 
> indices    =: {@;&(i...@#)
> ratios     =: <"0@(/:~...@[ %/
> \:~...@])  NB. sorted and boxed
> combined   =: ,&>/@,:&, 
>            NB. indices
> and ratios
> gears0     =: indices   
>         combined ratios
> uamend =: ({:"1...@[)`(<@}:"1...@[)`]     
>         NB. to table output
> ccog gears0  rhub
> 
> load'plot'
> flourish =: 'dot;pensize 3;yrange 0 5;title Bike gear
> ratios'
> flourish plot
> ccog(>:@i...@#@]   ;(gears0)uamend}(_1$~,&#))
> rhub
>              
> ccog(>:@i...@#@]|.@,(gears0)uamend}( _$~,&#)) rhub
> 2%~/\ /:~ccog           
>                
>     NB. big cog ratios
> 
> NB. Again, after filtering out Martin's "obliques"
> 
> famend =: _:`((([:< 0 1;~<:@#...@])))`]   
>      NB. fast cog
> samend =: _:`((([:< _1 _2;~0:)))`]     
>      NB. slow cog
> oamend =: _:`((([:< 0 _1;~...@}:@i...@#@])))`]  NB.
> other cog
> amends =: [: oamend}~ [: samend}~ famend}~
> filter0=: (_&~:#])@,@ame...@i.@,&#   
>        NB. most bikes
> filter =: (filter0`(a:"_))@.(1...@[)     
>     NB. for 1=#ccog
> filtgears =: filter{gears0
> ccog filtgears  rhub
> flourish plot
> ccog(>:@i...@#@]   ;(filtgears)uamend}(_1$~,&#))
> rhub
>              
> ccog(>:@i...@#@]|.@,(filtgears)uamend}( _$~,&#)) rhub
> 
> NB. repeat with other gears such as: ccog =: 38
> 
> 
> -- 
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 


      Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på 
LCD TV! Se her http://dk.yahoo.com/r/pat/lcd
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to