(*^

::[paletteColors = 128; 
	fontset = title, inactive, nohscroll, noKeepOnOnePage, groupLikeTitle, M0, N18, bold, L1, a0, e6,  24, "Helvetica";
	fontset = subtitle, inactive, nohscroll, noKeepOnOnePage, groupLikeTitle, M18, N18, italic, L1, a0, e0,  10, "Helvetica";
	fontset = subsubtitle, inactive, nohscroll, noKeepOnOnePage, groupLikeTitle, M18, N18, L1, a2, e30,  10, "Helvetica";
	fontset = section, inactive, nohscroll, noKeepOnOnePage, groupLikeSection, M0, N18, bold, L1, a30,  18, "Helvetica";
	fontset = subsection, inactive, nohscroll, noKeepOnOnePage, groupLikeSection, M18, N18, bold, L1, a16,  14, "Helvetica";
	fontset = subsubsection, inactive, nohscroll, noKeepOnOnePage, groupLikeSection, blackBox, M31, N18, bold, L1, a16,  14, "Times";
	fontset = text, inactive, nohscroll, noKeepOnOnePage, M18, N18, L1,  12, "Times";
	fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, M18, N18, L1,  10, "Times";
	fontset = input, nowordwrap, groupLikeInput, M18, N18, L1,  10, "Courier";
	fontset = output, output, inactive, nowordwrap, groupLikeOutput, M18, N18, L-5,  10, "Courier";
	fontset = message, inactive, nowordwrap, groupLikeOutput, M18, N18, L1,  10, "Helvetica";
	fontset = print, inactive, nowordwrap, groupLikeOutput, M18, N18, L1,  10, "Helvetica";
	fontset = info, inactive, nowordwrap, groupLikeOutput, M18, N18, L1,  10, "Helvetica";
	fontset = postscript, output, inactive, nowordwrap, groupLikeGraphics, M18, N18, w456, h460, L1,  10, "Helvetica";
	fontset = name, inactive, nohscroll, noKeepOnOnePage, M18, N18, italic, L1,  9, "Helvetica";
	fontset = header, inactive, nohscroll, noKeepOnOnePage, M9, N18, L1,  10, "Helvetica";
	fontset = Left Header, nohscroll, cellOutline, M9, N18,  10, "Helvetica";
	fontset = footer, inactive, nohscroll, noKeepOnOnePage, M9, N18, L1,  10, "Helvetica";
	fontset = Left Footer, cellOutline, blackBox, M9, N18,  10, "Helvetica";
	fontset = help, inactive, nohscroll, noKeepOnOnePage, M9, N18, L1,  10, "Helvetica";
	fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, M9, N18, L1,  10, "Helvetica";
	fontset = completions, inactive, nohscroll, noKeepOnOnePage, M9, N18, L1,  10, "Helvetica";
	fontset = special1, inactive, nohscroll, noKeepOnOnePage, M0, N18, bold, L1,  18, "Helvetica";
	fontset = special2, inactive, nohscroll, noKeepOnOnePage, M18, N18, bold, L1, e2,  14, "Helvetica";
	fontset = special3, inactive, nohscroll, noKeepOnOnePage, blackBox, M31, N18, bold, L1, e2,  14, "Times";
	fontset = special4, inactive, nohscroll, noKeepOnOnePage, M9, N18, L1,  10, "Helvetica";
	fontset = special5, inactive, nohscroll, noKeepOnOnePage, M9, N18, L1,  10, "Helvetica";]
:[font = title; inactive; ]
Gear Trains
:[font = subtitle; inactive; startGroup; ]
 Kevin McIsaac
:[font = subsubtitle; inactive; ]
Wolfram Research, Inc. 
100 Trade Center Drive 
Champaign, IL   61820
:[font = section; inactive; ]
Introduction
:[font = text; inactive; ]
Mathematica is a powerful language for writing applications. The package Gears.m defines some simple functions for finding gear trains, train ratios, and train velocities. The package was written in about one hour with little previous knowedge of gear trains.
;[s]
4:0,1;11,0;73,2;81,0;260,-1;
3:2,14,10,Times,0,12,0,0,0;1,14,10,Times,2,12,0,0,0;1,14,10,Courier,1,12,0,0,0;
:[font = text; inactive; ]
In Mathematica a gear train is represented as a list of gears. A simple gear is represented as a number of teeth and an angular velocity. A compound gear is represented as a pair of numbers of the teeth and an angular velocity.
;[s]
3:0,0;3,1;14,0;228,-1;
2:2,14,10,Times,0,12,0,0,0;1,14,10,Times,2,12,0,0,0;
:[font = text; inactive; ]
For example, the list, {{10, 400}, {16, 250}}, is a gear train with two simple gears. The first has 10 teeth and rotates at 400 rpm, the second has 15 teeth and rotates at 200 rpm. The train, {{10, 300}, {{15, 3}, 200}, {10, 60}}, has three gears and the second gear is a compound gear with 15 teeth and 3 teeth both rotating at 200 rpm.
:[font = input; endGroup; ]
<<Gears.m
:[font = section; inactive; startGroup; ]
Examples
:[font = text; inactive; ]
Use the GearTrain command to find the gear train with two gears where the first gear has 12 teeth rotating at 200 rpm and the second rotates at 400 rpm. 
;[s]
3:0,0;8,1;17,0;154,-1;
2:2,14,10,Times,0,12,0,0,0;1,14,10,Courier,1,12,0,0,0;
:[font = input; startGroup; ]
GearTrain[{{12, 200}, {g2, 400}}]
:[font = output; output; inactive; endGroup; ]
{{12, 200}, {6, 400}}
;[o]
{{12, 200}, {6, 400}}
:[font = text; inactive; ]
The second gear must have 6 teeth.
:[font = text; inactive; ]
Find a gear train with three gears where the first gear has 24 teeth rotating at 600 rpm, the second is a compound gear with 72 and 48 teeth, and the third has 96 teeth.
:[font = input; startGroup; ]
GearTrain[{{24, 600}, {{72, 48}, r1}, {96, r2}}]
:[font = output; output; inactive; endGroup; ]
{{24, 600}, {{72, 48}, 200}, {96, 100}}
;[o]
{{24, 600}, {{72, 48}, 200}, {96, 100}}
:[font = text; inactive; ]
The second gear rotates at 200 rpm and the third at 100 rpm.
What is the train velocity of this gear train?
:[font = input; startGroup; ]
TrainRatio[%]
:[font = output; output; inactive; endGroup; ]
{6, {3, 2}}
;[o]
{6, {3, 2}}
:[font = text; inactive; ]
The train ratio of the gear train is 6. The TrainRatio command also computes the velocity for each pair of gears. The first pair has a ratio of 3, and the second pair has a ratio of 2. A similar command finds the velocity ratio.
;[s]
3:0,0;44,1;55,0;229,-1;
2:2,14,10,Times,0,12,0,0,0;1,14,10,Courier,1,12,0,0,0;
:[font = input; startGroup; ]
VelocityRatio[%%]
:[font = output; output; inactive; endGroup; ]
{1/6, {1/3, 1/2}}
;[o]
 1   1  1
{-, {-, -}}
 6   3  2
:[font = text; inactive; ]
If the gear train is underdetermined, a symbolic solution is returned. For example, in a three-gear train
:[font = input; startGroup; ]
GearTrain[{{12, 200}, {ti, ri}, {g2, 400}}]
:[font = output; output; inactive; endGroup; ]
{{12, 200}, {2400/ri, ri}, {6, 400}}
;[o]
             2400
{{12, 200}, {----, ri}, {6, 400}}
              ri
:[font = text; inactive; ]
Clearly ri must be chosen so the second gear has an integer number of teeth. The velocity ratio could be computed,
;[s]
3:0,0;8,1;10,0;115,-1;
2:2,14,10,Times,0,12,0,0,0;1,14,10,Courier,1,12,0,0,0;
:[font = input; startGroup; ]
VelocityRatio[%]
:[font = output; output; inactive; endGroup; ]
{2, {ri/200, 400/ri}}
;[o]
     ri   400
{2, {---, ---}}
     200  ri
:[font = text; inactive; endGroup; ]
and also used as a constraint on the choice of ri.
;[s]
3:0,0;47,1;49,0;51,-1;
2:2,14,10,Times,0,12,0,0,0;1,14,10,Courier,1,12,0,0,0;
^*)