A Cycling & bikes forum. CycleBanter.com

Go Back   Home » CycleBanter.com forum » rec.bicycles » Techniques
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

program to compute gears, with table



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old September 8th 17, 06:33 AM posted to gnu.emacs.help,rec.bicycles.tech
Emanuel Berg[_2_]
external usenet poster
 
Posts: 1,035
Default program to compute gears, with table

Hey guys, does this look right to you?

;; (print-gears '(34 50) '(12 13 15 17 19 21 23 25) 622)
;;
;; =
;;
;; 622 wheel
;;
;; chainring sprocket gear
;;
;; 34 25 2657.5360544880004
;; 34 23 2888.626146182609
;; 34 21 3163.7333982000005
;; 34 19 3496.7579664315795
;; 50 25 3908.1412566000004
;; 34 17 3908.1412566000004
;; 50 23 4247.97962673913
;; 34 15 4429.226757480001
;; 50 21 4652.549115000001
;; 34 13 5110.64625863077
;; 50 19 5142.291127105264
;; 34 12 5536.5334468500005
;; 50 17 5747.266553823531
;; 50 15 6513.568761
;; 50 13 7515.656262692309
;; 50 12 8141.960951250001

(require 'cl-lib)

(defun compute-gear (chainring sprocket wheel)
(let*((pi 3.14159265)
(radius (/ wheel 2.0))
(circum (* 2 radius pi))
(gear (* (/ chainring sprocket 1.0) circum)))
(list chainring sprocket gear)))

(defun gear (chainrings sprockets wheel)
(let*((gears
(cl-loop for c in chainrings
append (cl-loop for s in sprockets
collect (compute-gear c s wheel) )
)))
(cl-sort gears #'= :key #'cl-caddr)))

(defun print-gears (chainrings sprockets wheel)
(let ((out-buffer (get-buffer-create "*Gears*")))
(with-current-buffer out-buffer
(erase-buffer)
(insert (format "%s wheel\n\n" wheel))
(insert "chainring sprocket gear\n\n")
(let ((gears (gear chainrings sprockets wheel)))
(cl-loop for g in gears
do (let ((c ( car g))
(s ( cadr g))
(d (cl-caddr g)))
(insert (format " %s %s %s\n" c s d)) ))))
(pop-to-buffer out-buffer) ))

--
underground experts united
http://user.it.uu.se/~embe8573
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Table. Marc[_2_] UK 6 November 25th 09 10:29 AM
Is Frame spacing for 7 Gears = to 5 Gears? [email protected] Techniques 4 April 13th 09 12:28 AM
Now that's a table! Bob Downie UK 4 April 16th 07 06:23 PM
Inversion Table Bill B Recumbent Biking 3 October 22nd 04 03:59 AM
Gears gears gear..what to choose? bstephens Techniques 8 February 18th 04 04:06 PM


All times are GMT +1. The time now is 08:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 CycleBanter.com.
The comments are property of their posters.