From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Graham" Newsgroups: gmane.emacs.help Subject: Re: program to compute gears, with table Date: Fri, 8 Sep 2017 09:46:01 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <86bmmlu54a.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1504860677 14232 195.159.176.226 (8 Sep 2017 08:51:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 8 Sep 2017 08:51:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 08 10:51:03 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dqEzo-000267-QQ for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Sep 2017 10:50:40 +0200 Original-Received: from localhost ([::1]:43929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqEzv-0003iB-Pk for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Sep 2017 04:50:47 -0400 X-Received: by 10.28.184.81 with SMTP id i78mr141151wmf.2.1504860361657; Fri, 08 Sep 2017 01:46:01 -0700 (PDT) Original-Path: usenet.stanford.edu!c14no1082701wmh.0!news-out.google.com!f137ni9707wme.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help,rec.bicycles.tech Original-Lines: 86 Original-NNTP-Posting-Host: XjSh+LPnq9zmHKuGDl38Pg.user.gioia.aioe.org Original-X-Complaints-To: abuse@aioe.org X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-Priority: 3 X-Antivirus: Avast (VPS 170908-0, 08/09/2017), Outbound message X-Notice: Filtered by postfilter v. 0.8.2 X-Antivirus-Status: Clean X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Original-Xref: usenet.stanford.edu gnu.emacs.help:220089 rec.bicycles.tech:1003484 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114195 Archived-At: "Emanuel Berg" wrote in message news:86bmmlu54a.fsf@zoho.= com... > Hey guys, does this look right to you? > > ;; (print-gears '(34 50) '(12 13 15 17 19 21 23 25) 622) > ;; > ;; =3D> > ;; > ;; 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 #'<=3D :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 Not sure about your code as I do not speak that language but a quick check = gives: 622*3.142*50/25=3D3908.648mm So if your definition of gear is roll out in mm then it looks close. Do not= forget to include the tyre. See: https://www.cateye.com/data/resources/Tire_size_chart_ENG.pdf for approximate circumferences. Taking a 23mm tyre the above example would = be: 2096*50/25=3D4192mm Graham. --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus