summaryrefslogtreecommitdiff
path: root/Theory_Of_Machines/ch12.ipynb
blob: 22e6fba931e7d8f1183b5b13d34b50ede77099a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
{
 "metadata": {
  "name": "",
  "signature": "sha256:844073ad5c928bfdaf4248256fc5562a2dc71b1c2156a1230e38f2c366a18bf7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12 : Toothed Gearing"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.1 Page No : 393"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "P = 120.*1000 \t\t\t#W\n",
      "d = 250./1000\n",
      "r = d/2 \t\t\t#m\n",
      "N = 650. \t\t\t#rpm\n",
      "phi = 20. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the gear\n",
      "omega = 2*math.pi*N/60 \t\t\t#rad/s\n",
      "#Calculating the torque transmitted\n",
      "T = P/omega \t\t\t#N-m\n",
      "#Calculating the math.tangential load on the pinion\n",
      "FT = T/r \t\t\t#N\n",
      "#Calculating the total load due to power transmitted\n",
      "F = FT/(math.cos(math.radians(phi))*1000) \t\t\t#kN\n",
      "\n",
      "#Results:\n",
      "print \" Total load due to power transmitted, F  =  %.2f kN.\"%(F)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Total load due to power transmitted, F  =  15.01 kN.\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.2 Page No : 397"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "T = 40.\n",
      "t = T\n",
      "phi = 20. \t\t\t#degrees\n",
      "m = 6.   \t\t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*m \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = 1.75*pc \t\t\t#Length of arc of contact mm\n",
      "#Calculating the length of path of contact\n",
      "Lpc = Lac*math.cos(phi) \t\t\t#Length of path of contact mm\n",
      "#Calculating the pitch circle radii of each wheel\n",
      "R = m*T/2 \t\t\t#mm\n",
      "r = R \t\t\t#mm\n",
      "#Calculating the radius of the addendum circle of each wheel\n",
      "RA = math.sqrt(R**2*(math.cos(phi))**2+(Lpc/2+R*math.sin(phi))**2) \t\t\t#mm\n",
      "#Calculating the addendum of the wheel\n",
      "Ad = RA-R \t\t\t#Addendum of the wheel mm\n",
      "\n",
      "#Results:\n",
      "print \" Addendum of the wheel  =  %.2f mm.\"%(Ad)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Addendum of the wheel  =  6.17 mm.\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.3 Page No : 398"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "t = 30.\n",
      "T = 80.\n",
      "phi = 20. \t\t\t#degrees\n",
      "m = 12. \t\t\t#mm\n",
      "Addendum = 10. \t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Length of path of contact:\n",
      "#Calculating the pitch circle radius of pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of gear\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of pinion\n",
      "rA = r+Addendum \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of gear\n",
      "RA = R+Addendum \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "#Refer Fig. 12.11\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#Length of arc of contact mm\n",
      "#Contact ratio:\n",
      "#Calculating the circular pitch\n",
      "Pc = math.pi*m \t\t\t#mm\n",
      "#Calculating the contact ratio\n",
      "CR = Lac/Pc \t\t\t#Contact ratio\n",
      "\n",
      "#Results:\n",
      "print \" Length of path of contact, KL  =  %.1f mm.\"%(KL)\n",
      "print \" Length of arc of contact  =  %.2f mm.\"%(Lac)\n",
      "print \" Contact ratio  =  %.1f.\"%(CR)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Length of path of contact, KL  =  52.3 mm.\n",
        " Length of arc of contact  =  55.61 mm.\n",
        " Contact ratio  =  1.5.\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.4 Page No : 399"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "phi = 20. \t\t\t#degrees\n",
      "t = 20.\n",
      "G = 2.\n",
      "m = 5. \t\t\t#mm\n",
      "v = 1.2 \t\t\t#m/s\n",
      "addendum = 1*m \t\t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Angle turned through by pinion when one pair of teeth is in mesh:\n",
      "#Calculating the pitch circle radius of pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of wheel\n",
      "R = m*G*t/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of pinion\n",
      "rA = r+addendum \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of wheel\n",
      "RA = R+addendum \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the angle turned by the pinion\n",
      "angle = Lac*360/(2*math.pi*r) \t\t\t#Angle turned by the pinion degrees\n",
      "#Maximum velocity of sliding:\n",
      "#Calculating the angular speed of pinion\n",
      "omega1 = v*1000/r \t\t\t#rad/s\n",
      "#Calculating the angular speed of wheel\n",
      "omega2 = v*1000/R \t\t\t#rad/s\n",
      "#Calculating the maximum velocity of sliding\n",
      "vS = (omega1+omega2)*KP \t\t\t#mm/s\n",
      "\n",
      "#Results:\n",
      "print \" Angle turned through by pinion when one pair of teeth is in mesh  =  %.2f degrees.\"%(angle)\n",
      "print \" Maximum velocity of sliding, vS  =  %.1f mm/s.\"%(vS)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Angle turned through by pinion when one pair of teeth is in mesh  =  29.43 degrees.\n",
        " Maximum velocity of sliding, vS  =  455.3 mm/s.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.5 Page No : 400"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "T = 40.\n",
      "t = 20.\n",
      "N1 = 2000. \t\t\t#rpm\n",
      "phi = 20. \t\t\t#degrees\n",
      "addendum = 5.\n",
      "m = 5. \t\t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular velocity of the smaller gear\n",
      "omega1 = 2*math.pi*N1/60 \t\t\t#rad/s\n",
      "#Calculating the angular velocity of the larger gear\n",
      "omega2 = omega1*t/T \t\t\t#rad/s\n",
      "#Calculating the pitch circle radius of the smaller gear\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of the larger gear\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of aaddendum circle of smaller gear\n",
      "rA = r+addendum \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of larger gear\n",
      "RA = R+addendum \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the velocity of sliding at the point of engagement\n",
      "vSK = (omega1+omega2)*KP \t\t\t#mm/s\n",
      "#Calculating the velocity of sliding at the point of disengagement\n",
      "vSL = (omega1+omega2)*PL \t\t\t#mm/s\n",
      "#Angle through which the pinion turns:\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#Length of arc of contact mm\n",
      "#Calculating the circumference of pinion\n",
      "C = 2*math.pi*r \t\t\t#Circumference of pinion mm\n",
      "#Calculating the angle through which the pinion turns\n",
      "angle = Lac*360/C \t\t\t#Angle through which the pinion turns degrees\n",
      "\n",
      "#Results:\n",
      "print \" Velocity of sliding at the point of engagement, vSK  =  %.f mm/s.\"%(vSK)\n",
      "print \" Velocity of sliding at the point of disengagement, vsL  =  %.f mm/s.\"%(vSL)\n",
      "print \" Angle through which the pinion turns  =  %.2f degrees.\"%(angle)\n",
      "\n",
      "# answers differ due to rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Velocity of sliding at the point of engagement, vSK  =  3973 mm/s.\n",
        " Velocity of sliding at the point of disengagement, vsL  =  3610 mm/s.\n",
        " Angle through which the pinion turns  =  29.43 degrees.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.6 Page No : 401"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables:\n",
      "phi = 20. \t\t\t#degrees\n",
      "m = 6.\n",
      "addendum = 1*m \t\t\t#mm\n",
      "t = 17.\n",
      "T = 49.\n",
      "\n",
      "#Solution:\n",
      "#Number of pairs of teeth in contact:\n",
      "#Calculating the pitch circle radius of pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of gear\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of pinion\n",
      "rA = r+addendum \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of gear\n",
      "RA = R+addendum \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "#Refer Fig. 12.11\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#Length of arc of contact mm\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*m \t\t\t#mm\n",
      "#Calculating the number of pairs of teeth in contact\n",
      "n = Lac/pc \t\t\t#Number of pairs of teeth in contact\n",
      "#Angle turned by the pinion and gear wheel when one pair of teeth is in contact:\n",
      "#Calculating the angle turned through by the pinion\n",
      "anglep = Lac*360/(2*math.pi*r) \t\t\t#Angle turned through by the pinion degrees\n",
      "#Calculating the angle turned through by the wheel\n",
      "angleg = Lac*360/(2*math.pi*R) \t\t\t#Angle turned through by the gear wheel degrees\n",
      "#Ratio of sliding to rolling motion:\n",
      "#At the instant when the tip of a tooth on the larger wheel is just making contact with its mating teeth\n",
      "r1 = ((1+t/T)*KP)/r \t\t\t#Ratio of sliding velocity to rolling velocity\n",
      "#At the instant when the tip of a tooth on a larger wheel is just leaving contact with its mating teeth\n",
      "r2 = ((1+t/T)*PL)/r \t\t\t#Ratio of sliding velocity to rolling velocity\n",
      "\n",
      "\n",
      "#Results:\n",
      "print \" Number of pairs of teeth in contact  =  %.f.\"%(n)\n",
      "print \" Angle turned through by the pinion  =  %.1f degrees.\"%(anglep)\n",
      "print \" Angle turned through by the gear wheel  =  %.f degrees.\"%(angleg)\n",
      "print \" At the instant when the tip of a tooth on the larger wheel is just\\\n",
      " making contact with its mating teeth, ratio of sliding \\nvelocity to rolling velocity  =  %.2f.\"%(r1)\n",
      "print \" At the instant when the tip of a tooth on a larger wheel is just leaving contact\\\n",
      " with its mating teeth, ratio of sliding velocity to rolling velocity  =  %.3f.\"%(r2)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Number of pairs of teeth in contact  =  2.\n",
        " Angle turned through by the pinion  =  34.6 degrees.\n",
        " Angle turned through by the gear wheel  =  12 degrees.\n",
        " At the instant when the tip of a tooth on the larger wheel is just making contact with its mating teeth, ratio of sliding \n",
        "velocity to rolling velocity  =  0.41.\n",
        " At the instant when the tip of a tooth on a larger wheel is just leaving contact with its mating teeth, ratio of sliding velocity to rolling velocity  =  0.354.\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.7 Page No : 403"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "t = 18.\n",
      "T = 72.\n",
      "phi = 20. \t\t\t#degrees\n",
      "m = 4. \t\t\t    #mm\n",
      "addendump = 8.5 \t\t\t#Addendum on pinion mm\n",
      "addendumg = 3.5 \t\t\t#Addendum on gear  mm\n",
      "\n",
      "#SOlution:\n",
      "#Refer Fig. 12.12\n",
      "#Calculating the pitch circle radius of the pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of the gear\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of the pinion\n",
      "rA = r+addendump \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of the gear\n",
      "RA = R-addendumg \t\t\t#mm\n",
      "#Calculating the radius of the base circle of the pinion\n",
      "O1M = r*math.cos(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the radius of the base circle of the gear\n",
      "O2N = R*math.cos(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "KP = R*math.sin(math.radians(phi))-math.sqrt(RA**2-O2N**2) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-O1M**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of the path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "\n",
      "#Results:\n",
      "print \" Length of the path of contact, KL  =  %.2f mm.\"%(KL)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Length of the path of contact, KL  =  28.04 mm.\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.8 Page No : 406"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "t = 20.\n",
      "T = 40.\n",
      "m = 10. \t\t\t#mm\n",
      "phi = 20. \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Addendum height for each gear wheel:\n",
      "#Calculating the pitch circle radius of the smaller gear wheel\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of the larger wheel\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle for the larger gear wheel\n",
      "RA = math.sqrt((r*math.sin(math.radians(phi))/2+R*math.sin(math.radians(phi)))**2+R**2*(math.cos(math.radians(phi)))**2) \t\t\t#mm\n",
      "#Calculating the addendum height for larger gear wheel\n",
      "addendumg = RA-R \t\t\t#mm\n",
      "#Calculating the radius of addendum circle for the smaller gear wheel\n",
      "rA = math.sqrt((R*math.sin(math.radians(phi))/2+r*math.sin(math.radians(phi)))**2+r**2*(math.cos(math.radians(phi)))**2) \t\t\t#mm\n",
      "#Calculating the addendum height for smaller gear wheel\n",
      "addendump = rA-r \t\t\t#mm\n",
      "#Calculating the length of the path of contact\n",
      "Lpc = (r+R)*math.sin(math.radians(phi))/2 \t\t\t#Length of the path of contact mm\n",
      "#Calculating the length of the arc of contact\n",
      "Lac = Lpc/math.cos(math.radians(phi)) \t\t\t#Length of the arc of contact mm\n",
      "#Contact ratio:\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*m \t\t\t#mm\n",
      "#Calculating the contact ratio\n",
      "CR = Lpc/pc \t\t\t#Contact ratio\n",
      "\n",
      "#Results:\n",
      "print \" Addendum height for larger gear wheel  =  %.1f mm.\"%(addendumg)\n",
      "print \" Addendum height for smaller gear wheel  =  %.1f mm.\"%(addendump)\n",
      "print \" Length of the path of contact  =  %.1f mm.\"%(Lpc)\n",
      "print \" Length of the arc of contact  =  %.1f mm.\"%(Lac)\n",
      "print \" Contact ratio  =  %d.\"%(CR+1)\n",
      "\n",
      "# book answer is wrong for 2nd  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Addendum height for larger gear wheel  =  6.5 mm.\n",
        " Addendum height for smaller gear wheel  =  16.2 mm.\n",
        " Length of the path of contact  =  51.3 mm.\n",
        " Length of the arc of contact  =  54.6 mm.\n",
        " Contact ratio  =  2.\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.9 Page No : 410"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "G = 3.\n",
      "phi = 20. \t\t\t#degrees\n",
      "Aw = 1. \t\t\t#module\n",
      "\n",
      "#Solution:\n",
      "#Calculating the minimum number of teeth for a gear ratio of 3:1\n",
      "t1 = (2*Aw)/(G*(math.sqrt(1+1/G*(1/G+2)*(math.sin(math.radians(phi)))**2)-1))\n",
      "#Calculating the minimum number of teeth for equal wheel\n",
      "t2 = (2*Aw)/(math.sqrt(1+3*(math.sin(math.radians(phi)))**2)-1)\n",
      "\n",
      "#Results:\n",
      "print \" Minimum number of teeth for a gear ratio of 3:1, t  =  %.f.\"%(t1+1)\n",
      "print \" Minimum number of teeth for equal wheel, t  =  %d.\"%(t2+1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Minimum number of teeth for a gear ratio of 3:1, t  =  16.\n",
        " Minimum number of teeth for equal wheel, t  =  13.\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.10 Page No : 410"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "import numpy\n",
      "\n",
      "# Variables:\n",
      "G = 4.\n",
      "phi = 14.5 \t\t\t#degrees\n",
      "\n",
      "#Solution:\n",
      "#Least number of teeth on each wheel:\n",
      "#Calculating the least number of teeth on the pinion\n",
      "t = 2*math.pi/(math.tan(math.radians(phi)))\n",
      "#Calculating the least number of teeth on the gear\n",
      "T = G*t\n",
      "\n",
      "#Results:\n",
      "print \" Least number of teeth on the pinion, t  =  %.1f.\"%(t)\n",
      "print \" Least number of teeth on the gear, T  =  %.f.\"%(round(T,-1))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Least number of teeth on the pinion, t  =  24.3.\n",
        " Least number of teeth on the gear, T  =  100.\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.11 Page No : 411"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "phi = 16. \t\t\t#degrees\n",
      "m = 6. \t\t\t    #mm\n",
      "t = 16.\n",
      "G = 1.75\n",
      "T = G*t\n",
      "N1 = 240. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the pinion\n",
      "omega1 = 2*math.pi*N1/60 \t\t\t#rad/s\n",
      "#Addenda on pinion and gear wheel:\n",
      "#Calculating the addendum on pinion\n",
      "addendump = m*t/2*(math.sqrt(1+T/t*(T/t+2)*(math.sin(math.radians(phi)))**2)-1) \t\t\t#Addendum on pinion mm\n",
      "#Calculating the addendum on wheel\n",
      "addendumg = m*T/2*(math.sqrt(1+t/T*(t/T+2)*(math.sin(math.radians(phi)))**2)-1) \t\t\t#Addendum on wheel mm\n",
      "#Length of path of contact:\n",
      "#Calculating the pitch circle radius of wheel\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the pitch circle radius of pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the addendum circle radius of wheel\n",
      "RA = R+addendump \t\t\t#mm\n",
      "#Calculating the addendum circle radius of pinion\n",
      "rA = r+addendumg \t\t\t#mm\n",
      "#Calculating the length of path of approach\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Maximum velocity of sliding of teeth on either side of pitch point:\n",
      "#Calculating the angular speed of gear wheel\n",
      "omega2 = omega1/G \t\t\t#rad/s\n",
      "#Calculating the maximum velocity of sliding of teeth on the left side of pitch point\n",
      "vmaxl = (omega1+omega2)*KP \t\t\t#Maximum velocity of sliding of teeth on the left side of pitch point mm/s\n",
      "#Calculating the maximum velocity of sliding of teeth on the right side of pitch point\n",
      "vmaxr = (omega1+omega2)*PL \t\t\t#Maximum velocity of sliding of teeth on the right side of pitch point mm/s\n",
      "\n",
      "#Results:\n",
      "print \" Addendum on pinion  =  %.2f mm.\"%(addendump)\n",
      "print \" Addendum on wheel  =  %.2f mm.\"%(addendumg)\n",
      "print \" Length of path of contact, KL  =  %.2f mm.\"%(KL)\n",
      "print \" Maximum velocity of sliding of teeth on the left side of pitch point  =  %d mm/s.\"%(vmaxl)\n",
      "print \" Maximum velocity of sliding of teeth on the right side of pitch point  =  %d mm/s.\"%(vmaxr)\n",
      "\n",
      "# rounding error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Addendum on pinion  =  10.76 mm.\n",
        " Addendum on wheel  =  4.56 mm.\n",
        " Length of path of contact, KL  =  38.39 mm.\n",
        " Maximum velocity of sliding of teeth on the left side of pitch point  =  1044 mm/s.\n",
        " Maximum velocity of sliding of teeth on the right side of pitch point  =  471 mm/s.\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.12 Page No : 412"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "phi = 20. \t\t\t#degrees\n",
      "t = 30.\n",
      "T = 50.\n",
      "m = 4.\n",
      "N1 = 1000. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of thr pinion\n",
      "omega1 = 2*math.pi*N1/60 \t\t\t#rad/s\n",
      "#Sliding velocities at engagement and at disengagement of a pair of teeth:\n",
      "#Calculating the addendum of the smaller gear\n",
      "addendump = m*t/2*(math.sqrt(1+T/t*(T/t+2)*(math.sin(math.radians(phi)))**2)-1) \t\t\t#Addendum of the smaller gear mm\n",
      "#Calculating the addendum of the larger gear\n",
      "addendumg = m*T/2*(math.sqrt(1+t/T*(t/T+2)*(math.sin(math.radians(phi)))**2)-1) \t\t\t#Addendum of the larger gear mm\n",
      "#Calculating the pitch circle radius of the smaller gear\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of the smaller gear\n",
      "rA = r+addendump \t\t\t#mm\n",
      "#Calculating the pitch circle radius of the larer gear\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of the larger gear\n",
      "RA = R+addendumg \t\t\t#mm\n",
      "#Calculating the path of approach\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the angular speed of the larger gear\n",
      "omega2 = omega1*t/T \t\t\t#rad/s\n",
      "#Calculating the sliding velocity at engagement of a pair of teeth\n",
      "v1 = (omega1+omega2)*KP \t\t\t#Sliding velocity at engagement of a pair of teeth mm/s\n",
      "#Calculating the sliding velocity at disengagement of a pair of teeth\n",
      "v2 = (omega1+omega2)*PL \t\t\t#Sliding velocity at disengagement of a pair of teeth mm/s\n",
      "#Contact ratio:\n",
      "#Calculating the length of the arc of contact\n",
      "Lac = (KP+PL)/math.cos(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*m \t\t\t#Circular pitch mm\n",
      "#Calculating the contact ratio\n",
      "CR = Lac/pc \t\t\t#Contact ratio\n",
      "\n",
      "#Results:\n",
      "print \" Sliding velocity at engagement of a pair of teeth  =  %.3f m/s.\"%(v1/1000)\n",
      "print \" Sliding velocity at disengagement of a pair of teeth  =  %.3f m/s.\"%(v2/1000)\n",
      "print \" Contact ratio  =  %d.\"%(CR+1)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Sliding velocity at engagement of a pair of teeth  =  3.438 m/s.\n",
        " Sliding velocity at disengagement of a pair of teeth  =  5.731 m/s.\n",
        " Contact ratio  =  5.\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.13 Page No : 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "G = 3.\n",
      "m = 6.\n",
      "AP = 1*m\n",
      "AW = AP \t\t\t#mm\n",
      "phi = 20. \t\t\t#degrees\n",
      "N1 = 90. \t\t\t#rpm\n",
      "\n",
      "#Solution:\n",
      "#Calculating the angular speed of the pinion\n",
      "omega1 = 2*math.pi*N1/60 \t\t\t#rad/s\n",
      "#Calculating the number of teeth on the pinion to avoid interference on it\n",
      "t = 2*AP/(math.sqrt(1+G*(G+2)*(math.sin(math.radians(phi)))**2)-1)\n",
      "#Calculating the corresponding number of teeth on the wheel\n",
      "T = G*t\n",
      "#Length of path and arc of contact:\n",
      "#Calculating the pitch circle radius of pinion\n",
      "r = m*t/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of pinion\n",
      "rA = r+AP \t\t\t#mm\n",
      "#Calculating the pitch circle radius of wheel\n",
      "R = m*T/2 \t\t\t#mm\n",
      "#Calculating the radius of addendum circle of wheel\n",
      "RA = R+AW \t\t\t#mm\n",
      "#Calculating the path of approach\n",
      "KP = math.sqrt(RA**2-R**2*(math.cos(math.radians(phi)))**2)-R*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the path of recess\n",
      "PL = math.sqrt(rA**2-r**2*(math.cos(math.radians(phi)))**2)-r*math.sin(math.radians(phi)) \t\t\t#mm\n",
      "#Calculating the length of path of contact\n",
      "KL = KP+PL \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#Length of arc of contact mm\n",
      "#Number of pairs of teeth in contact:\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*m \t\t\t#mm\n",
      "#Calculating the number of pairs of teeth in contact\n",
      "n = Lac/pc \t\t\t#Number of pairs of teeth in contact\n",
      "#Maximum velocity of sliding:\n",
      "#Calculating the angular speed of wheel\n",
      "omega2 = omega1*t/T \t\t\t#rad/s\n",
      "#Calculating the maximum velocity of sliding\n",
      "vs = (omega1+omega2)*KP \t\t\t#mm/s\n",
      "\n",
      "#Results:\n",
      "print \" Number of teeth on the pinion to avoid interference, t  =  %d.\"%(t+1)\n",
      "print \" Corresponding number of teeth on the wheel, T  =  %.F.\"%(T+1)\n",
      "print \" Length of path of contact, KL  =  %.2f mm.\"%(KL)\n",
      "print \" Length of arc of contact  =  %.2f mm.\"%(Lac)\n",
      "print \" Number of pairs of teeth in contact  =  %d.\"%(n+1)\n",
      "print \" Maximum velocity of sliding, vs  =  %.f mm/s.\"%(vs)\n",
      "\n",
      "# ROUNDING ERROR"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Number of teeth on the pinion to avoid interference, t  =  19.\n",
        " Corresponding number of teeth on the wheel, T  =  56.\n",
        " Length of path of contact, KL  =  29.24 mm.\n",
        " Length of arc of contact  =  31.12 mm.\n",
        " Number of pairs of teeth in contact  =  2.\n",
        " Maximum velocity of sliding, vs  =  197 mm/s.\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.14 Page No : 416"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "T = 20.\n",
      "d = 125.          #mm\n",
      "r = d/2\n",
      "OP = r\n",
      "LH = 6.25 \t\t\t#mm\n",
      "#Calculating the least pressure angle to avoid interference\n",
      "phi = math.sin(math.sqrt(LH/r))*180/math.pi \t\t\t#degrees\n",
      "#Length of arc of contact:\n",
      "#Calculating the length of path of contact\n",
      "KL = math.sqrt((OP+LH)**2-(OP*math.cos(math.radians(phi)))**2) \t\t\t#mm\n",
      "#Calculating the length of arc of contact\n",
      "Lac = KL/math.cos(math.radians(phi)) \t\t\t#Length of arc of contact mm\n",
      "#Minimum number of teeth:\n",
      "#Calculating the circular pitch\n",
      "pc = math.pi*d/T \t\t\t#mm\n",
      "#Calculating the number of pairs of teeth in contact\n",
      "n = Lac/pc \t\t\t#Number of pairs of teeth in contact\n",
      "#Calculating the minimum number of teeth in contact\n",
      "nmin = n \t\t\t#Mimimum number of teeth in contact\n",
      "\n",
      "#Results:\n",
      "print \" Least pressure angle to avoid interference, phi  =  %.3f degrees.\"%(phi)\n",
      "print \" Length of arc of contact  =  %.2f mm.\"%(Lac)\n",
      "print \" Minimum number of teeth in contact  =  %d or %d pair.\"%(nmin+1,(nmin+1)/2)\n",
      "\n",
      "# rounding error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Least pressure angle to avoid interference, phi  =  17.818 degrees.\n",
        " Length of arc of contact  =  36.17 mm.\n",
        " Minimum number of teeth in contact  =  2 or 1 pair.\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.15 Page No : 421"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import linalg\n",
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "\n",
      "# Variables:\n",
      "L = 175./1000\n",
      "d2 = 100./1000        #m\n",
      "r2 = d2/2 \t\t\t  #m\n",
      "theta = 70. \t\t\t#degrees\n",
      "G = 1.5\n",
      "T2 = 80.\n",
      "Tf = 75. \t\t\t#Torque on faster wheel N-m\n",
      "\n",
      "#Solution:\n",
      "#Spiral angles for each wheel:\n",
      "#Calculating the number of teeth on slower wheel\n",
      "T1 = T2*G\n",
      "#Calculating the pitch circle diameter of the slower wheel\n",
      "d1 = (L*2)-d2 \t\t\t#m\n",
      "#Calculating the spiral angles\n",
      "#We have d2/d1  =  (T2*math.cos(alpha1))/(T1*math.cos(alpha2)) or T2*d1*math.cos(alpha1)-T1*d2*math.cos(alpha2)  =  0    .....(i)\n",
      "#Also alpha1+alpha2  =  theta or alpha1+alpha2-theta  =  0                                           .....(ii)\n",
      "def f(x):\n",
      "    alpha1 = x[0]\n",
      "    alpha2 = x[1]\n",
      "    y = [0,0]\n",
      "    y[0] = T2*d1*math.cos(alpha1)-T1*d2*math.cos(alpha2)\n",
      "    y[1] = alpha1+alpha2-theta*math.pi/180\n",
      "    return y\n",
      "    \n",
      "z = fsolve(f,[1,1])\n",
      "alpha1 = z[0]*180/math.pi \t\t\t#Spiral angle for slower wheel degrees \n",
      "alpha2 = z[1]*180/math.pi \t\t\t#Spiral angle for faster wheel degrees\n",
      "#Axial thrust on each shaft:\n",
      "#Calculating the math.tangential force at faster wheel\n",
      "F2 = Tf/r2 \t\t\t#N\n",
      "#Calculating the normal reaction at the point of contact\n",
      "RN = F2/math.cos(math.radians(alpha2)) \t\t\t#N\n",
      "#Calculating the axial thrust on the shaft of slower wheel\n",
      "Fa1 = RN*math.sin(math.radians(alpha1)) \t\t\t#N\n",
      "#Calculating the axial thrust on the shaft of faster wheel\n",
      "Fa2 = RN*math.sin(math.radians(alpha2)) \t\t\t#N\n",
      "\n",
      "#Results:\n",
      "print \" Spiral angle for slower wheel, alpha1  =  %.2f degrees.\"%(alpha1)\n",
      "print \" Spiral angle for faster wheel, alpha2  =  %.2f degrees.\"%(alpha2)\n",
      "print \" Axial thrust on the shaft of slower wheel, Fa1 =  %d N.\"%(Fa1+1)\n",
      "print \" Axial thrust on the shaft of faster wheel, Fa2  =  %d N.\"%(Fa2+1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Spiral angle for slower wheel, alpha1  =  54.65 degrees.\n",
        " Spiral angle for faster wheel, alpha2  =  15.35 degrees.\n",
        " Axial thrust on the shaft of slower wheel, Fa1 =  1269 N.\n",
        " Axial thrust on the shaft of faster wheel, Fa2  =  412 N.\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.16 Page No : 422"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables:\n",
      "L = 400./1000 \t\t\t#m\n",
      "G = 3.\n",
      "theta = 50.\n",
      "phi = 6. \t\t\t#degrees\n",
      "pN = 18. \t\t\t#mm\n",
      "\n",
      "#Solution:\n",
      "#Number of teeth on each wheel:\n",
      "#Calculating the spiral angles of the driving and driven wheels\n",
      "alpha1 = theta/2 \t\t\t#degrees\n",
      "alpha2 = alpha1 \t\t\t#degrees\n",
      "#Calculating the number of teeth on driver wheel\n",
      "T1 = L*1000*2*math.pi/(pN*(1/math.cos(math.radians(alpha1))+G/math.cos(math.radians(alpha2))))\n",
      "#Calculating the number of teeth on driven wheel\n",
      "T2 = G*T1\n",
      "#Calculating the exact centre distance\n",
      "#L1 = pN*T1/(2*math.pi)*(1/math.cos(math.radians(alpha1))+G/math.cos(math.radians(alpha2))) \t\t\t#mm\n",
      "L1 = pN*T1/(2*math.pi)*((1+G)/math.cos(math.radians(alpha1))) \t\t\t#mm\n",
      "#Calculating the efficiency of the drive\n",
      "eta = (math.cos(math.radians(alpha2+phi))*math.cos(math.radians(alpha1)))/(math.cos(math.radians(alpha1-phi))*math.cos(math.radians(alpha2)))*100 \t\t\t#%\n",
      "\n",
      "#Results:\n",
      "print \" Number of teeth on driver wheel, T1  =  %d.\"%(T1+1)\n",
      "print \" Number of teeth on driven wheel, T2  =  %.f.\"%(T2+1)\n",
      "print \" Exact centre distance, L1  =  %.1f mm.\"%(L1)\n",
      "print \" Efficiency of the drive, eta  =  %.1f %%.\"%(eta)\n",
      "\n",
      "# rounding off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Number of teeth on driver wheel, T1  =  32.\n",
        " Number of teeth on driven wheel, T2  =  96.\n",
        " Exact centre distance, L1  =  400.0 mm.\n",
        " Efficiency of the drive, eta  =  90.7 %.\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.17 Page No : 423"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import linalg\n",
      "from scipy.optimize import fsolve \n",
      "import math \n",
      "\n",
      "# Variables:\n",
      "pN = 12.5\n",
      "L = 134. \t\t\t#mm\n",
      "theta = 80.\n",
      "phi = 6. \t\t\t#degrees\n",
      "G = 1.25\n",
      "\n",
      "#Solution:\n",
      "#Spiral angle of each wheel:\n",
      "#Calculating the spiral angles of wheels 1 and 2\n",
      "#We have d2/d1  =  (T2*math.cos(alpha1))/(T1*math.cos(alpha2)) or math.cos(alpha1)-G*math.cos(alpha2)  =  0          .....(i)\n",
      "#Also alpha1+alpha2  =  theta or alpha1+alpha2-theta  =  0                                           .....(ii)\n",
      "def f(x):\n",
      "    alpha1 = x[0]\n",
      "    alpha2 = x[1]\n",
      "    y = [0,0]\n",
      "    y[0] = math.cos(alpha1)-G*math.cos(alpha2)\n",
      "    y[1] = alpha1+alpha2-theta*math.pi/180\n",
      "    return y\n",
      "\n",
      "z = fsolve(f,[1,1])\n",
      "alpha1 = z[0]*180/math.pi \t\t\t#Spiral angle for slower wheel degrees\n",
      "alpha2 = z[1]*180/math.pi \t\t\t#Spiral angle for faster wheel degrees\n",
      "#Number of teeth on each wheel:\n",
      "#Calculating the diameters of the wheels\n",
      "d1 = L\n",
      "d2  =  d1 \t\t\t#mm\n",
      "#Calculating the number of teeth on wheel 1\n",
      "T1 = d1*math.pi*math.cos(math.radians(alpha1))/pN\n",
      "#Calculating the number of teeth on wheel 2\n",
      "T2 = T1/G\n",
      "#Calculating the efficiency of the drive\n",
      "eta = (math.cos(math.radians(alpha2+phi))*math.cos(math.radians(alpha1)))/(math.cos(math.radians(alpha1-phi))*math.cos(math.radians(alpha2)))*100 \t\t\t#%\n",
      "#Calculating the maximum efficiency\n",
      "etamax = (math.cos(math.radians(theta+phi))+1)/(math.cos(math.radians(theta-phi))+1)*100 \t\t\t#%\n",
      "\n",
      "#Results:\n",
      "print \" Spiral angle for slower wheel, alpha1  =  %.2f degrees.\"%(alpha1)\n",
      "print \" Spiral angle for faster wheel, alpha2  =  %.2f degrees.\"%(alpha2)\n",
      "print \" Number of teeth on wheel 1, T1  =  %.1f.\"%(T1)\n",
      "print \" Number of teeth on wheel 2, T2  =  %.f.\"%(T2+1)\n",
      "print \" Efficiency of the drive, eta  =  %d %%.\"%(eta+1)\n",
      "print \" Maximum efficiency, etamax  =  %.1f %%.\"%(etamax)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Spiral angle for slower wheel, alpha1  =  32.46 degrees.\n",
        " Spiral angle for faster wheel, alpha2  =  47.54 degrees.\n",
        " Number of teeth on wheel 1, T1  =  28.4.\n",
        " Number of teeth on wheel 2, T2  =  24.\n",
        " Efficiency of the drive, eta  =  83 %.\n",
        " Maximum efficiency, etamax  =  83.9 %.\n"
       ]
      }
     ],
     "prompt_number": 57
    }
   ],
   "metadata": {}
  }
 ]
}