summaryrefslogtreecommitdiff
path: root/Mechanics_of_Materials_by_R._C._Hibbeler/Chapter4.ipynb
blob: 8da809d872c6e4de6b7ad7fe8a0e63234641c3e2 (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4:Axial Load"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1 Page no 126"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "a_ab = 1\t\t    #inch**2, area\n",
      "a_bd = 2 \t\t    #inch**2\n",
      "a_bc = a_bd\n",
      "p = 29\t\t\t   #kN, load\n",
      "l_ab = 2\t\t   #ft\n",
      "l_bc = 1.5 \t\t   #ft\n",
      "l_cd = 1 \t     #ft\n",
      "\n",
      "#Calculations\n",
      "#Internal Forces By method of Sections\n",
      "p_bc = 15         #kip\n",
      "p_cd = 7          #kip\n",
      "p_ab=9           #kip\n",
      "#Displacement\n",
      "d=(p_bc*l_ab*12/(a_ab*p*10**3))+(p_cd*l_bc*12/(a_bd*p*10**3))+(p_ab*l_cd*12/(a_bc*p*10**3))\n",
      "d_=p_cd*l_bc*12/(a_bd*p*10**3)\n",
      "\n",
      "#Display\n",
      "print\"The displacement of B relative to C is = +%1.3f mm\",round(d*10,4),\"inch\"\n",
      "print \"Displacement of B relative to C is\",round(d_,5),\"inch\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The displacement of B relative to C is = +%1.3f mm 0.0217 inch\n",
        "Displacement of B relative to C is 0.00217 inch\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2 Page no 127"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "a_ab = 400.0      #mm**2, area\n",
      "d_rod = 10.0      #mm\n",
      "r_rod = d_rod/(2*1000) #radius in m\n",
      "P = 80.0           #kN, load\n",
      "E_st = 200*(10**9) #Pa, pressure\n",
      "E_al = 70*(10**9) #Pa\n",
      "l_ab = 400.0      #mm, length of ab\n",
      "l_bc = 600.0      #mm  length of bc\n",
      "\n",
      "#Calculations\n",
      "#Displacement\n",
      "#delta =PL/AE\n",
      "import math\n",
      "numerator1 = P*(10**3)*(l_bc/1000.0) \n",
      "denominator1 = (math.pi*r_rod**2*E_st)\n",
      "delta_cb = numerator1/denominator1 #to the right\n",
      "numerator2 = -P*(10**3)*(l_ab/1000.0) \n",
      "denominator2 = (a_ab* 10**-6 *E_al)\n",
      "delta_a = -numerator2/denominator2 #to the right\n",
      "delta_c = delta_a+delta_cb\n",
      "\n",
      "#Display\n",
      "print\"The displacement of C with respect to B     = \",round(delta_cb,4),\"m\"\n",
      "print\"The displacement of B with respect to A     = \",round(delta_a,4),\"m\"\n",
      "print'The displacement of C relative to A         = ',round(delta_c*1000,2),\"mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The displacement of C with respect to B     =  0.0031 m\n",
        "The displacement of B with respect to A     =  0.0011 m\n",
        "The displacement of C relative to A         =  4.2 mm\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3 Page no 128"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "d_ac = 20.0                  #mm, ac diameter\n",
      "r_ac = d_ac/(2*1000)\t\t #radius in m\n",
      "d_bd =40.0 \t\t\t     #mm\n",
      "r_bd = d_bd/(2*1000) \t\t#radius in m\n",
      "P = 90.0 \t\t\t\t#kN\n",
      "E_st = 200*(10**9) \t\t#Pa\n",
      "E_al = 70*(10**9) \t\t#Pa\n",
      "l_af = 200.0 \t\t\t#mm\n",
      "l_fb = 400.0 \t\t\t#mm\n",
      "l_bd = 300.0\t\t\t#mm\n",
      "l_ac = l_bd\n",
      "\n",
      "#Calculations\n",
      "#Internal Force\n",
      "P_ac = 60 #kN\n",
      "P_bd = 30 #kN\n",
      "#Displacement\n",
      "import math\n",
      "num1 = -(P_ac*10**3*(l_ac/1000.0))\n",
      "denom1 = math.pi* r_ac**2*E_st\n",
      "delta_a = -num1/denom1 \n",
      "delta_a = delta_a*1000 \n",
      "#Post BD delta = PL/AE\n",
      "num2 = -(P_bd*10**3*(l_bd/1000))\n",
      "denom2 = math.pi* r_bd**2*E_al\n",
      "delta_b = -num2/denom2 \n",
      "delta_b = delta_b*1000 \n",
      "delta_f = delta_b + (0.184)*(l_fb/(l_af+l_fb)) \n",
      "\n",
      "#Display\n",
      "print'The displacement of Post AC       =',round(delta_a,3),\"mm downwards\"\n",
      "print'The displacement of Post BD       =',round(delta_b,3),\"mm downwards\"\n",
      "print'nThe displacement of point F      =',round(delta_f,3),\"mm downwards\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The displacement of Post AC       = 0.286 mm downwards\n",
        "The displacement of Post BD       = 0.102 mm downwards\n",
        "nThe displacement of point F      = 0.225 mm downwards\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5 Page no 139"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "import math\n",
      "d_ab = 5           #mm, ab diameter\n",
      "A = (math.pi/4)*(d_ab/1000)**2\n",
      "gap = 1           #mm\n",
      "P = 20            #kN, pressure\n",
      "E_st = 200        #GPa\n",
      "l_ac = 0.4        #m\n",
      "l_cb = 0.8        #m\n",
      "l_ab = l_ac+l_cb\n",
      "\n",
      "#Calculations\n",
      "#Equilibrium\n",
      "#  Eqn1 -Fa - Fb +P*10**3 = 0 \n",
      "#Compatibility\n",
      "delta_ba = gap/1000.0 #in m\n",
      "delta = delta_ba*(A*E_st*10**9) #delta_ba* Lac/AE \n",
      "\n",
      "#Eqn2 (L/AE)*Fa -(Lb/AE)*Fb = delta_ba\n",
      "#Solving Equations 1 and 2 by matrices\n",
      "Fa=16            #KN\n",
      "Fb=4.05          #KN\n",
      "\n",
      "#Display\n",
      "print\"The reaction force at A = \",Fa,\"kN\"\n",
      "print\"The reaction force at B = \",Fb,\"kN\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reaction force at A =  16 kN\n",
        "The reaction force at B =  4.05 kN\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6 Page no 140"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "P = 9 \t\t     #kip, load\n",
      "E_al = 10        #ksi, \n",
      "E_br = 15        # ksi\n",
      "h = 1.5 \t     #ft\n",
      "ri = 1 \t         #inch\n",
      "ro = 2 \t         #inch\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "A = (math.pi*(ro**2 -ri**2))\n",
      "Ai = math.pi*ri**2\n",
      "#Equilibrium Eqn1 F_al +F_br = P\n",
      "#Compatibility\n",
      "coeff_F_br = (A*E_al)/(Ai*E_br) \n",
      "#Eqn2  F_al- (coeff_F_br*F_br) = 0\n",
      "#Solving equations 1 and 2 using matrices\n",
      "Fal=6  \n",
      "Fbr=3\n",
      "\n",
      "avg_stress_al = Fal/A \n",
      "avg_stress_br = Fbr/Ai \n",
      "avg_stress_al = avg_stress_al/1000\n",
      "avg_stress_br = avg_stress_br/1000\n",
      "\n",
      "#Display\n",
      "print\"The axial force experienced by Al     = \",Fal,\"ksi\"\n",
      "print\"The axial force experienced by Brass  = \",Fbr,\"ksi\"\n",
      "print'The average normal stress in Al       = ',round(avg_stress_al*1000,3),\"ksi\"\n",
      "print'The average normal stress in Al Brass = ',round(avg_stress_br*1000,3),\"ksi\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The axial force experienced by Al     =  6 ksi\n",
        "The axial force experienced by Brass  =  3 ksi\n",
        "The average normal stress in Al       =  0.637 ksi\n",
        "The average normal stress in Al Brass =  0.955 ksi\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7 Page no 141"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "P = 15\t\t #kN. load\n",
      "a_ab = 50 \t#mm**2, area\n",
      "a_ef =a_ab\n",
      "a_cd = 30 \t#mm**2, area\n",
      "l_ef = 0.5 \t#m, ef length\n",
      "l_ce = 0.4 \t#m\n",
      "l_ac = 0.4 \t#m\n",
      "\n",
      "#Calculations\n",
      "#In the y direction    F_a +F_c +F_e = P\n",
      "#of moments -F_a(l_ac)+ P(l_ac/2) +F_e(l_ce) = 0\n",
      "\n",
      "#Compatibility equation for displacemnts\n",
      "coeff_Fc = (1/a_cd) #coefficient of Fc\n",
      "coeff_Fa = (0.5/a_ab) #coefficient of Fc\n",
      "coeff_Fe = (0.5/a_ef) #coefficient of Fc\n",
      "\n",
      "#Solving the 3 Equations\n",
      "F_a=9.52\n",
      "F_b=3.46\n",
      "F_c=2.02\n",
      "#Display\n",
      "print\"The force in rod AB       = \",F_a,\"kN\"\n",
      "print'The force in rod CD       = ',F_b,\"kN\"\n",
      "print'The force in rod EF       = ',F_c,\"kN\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force in rod AB       =  9.52 kN\n",
        "The force in rod CD       =  3.46 kN\n",
        "The force in rod EF       =  2.02 kN\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8 Page no 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "r_o = 0.5\t\t #inch, outside radius\n",
      "r_i = 0.25\t\t#inch, inside radius\n",
      "l = 3 \t\t\t#inch\n",
      "one_turn =20   #threads per inch\n",
      "\n",
      "#calculations\n",
      "import math\n",
      "a_t = (math.pi)*(r_o**2 - r_i**2) #Area of thread\n",
      "a_b = (math.pi*(r_i**2))# Area of bolt\n",
      "# In Y direction F_b - F_t = 0\n",
      "\n",
      "#Compatibility\n",
      "half_turn = one_turn/2.0\n",
      "#Solving the two simultaneous equations for F_b and F_t\n",
      "F_b =11.22       #kip\n",
      "F_t = F_b\n",
      "stress_b = F_b/a_b\n",
      "stress_t = F_t/a_t\n",
      "F_b = F_b/1000.0\n",
      "F_t = F_t/1000.0\n",
      "\n",
      "#Display\n",
      "print'The stress in the bolt ',round(stress_b,1),\"ksi\"\n",
      "print'The stress in the screw   ',round(stress_t,1),\"ksi\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The stress in the bolt  57.1 ksi\n",
        "The stress in the screw    19.0 ksi\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9 Page no 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "import math\n",
      "l_ab = 800 + 400\t\t#mm, ab length\n",
      "P = 20 \t\t         \t#kN, load\n",
      "d = 5/1000.0 \t\t\t#m, diameter\n",
      "area = (math.pi/4.0)*d**2 \t#Cross sectional area\n",
      "l_bbdash = 1/1000.0\t\t#m\n",
      "E = 200.0 \t\t\t#GPa\n",
      "\n",
      "#Calculations\n",
      "#Compatibility\n",
      "delta_p = (P*10**3*0.4)/(area*E*10**9) #delta = PL/AE\n",
      "delta_b = delta_p-l_bbdash\n",
      "F_b = (delta_b*area*E*10**9)/(l_ab/1000.0)\n",
      "F_b = F_b/1000.0\n",
      "\n",
      "#Equilibrium\n",
      "F_a = P - F_b\n",
      "\n",
      "#Display\n",
      "print\"The reaction at A \",round(F_a,2),\"kN\"\n",
      "print'The reaction at B',round(F_b,2),\"kN\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The reaction at A  16.61 kN\n",
        "The reaction at B 3.39 kN\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10 Page no 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "T1 = 60\t\t #degree celcius\n",
      "T2 = 120\t\t#degress celcius\n",
      "l_ab = 0.5\t\t#m\n",
      "area =l_ab**2 \t#m**2\n",
      "alpha = 6.6*10**-6\t# per degree celcius\n",
      "E = 29*10**6 \t\t#kPa\n",
      "\n",
      "#Equilibrium\n",
      "#F_a = F_b = F\n",
      "del_T = T2-T1\n",
      "F = alpha*del_T*area*E                   #Thermal Stress Formula\n",
      "avg_normal_comp_stress = (F*10**-3)/area # sigma = F/A\n",
      "\n",
      "#Display\n",
      "print\"The force at A and B   = \",F/1000,\"kip\"\n",
      "print'The average normal compressive stress  = ',avg_normal_comp_stress,\"ksi\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force at A and B   =  2.871 kip\n",
        "The average normal compressive stress  =  11.484 ksi\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12 Page no 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "area_sleeve = 600*10**-6     #m**2, area\n",
      "area_bolt = 400*10**-6       #m**2, area\n",
      "T1 = 15                      #degree celcius\n",
      "T2 = 80                      #degree celcius\n",
      "alpha_bolt = 12*10**-6       #per degree celcius\n",
      "alpha_sleeve = 23*10**-6     #per degree celcius\n",
      "l = 0.15                    #m\n",
      "E_bolt = 200*10**9 #N/m**2 \n",
      "E_sleeve = 73.1*10**9 #N/m**2 \n",
      "\n",
      "#Equilibrium\n",
      "#F_s = F_b\n",
      "\n",
      "#Compatibility\n",
      "del_T = T2 - T1 \n",
      "delb_T = alpha_bolt*del_T*l \n",
      "delb_F = l/(area_bolt*E_bolt)\n",
      "dels_T = alpha_sleeve*del_T*l \n",
      "dels_F = l/(area_sleeve*E_sleeve)\n",
      "\n",
      "#delb_T + F_b*delb_F = dels_T + F_s*dels_F\n",
      "F_b = (dels_T-delb_T)/(delb_F+dels_F)\n",
      "F_b = F_b/1000 #in kN\n",
      "F_s= F_b\n",
      "\n",
      "#Display\n",
      "print\"The force experienced by sleeve and bolt, Fs=Fb \",round(F_s,1),\"kN\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force experienced by sleeve and bolt, Fs=Fb  20.3 kN\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13 Page no 165"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "yiel = 250      #MPa, yield stress\n",
      "r = 4            #mm, radius\n",
      "width = 40       #mm\n",
      "thick = 2       #mm\n",
      "\n",
      "#a)\n",
      "r_h = r/(width - (2*r))\n",
      "w_h = width/(width - (2*r))\n",
      "K = 1.75\n",
      "area = (thick*(width - (2*r))*10**-6)\n",
      "P_y = (yiel*10**6*area)/K\n",
      "P_y = P_y/1000.0\n",
      "#b)\n",
      "P_p = (yiel*10**6*area)\n",
      "P_p = P_p/1000.0\n",
      "\n",
      "#Display\n",
      "print\"The maximum load P that does not cause the steel to yield \",round(P_y,2),\"kN\"\n",
      "print'The maximum load that the bar can support ',P_p,\"kN\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum load P that does not cause the steel to yield  9.14 kN\n",
        "The maximum load that the bar can support  16.0 kN\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14 Page No:166"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given:\n",
      "P = 60             #KN, load\n",
      "sigmaY= 420       #MPa, bending stress\n",
      "E = 70*10**6       #MPa\n",
      "l1 = 0.1           #m\n",
      "l2 = 0.3           #m\n",
      "r=0.005         #m \n",
      "\n",
      "#Maximum Normal Stress:\n",
      "#r_h = 6/20.0\n",
      "#w_h = 40/20.0\n",
      "#K = 1.6\n",
      "#from sec 4.4\n",
      "Fa=45\n",
      "Fb=15\n",
      "sigmaAC=(Fa/1000.0)/((math.pi)*r**2)\n",
      "sigmaCB=(Fb/1000.0)/((math.pi)*r**2)\n",
      "Fay=sigmaY*10**3*(math.pi)*r**2\n",
      "Fb=P-Fay\n",
      "if sigmaAC>sigmaY:\n",
      "    print\"Calculate sigmaAC again\"\n",
      "else:\n",
      "    print\"It is OK\"    \n",
      "sigmaAC_=sigmaY\n",
      "sigmaCB_=Fb/1000.0/((math.pi)*r**2)\n",
      "if sigmaCB_<sigmaY:\n",
      "    print\"It is OK\"\n",
      "else:\n",
      "    print\"Calculate sigmaAC again\"    \n",
      "dL=Fb*l2/(((math.pi)*r**2)*E)\n",
      "epsilonCB=dL/l2\n",
      "epsilonAC=dL/l1\n",
      "epsilonY=sigmaY*10**6/(E*10**3)\n",
      "sigmaACr=-sigmaAC_+sigmaAC\n",
      "sigmaCBr=sigmaCB_-sigmaCB\n",
      "\n",
      "#Display:\n",
      "print\"Residual stress in AC is\",round(sigmaACr,0),\"MPa\"\n",
      "print\"Residual stress in CB is\",round(sigmaCBr,0),\"MPa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Calculate sigmaAC again\n",
        "It is OK\n",
        "420\n",
        "572.957795131\n",
        "190.98593171\n",
        "343.943726841\n",
        "Residual stress in AC is 153.0 MPa\n",
        "Residual stress in CB is 153.0 MPa\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.15 Page no 168"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "weight = 3.0           #kip, weight\n",
      "l_ab = 20.0            #ft, length\n",
      "l_ac= 20.03          #ft\n",
      "area = 0.05          #inch**2, area\n",
      "sigmaY=50               #ksi\n",
      "\n",
      "#calculations\n",
      "strain_ab = (l_ac-l_ab)/l_ab \n",
      "max_strain = 0.0017 \n",
      "stress_ab = (350*strain_ab)/max_strain\n",
      "F_ab = stress_ab*area \n",
      "E_st = 350/max_strain \n",
      "del1 = l_ab/(area*10**-6*E_st*10**3) \n",
      "del2 = l_ac/(area*10**-6*E_st*10**3) \n",
      "\n",
      "T_ab=sigmaY*area\n",
      "T_ac = weight-T_ab            #kip\n",
      "stress_in_ab = (T_ab*10**3)/area\n",
      "stress = (T_ac)/area\n",
      "strain_ac = (stress*max_strain)/50.0\n",
      "elong_ac = strain_ac*l_ac       #m\n",
      "elong_ab = (l_ac-l_ab)+elong_ac #m\n",
      "\n",
      "#Display\n",
      "print'The force experienced by wire AB  = ',T_ab,\"kip\"\n",
      "print'The force experienced by wire AC  = ',T_ac,\"kip\"\n",
      "print'The elongation in wire AB         = ',round(elong_ab,4),\"ft\"\n",
      "print'The elongation in wire AC         = ',round(elong_ac,5),\"ft\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The force experienced by wire AB  =  2.5 kip\n",
        "The force experienced by wire AC  =  0.5 kip\n",
        "The elongation in wire AB         =  0.0368 ft\n",
        "The elongation in wire AC         =  0.00681 ft\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}