From: Skip Montanaro <skip.montanaro@gmail.com>
To: Emanuel Berg <moasen@zoho.com>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: program to compute gears, with table
Date: Fri, 8 Sep 2017 06:09:30 -0500 [thread overview]
Message-ID: <CANc-5UxUa4GvMQPXh8iimyDkgFfDs_rPfe_GQXmLFX+JrcP_Nw@mail.gmail.com> (raw)
In-Reply-To: <86bmmlu54a.fsf@zoho.com>
Something's fishy. Is the result mm of forward travel per crank revolution?
I'm used to seeing gear inches. Your 50x12 should be about 110 gear inches.
If your output is in millimeters, I get about 320 gear inches, so either
I've mistaken your intended units, or there's a mistake in there somewhere.
A couple nits which won't change anything:
* Why the 1.0 divisor when computing gear?
* You can skip the radius and use wheel (diameter) directly in computing
the circumference.
* It never occurred to me to do this in Lisp. I always just use an online
calculator, like:
http://www.gear-calculator.com/?GR=DERS&KB=34,50&RZ=12,13,15,17,19,21,23,25&UF=2150&TF=90&SL=2.6&UN=KMH
Skip
P.S. My latest acquisition (and oldest bike):
https://www.flickr.com/photos/49705339@N00/albums/72157686279443084
On Fri, Sep 8, 2017 at 12:33 AM, Emanuel Berg <moasen@zoho.com> wrote:
> 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
>
next prev parent reply other threads:[~2017-09-08 11:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-08 5:33 program to compute gears, with table Emanuel Berg
2017-09-08 8:46 ` Graham
2017-09-08 15:50 ` Frank Krygowski
2017-09-08 21:56 ` Emanuel Berg
2017-09-08 17:44 ` Emanuel Berg
2017-09-08 11:09 ` Skip Montanaro [this message]
2017-09-08 11:27 ` tomas
2017-09-08 12:12 ` Skip Montanaro
2017-09-08 17:09 ` David Scheidt
2017-09-08 23:45 ` Emanuel Berg
[not found] ` <mailman.158.1504868984.14750.help-gnu-emacs@gnu.org>
2017-09-08 17:52 ` Emanuel Berg
2017-09-08 19:56 ` Joerg
2017-09-08 19:59 ` David Scheidt
2017-09-08 23:55 ` Emanuel Berg
2017-09-09 19:17 ` Joerg
2017-09-09 19:46 ` Emanuel Berg
2017-09-10 2:06 ` David Scheidt
2017-09-10 14:59 ` Joerg
2017-09-23 5:42 ` DougC
2017-09-23 6:41 ` Emanuel Berg
2017-09-24 1:05 ` Joy Beeson
2017-09-11 5:02 ` Tosspot
2017-09-11 5:19 ` Emanuel Berg
2017-09-08 23:51 ` Emanuel Berg
2017-09-09 21:08 ` Tomas Nordin
2017-09-14 12:24 ` Stefan Monnier
2017-09-14 19:33 ` Tomas Nordin
2017-09-14 20:51 ` Emanuel Berg
2017-09-14 23:49 ` Nick Helm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANc-5UxUa4GvMQPXh8iimyDkgFfDs_rPfe_GQXmLFX+JrcP_Nw@mail.gmail.com \
--to=skip.montanaro@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=moasen@zoho.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.