summaryrefslogtreecommitdiff
path: root/Mechanics_of_Materials_by_R_C_Hibbeler/1-Stress.ipynb
blob: 0da90e73db3e82b1ae4d543ab633f77bee755e73 (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
{
"cells": [
 {
		   "cell_type": "markdown",
	   "metadata": {},
	   "source": [
       "# Chapter 1: Stress"
	   ]
	},
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.10: S10.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"disp('Scilab Code Ex 1.10 : ')\n",
"\n",
"//Given:\n",
" af = 800; //N Axial force along centroidal axis\n",
"t = 0.040; //m thickness of square cross section\n",
"ang_b = 30 *(%pi/180) ;\n",
"ang_b_comp = 60 *(%pi/180);\n",
"a = t^2; //m^2 Area of cross section\n",
"a_new = ((t*1000)^2)/(sin(ang_b_comp)); // mm^2 Area of section at b-b\n",
"\n",
"//Part(a)\n",
"\n",
"//Internal Loading: The bar is sectioned, Fig 1-24b, and the internal resultant loading consists of only axial force.\n",
"\n",
"// Average Stress: \n",
"avg_stress = af/(a* 1000);\n",
"\n",
"//Shear Force at the section is zero.\n",
"//The average normal stress distribution over the cross section is shown in Fig 1-24c.\n",
"\n",
"\n",
"//Part(b)\n",
"\n",
"\n",
"//solve the two equations for two unknowns:\n",
"\n",
"N = af * cos(ang_b); \n",
"V = af * sin(ang_b);\n",
"avg_normal_stress = (N*1000)/ a_new; // kPa\n",
"avg_shear_stress = (V*1000)/a_new; //kPa\n",
"\n",
"//Display\n",
"\n",
"printf('\n\nThe average stress for section a-a          = %.2f kPa',avg_stress);\n",
"printf('\nThe Normal Force for section b-b            = %.2f N',N);\n",
"printf('\nThe Shear Force for section b-b             = %.2f N',V);\n",
"printf('\nThe Average Normal Stress for section b-b   = %.2f kPa',avg_normal_stress);\n",
"printf('\nThe Average Shear Stress for section b-b    = %.2f kPa',ceil(avg_shear_stress));\n",
"\n",
"//--------------------------------------------------------------------------END--------------------------------------------------------------------------\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.11: S11.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"disp('Scilab Code Ex 1.11 : ')\n",
"\n",
"//Given :\n",
"f = 5000; //N\n",
"d_rod = 10;//Diameter of steel rod in mm.\n",
"l_bc = 20; //Length of side bc in mm.\n",
"l_bd = 40; //Length of side bd in mm.\n",
"a_rod = (%pi/4)* (d_rod^2); //Area of cross section of the rod in mm^2.\n",
"a_strut = l_bc*l_bd ; //Area of strut in mm^2.\n",
"\n",
"\n",
"//Average shear stress\n",
"\n",
"avg_shear_rod = f/a_rod; //for rod in Mpa\n",
"avg_shear_strut = (f/2)/a_strut; //for strut\n",
"\n",
"//Display:\n",
"\n",
"printf('\n\nThe average shear stress for the rod    = %.2f MPa',avg_shear_rod);\n",
"printf('\nThe average shear stress for the strut  = %.2f MPa',avg_shear_strut);\n",
"\n",
"\n",
"\n",
"//--------------------------------------------------------------END----------------------------------------------------------------------------"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.12: S12.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"\n",
"disp('Scilab Code Ex 1.12 : ')\n",
"\n",
"//Given:\n",
"l_bc = 50; //Length of BC in mm.\n",
"l_db = 75; // mm.\n",
"l_ed = 40; // mm.\n",
"l_ab = 25; // mm.\n",
"f_diagonal = 3000; //N\n",
"a1 = l_ab*l_ed; //Area of face AB in mm^2.\n",
"a2 = l_bc*l_ed ; //mm^2.\n",
"a3 = l_db*l_ed ; // mm^2.\n",
"\n",
"//Internal loadings - The free body diagram of the inclined member is shown in 1-26b. \n",
"\n",
"//Equilibrium Equations\n",
"\n",
"//Balancing forces along the x- direction.\n",
"f_ab = f_diagonal*(3/5); //Force on segment AB in N\n",
"V = f_ab; //Shear force acting on the sectioned horizontal plane EDB in N\n",
"\n",
"//Balancing forces along the Y direction.\n",
"f_bc = f_diagonal*(4/5); //Force on segment BC in N.\n",
"\n",
"//Average compressive stresses along the horizontal and vertical planes:\n",
"\n",
"avg_comp_ab = f_ab/a1; // N/mm^2\n",
"avg_comp_bc = f_bc/a2; // N/mm^2\n",
"\n",
"//Average shear stress acting on the horizontal plane defined by EDB :\n",
"\n",
"avg_shear = f_ab/a3; // N/mm^2\n",
"\n",
"//Display:\n",
"\n",
"\n",
"printf('\n\nThe Force on segment AB                  = %.2f N',f_ab);\n",
"printf('\nThe Shear Force on sectioned plane EDB   = %.2f N',V);\n",
"printf('\nThe Force on segment BC                  = %.2f N',f_bc);\n",
"printf('\nThe average compressive stress along AB  = %.2f N/mm^2',avg_comp_ab);\n",
"printf('\nThe average compressive stress along BC  = %.2f N/mm^2',avg_comp_bc);\n",
"printf('\nThe average shear stress along EDB       = %.2f N/mm^2',avg_shear);\n",
"\n",
"//-------------------------------------------------------------------------------END---------------------------------------------------------------------------\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.13: S13.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"\n",
"clear all; clc;\n",
"\n",
"\n",
"disp('Scilab Code Ex 1.13 : ')\n",
"\n",
"//Given:\n",
"shear_allow = 90; //MPa\n",
"tensile_allow = 115; //MPa\n",
"\n",
"l_AP = 2; //m\n",
"l_PB = 1; //m\n",
"resultant_A = 5.68; //kN\n",
"resultant_B = 6.67; //kN\n",
"v_a = 2.84; //kN\n",
"v_b = 6.67; //kN\n",
"\n",
"\n",
"//Diameter of the Pins:\n",
"A_A = (v_a*10^3)/(shear_allow*10^6); //Area of pin A\n",
"da = (sqrt((4*A_A)/%pi))*10^3 // d = (square root of(area*4/pi)) in mm\n",
"A_B = (v_b*10^3)/(shear_allow*10^6) ; //Area of pin B\n",
"db = (sqrt((4*A_B)/%pi))*10^3 // Area = (%pi\4)d^2 in mm^2\n",
"\n",
"chosen_da = ceil(da);\n",
"chosen_db = ceil(db);\n",
"\n",
"//Diameter of Rod:\n",
"A_bc = (resultant_B*10^3)/(tensile_allow*10^6); //Area of BC\n",
"dbc = (sqrt((4*A_bc)/%pi)*10^3); // Area  = %pi\4)d^2\n",
"chosen_dbc = ceil(dbc);\n",
"\n",
"//Displaying Results:\n",
"\n",
"printf ('\n\n The diameter of pin A   = %.3f mm',da);\n",
"printf ('\n The diameter of pin B   = %.3f mm',db);\n",
"printf ('\n The diameter of rod BC  = %.2f mm',dbc);\n",
"printf ('\n\n\nThe chosen diameters are: ');\n",
"printf ('\n The diameter of pin A   = %.3f mm',chosen_da);\n",
"printf ('\n The diameter of pin B   = %.3f mm',chosen_db);\n",
"printf ('\n The diameter of rod BC  = %.2f mm',chosen_dbc);\n",
"\n",
"//-----------------------------------------------------------------------END--------------------------------------------------------------------\n",
"\n",
"\n",
"\n",
"\n",
" "
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.14: S14.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"\n",
"disp('Scilab Code Ex 1.14 : ')\n",
"\n",
"//Given:\n",
"shear_allow = 55; //MPa\n",
"l_ac = 200; //mm\n",
"l_cd= 75; //mm\n",
"l_de = 50; //mm\n",
"l_ce = l_cd + l_de;\n",
"load_d =15; //kN\n",
"load_e = 25; //kN\n",
"\n",
"//Internal Shear Force:\n",
"//summation Mc = 0\n",
"\n",
"f_ab = ((load_d*l_cd +load_e*(3/5)*l_ce)/l_ac);\n",
"c_x =-load_d + (load_e*(4/5)); //resolving C in x dir\n",
"c_y = load_d + (load_e*(3/5)); //resolving C in y dir\n",
"\n",
"f_c = sqrt(c_x^2 + c_y^2); //kN\n",
"V = f_c/2;\n",
"\n",
"//Required Area\n",
"A = ((V*10^3)/(shear_allow)); //A = V/Allowable shear in mm^2\n",
"d = ((sqrt((4*A)/%pi))) // Area = (%pi\4)d^2 in mm^2\n",
"\n",
"chosen_d = ceil(ceil(d))+1;\n",
"\n",
"//Displaying Results:\n",
"\n",
"\n",
"printf('\n\nThe force at AB           = %.2f kN',f_ab);\n",
"printf('\nThe resultant force at C  = %.2f kN',f_c);\n",
"printf('\nThe area of pin           = %.2f mm^2',A);\n",
"printf('\nThe diameter of pin       = %.2f mm',chosen_d);\n",
"\n",
"//---------------------------------------------------------------END--------------------------------------------------------------------------------------\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.15: S15.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"disp('Scilab Code Ex 1.15 : ')\n",
"\n",
"//Given:\n",
"P= 20; //kN\n",
"d_hole = 40; //mm\n",
"normal_allow = 60; //MPa\n",
"shear_allow = 35; //MPa\n",
"\n",
"\n",
"//Diameter of Rod:\n",
"area1 = (P*10^3)/(normal_allow*10^6); //Area in m^2\n",
"d = ((sqrt((4*area1)/%pi))*1000); // Area = (%pi\4)d^2\n",
"\n",
"\n",
"//Thickness of disc:\n",
"V = P;\n",
"area2 = (V*10^3)/(shear_allow*10^6); //Area in m^2\n",
"thickness = (area2*10^6)/(d_hole*%pi);// A = pi*d*t\n",
" \n",
"\n",
"printf('\n\nThe cross sectional area of disc   = %.8f m^2',area1);\n",
"printf('\nThe diameter of rode               = %.2f mm',d);\n",
"printf('\nThe thickness of disc              = %.2f mm',thickness);\n",
"\n",
"//------------------------------------------------------------------------END------------------------------------------------------------------------------------\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.16: S16.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"disp('Scilab Code Ex 1.16 : ')\n",
"\n",
"//Given:\n",
"bearing_allow = 75; //MPa\n",
"tensile_allow = 55; //MPa\n",
"d_shaft = 60; //mm\n",
"r_shaft = d_shaft/2; //mm\n",
"area_shaft = %pi*(r_shaft^2); //Area = pi*r^2\n",
"d_collar = 80; //mm\n",
"r_collar = d_collar/2; //mm\n",
"area_collar = %pi*(r_collar^2); //Area = pi*r^2\n",
"thick_collar = 20; //mm\n",
"\n",
"//Normal Stress:\n",
"P1 = (tensile_allow* area_shaft)/3; //Tensile stress = 3P/A.\n",
"P1_kN = P1/1000;\n",
"\n",
"\n",
"//Bearing Stress:\n",
"bearing_area = area_collar-area_shaft; //mm^2\n",
"P2 = (bearing_allow*bearing_area)/3; //Bearing stress = 3P/A.\n",
"P2_kN= P2/1000;\n",
"\n",
"if(P2_kN<P1_kN)\n",
"    big = P2_kN;\n",
"else big = P1_kN;\n",
"    end\n",
"    \n",
"//Displaying Results:\n",
"\n",
"printf('\n\nThe load calculated by Normal Stress               = %.1f kN',P1_kN);\n",
"printf('\nThe load calculated by Bearing Stress              = %.1f kN',P2_kN);\n",
"printf('\nThe largest load that can be applied to the shaft  = %.1f kN',big);\n",
"\n",
"//----------------------------------------------------------------------------END----------------------------------------"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.17: S17.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"disp('Scilab Code Ex 1.17 : ')\n",
"\n",
"//Given:\n",
"d_ac= 20; //mm\n",
"area_ac = %pi*(d_ac/2)^2; //Area = (%pi\4)d^2\n",
"area_al = 1800; //mm^2\n",
"d_pins = 18; //mm\n",
"area_pins = %pi*(d_pins/2)^2;\n",
"st_fail_stress = 680; //MPa\n",
"al_fail_stress = 70; //MPa\n",
"shear_fail_pin = 900; //MPa\n",
"fos = 2; //Factor of safety\n",
"l_ab = 2; //m\n",
"l_ap = 0.75; //m\n",
"\n",
"\n",
"st_allow= st_fail_stress /fos; //MPa\n",
"al_allow = al_fail_stress/fos; //MPa\n",
"pin_allow_shear = shear_fail_pin/fos; //MPa\n",
"\n",
"//Rod AC\n",
"f_ac = (st_allow*area_ac)/1000;\n",
"P1 = ((f_ac*l_ab)/(l_ab-l_ap));\n",
"\n",
"//Block B\n",
"f_b =(al_allow*area_al)/1000;\n",
"P2 = ((f_b*l_ab)/l_ap);\n",
"\n",
"//Pin A or C:\n",
"V = (pin_allow_shear*area_pins)/1000;\n",
"P3 = (V*l_ab)/(l_ab-l_ap);\n",
"\n",
"if(P1<P2 & P1<P3)\n",
"    big = P1;\n",
"else if(P2<P1 & P2<P3)\n",
"    big = P2;\n",
"else big = P3;\n",
"end\n",
"\n",
"//Displaying Results:\n",
"\n",
"printf('\n\nThe load allowed on rod AC                      = %.1f kN',round(P1));\n",
"printf('\nThe load allowed on block B                     = %.1f kN',P2);\n",
"printf('\nThe load allowed on pins A or C                 = %.1f kN',P3);\n",
"printf('\nThe largest load that can be applied to the bar = %.1f kN ',big);\n",
"\n",
"//----------------------------------------------------------------------------------END----------------------------------------------------------------------------\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.1: S1.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"disp('Scilab Code Ex 1.1 :')\n",
"\n",
"w_varying = 270;\n",
"l_crossection = 9;\n",
"l_cb = 6;\n",
"l_ac = 2;\n",
"w_c = (w_varying/l_crossection) * l_cb //By proportion, load at C is found.\n",
"f_resultant_c = 0.5* w_c *l_cb \n",
"// Equations of Equilibrium\n",
"\n",
"//Balancing forces in the x direction:\n",
"n_c = 0\n",
"\n",
"//Balncing forces in the y direction:\n",
"v_c = f_resultant_c\n",
"\n",
"// Balncing the moments about C:\n",
"m_c = - (f_resultant_c*l_ac)\n",
"\n",
"\n",
"// Displaying results:\n",
"\n",
"printf('\n\nThe resultant force at C   = %.2f N',f_resultant_c);\n",
"printf('\nThe horizontal force at C  = %.2f N',n_c);\n",
"printf('\nThe vertical force at C    = %.2f N',v_c);\n",
"printf('\nThe moment about C         = %.2f Nm',m_c);\n",
"\n",
"\n",
"// ---------------------------------------------------------END-------------------------------------------------"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.2: S2.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"disp('Scilab Code Ex 1.2 : ')\n",
"\n",
"f_d = 225; //N\n",
"w_uniform = 800; // N/m\n",
"l_ac = 0.200; //m\n",
"l_cb = 0.05+0.1; //m\n",
"l_bd = 0.100;  //m\n",
"l_bearing = 0.05;    //m\n",
"f_resultant = w_uniform*l_cb //120N\n",
"l_f_resultant_b = (l_cb/2)+ l_bearing; //0.125m\n",
"l = l_ac + l_cb + l_bearing + l_bd  \n",
"\n",
"\n",
"// This problem is solved by considering segment AC of the shaft.\n",
"\n",
"//Support Reactions:\n",
"\n",
"m_b = 0;                         // Net moment about B is zero for equilibrium . Sum Mb = 0.\n",
"a_y = -((f_d*l_bd) - (f_resultant*l_f_resultant_b))/ (l - l_bd) // finding the reaction force at A\n",
"\n",
"// Refer to the free body diagram in Fig.1-5c.\n",
"f_c = 40                        //N\n",
"//Balancing forces in the x direction:\n",
"n_c = 0\n",
"\n",
"//Balncing forces in the y direction:\n",
"v_c = a_y - f_c            //-18.75N - 40N-Vc = 0\n",
"\n",
"// Balncing the moments about C:\n",
"m_c =  ((a_y * (l_ac + 0.05)) - f_c*(0.025) ) // Mc+40N(0.025m)+ 18.75N(0.250m) = 0\n",
"\n",
"\n",
"// Displaying results:\n",
"\n",
"printf('\n\nThe resultant force       = %.2f N',f_resultant);\n",
"printf('\nThe reaction force at A   = %.2f N',a_y);\n",
"printf('\nThe horizontal force at C = %.2f N',n_c);\n",
"printf('\nThe vertical force at C   = %.2f N',v_c);\n",
"printf('\nThe moment about C        = %.2f Nm',m_c);\n",
"\n",
"//-------------------------------------------------------------------END-----------------------------------------------------------------------------------------\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.3: S3.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"disp('Scilab Code Ex 1.3 :')\n",
"\n",
"// Given:\n",
"l_ac = 1;     //m.\n",
"l_cd = 1.5 ;  //m.\n",
"l_bd = 0.5;   //m.\n",
"r_a = 0.125;  //m.\n",
"r_d = 0.125;  //m.\n",
"W = 2000; // N\n",
"\n",
"\n",
"// Equations of equilibrium:\n",
"\n",
"//Balancing forces in the x direction:\n",
"n_c = -W; // N\n",
"\n",
"//Balncing forces in the y direction:\n",
"v_c = -W; //N\n",
"\n",
"// Balncing the moments about C:\n",
"m_c = - (W*(r_a +l_ac)- W*r_a)\n",
"\n",
"\n",
"// Displaying results:\n",
"\n",
"printf('\n\nThe horizontal force at C   = %.2f N',n_c);\n",
"printf('\nThe vertical force at C     = %.2f N',v_c);\n",
"printf('\nThe moment about C          = %.2f Nm',m_c);\n",
"\n",
"//----------------------------------------------------------------------------END--------------------------------------------------------------------------------------------\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.4: S4.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"disp('Scilab Code Ex 1.4 :')\n",
"\n",
"// Given:\n",
"l_ag = 1; //Length of AG is 1m.\n",
"l_gd = 1; //Length of GD is 1m.\n",
"l_de = 3; //Length of DE is 1m.\n",
"f_a = 1500; //Force at A is 1500N.\n",
"l_ec = 1.5;  //Length of EC is 1m.\n",
"l = l_ag +l_gd +l_de;\n",
"w_uniform_varying = 600; //Nm.\n",
"\n",
"w_resultant = 0.5*l_de*w_uniform_varying;\n",
"// calling point of action of resultant as P\n",
"l_ep = (2/3)*l_de; //Distance between points P and E.\n",
"l_ap = l - l_ep; // Distance between points A and P.\n",
"\n",
"\n",
"f_ba = 7750; //N\n",
"f_bc = 6200; //N\n",
"f_bd = 4650; //N\n",
"\n",
"//Free Body Diagram: Using the result for Fba, the left section AG of the beam is shown in Fig 1-7d.\n",
"\n",
"// Equations of equilibrium:\n",
"\n",
"//Balancing forces in the x direction:\n",
"n_g = -f_ba * (4/5); // N\n",
"\n",
"//Balncing forces in the y direction:\n",
"v_g = -f_a + f_ba*(3/5); //N\n",
"\n",
"// Balncing the moments about C:\n",
"m_g = (f_ba * (3/5)*l_ag) - (f_a * l_ag); //Nm\n",
"\n",
"\n",
"\n",
"// Displaying results:\n",
"\n",
"\n",
"printf('\n\nThe horizontal force at G = %.2f N',n_g);\n",
"printf('\nThe vertical force at G   = %.2f N',v_g);\n",
"printf('\nThe moment about G        = %.2f Nm',m_g);\n",
"\n",
"\n",
"//-------------------------------------------------------------------END----------------------------------------------------------------------------------------"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.5: S5.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"\n",
"disp('Scilab Code Ex 1.5 :')\n",
"\n",
"// Given:\n",
"f_a = 50; //N\n",
"m_a = 70; // Moment at A in Nm\n",
"l_ad = 1.25; //Length of AD in m.\n",
"l_bd = 0.5; //Length of BD in m.\n",
"l_cb = 0.75; //Length of BC in m.\n",
"w_l  = 2; //Kg/m\n",
"g = 9.81; //N/kg- acceleration due to gravity\n",
"\n",
"\n",
"\n",
"//Free Body Diagram :\n",
"\n",
"w_bd = w_l*l_bd*g; //in N. Weight of each segment of pipe that acts through the centre of gravity of each segment.\n",
"w_ad = w_l*l_ad*g;\n",
"\n",
"// Equations of Equilibrium\n",
"\n",
"//Balancing forces in the x direction:\n",
"f_b_x = 0; // N\n",
"\n",
"//Balncing forces in the y direction:\n",
"f_b_y = 0; //N\n",
"\n",
"//Balncing forces in the z direction:\n",
"f_b_z = g + w_ad + f_a; //N\n",
"\n",
"// Balancing Moments in the x direction:\n",
"m_b_x = - m_a + (f_a*l_bd) + (w_ad*l_bd) + (l_bd/2)*g; //Nm\n",
"\n",
"// Balancing Moments in the y direction:\n",
"m_b_y = - (w_ad*(l_ad/2)) - (f_a*l_ad); //Nm\n",
"\n",
"// Balancing Moments in the z direction:\n",
"m_b_z = 0; //Nm\n",
"\n",
"v_b_shear = sqrt(f_b_z ^2 + 0); //Shear Force in N\n",
"t_b = - m_b_y; //Torsional Moment in Nm\n",
"m_b = sqrt(m_b_x ^2+ 0); // Bending moment in Nm\n",
"\n",
"\n",
"//Display\n",
"\n",
"// Displaying results:\n",
"\n",
"\n",
"printf('\n\n The weight of segment BD                =   %.1f N',w_bd);\n",
"printf('\n The weight of segment AD                = %.1f N',w_ad);\n",
"printf('\n The force at B in the Z direction       = %.1f N',f_b_z);\n",
"printf('\n The moment about B in the X direction   = %.1f Nm',m_b_x);\n",
"printf('\n The moment about G in the Y direction   = %.1f Nm',m_b_y);\n",
"printf('\n The Shear Force at B                    = %.1f N',v_b_shear);\n",
"printf('\n The Torsional Moment at B               = %.1f Nm',t_b);\n",
"printf('\n The Bending Moment at B                 = %.1f Nm',m_b);\n",
"\n",
"\n",
"\n",
"//-----------------------------------------------------END-----------------------------------------------------------------------------\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.6: S6.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"\n",
"disp('Scilab Code Ex 1.6 :')\n",
"\n",
"//Given:\n",
"netf_b = 18*(10 ^3); //N Net force at B.\n",
"netf_c = 8*(10^3); //N Net force at C.\n",
"f_a = 12 *(10^3); //N Force at A.\n",
"f_d = 22* (10^3); //N Force at D.\n",
"w = 35; //mm Width.\n",
"t = 10; //mm Thickness.\n",
"\n",
"//calculations:\n",
"p_bc = netf_b + f_a; //N Net force in region BC.\n",
"a = w*t; //m^2 The area of the cross section.\n",
"avg_normal_stress = p_bc/a; //Average Normal Stress.\n",
"\n",
"\n",
"\n",
"// Displaying results:\n",
"\n",
"printf('\n\n Net force in the region BC                                 = %.2f N',p_bc);\n",
"printf('\nThe Area of cross section                                   = %.2f m^2',a);\n",
"printf('\nThe Average Normal Stress in the bar when subjected to load = %.2f MPa',avg_normal_stress);\n",
"\n",
"//---------------------------------------------------------END----------------------------------------------------------------------------------------"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.7: S7.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"\n",
"disp('Scilab Code Ex 1.7 :')\n",
"\n",
"//Given :\n",
"m_lamp = 80; //Mass of lamp in Kg.\n",
"d_ab = 10; // Diameter of AB in mm.\n",
"d_bc = 8; // Diameter of BC in mm.\n",
"ab_h = 60 *(%pi/180); // In degrees - Angle made by AB with the horizontal.\n",
"w = m_lamp*9.81; //N\n",
"a_bc = (%pi/4)*(d_bc^2); //m^2 Area of cross section of rod BC\n",
"a_ab = (%pi/4)*(d_ab^2); //m^2 Area of cross section of rod AB\n",
"\n",
"\n",
"\n",
"// Equations of equilibrium: Solving equilibrium equations simultaneously ,using matrices ,in the x and y directions to obtain force in BC and force in BA.\n",
"\n",
"\n",
"a = [(4/5) -(cos(ab_h)) ; (3/5) (sin(ab_h))];\n",
"b = [0 ; w];\n",
"f = zeros(1)\n",
"\n",
"f = a\b;\n",
"f_bc = f(1); // Force in BC in N.\n",
"f_ba = f(2); //Force in BA in N.\n",
"avg_normal_stress_a = f_ba / a_ab; //Mpa Average Normal Stress in AB\n",
"avg_normal_stress_c = f_bc/ a_bc;// Mpa   Average Normal Stress in BC\n",
"\n",
"\n",
"// Displaying results:\n",
"\n",
"\n",
"printf('\n\nThe Weight of lamp  = %.2f N',w);\n",
"printf('\nThe Net force in BC = %.2f N',f_bc);\n",
"printf('\nTheNet force in BA  = %.2f N',f_ba);\n",
"printf('\nThe Average Normal Stress in AB when subjected to load = %.2f MPa',avg_normal_stress_a);\n",
"printf('\nThe Average Normal Stress in BC when subjected to load = %.2f MPa',avg_normal_stress_c);\n",
"\n",
"//------------------------------------------------------------------END----------------------------------------------------------------------------------\n",
"\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.8: S8.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"\n",
"disp('Scilab Code Ex 1.8 :')\n",
"\n",
"//Given:\n",
"h_above_ab = 0.8; \n",
"h_below_ab = 0.2; \n",
"d_a = 0.2; \n",
"d_b = 0.1; \n",
"sp_w = 80; \n",
"\n",
"// Equation of Equilibrium:\n",
"\n",
"\n",
"a = %pi* (d_a^2);  // Area of cross section in m^2\n",
"p = sp_w * h_above_ab * a;\n",
"avg_comp_stress = p/a; // The average compressive stress in kN/m^2\n",
"\n",
"//Display:\n",
"\n",
"printf('\nThe internal Axial force P     = %.2f kN',p);\n",
"printf('\nThe average compressive stress = %.2f kN/m^2',avg_comp_stress);\n",
"\n",
"\n",
"//--------------------------------------------------------------------------------END------------------------------------------------------------------------------\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 1.9: S9.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear all; clc;\n",
"\n",
"disp('Scilab Code Ex 1.9 : ')\n",
"\n",
"//Given :\n",
"f = 3000; //N Force acting at distance x from AB.\n",
"l_ac = 200; //Length of AC in mm.\n",
"a_ab = 400; //Cross sectional area of AB in mm^2.\n",
"a_c = 650; // area of C in mm^2.\n",
"\n",
"\n",
"f_ans = zeros(3)\n",
"\n",
"k = [1 1 0;0 l_ac -f; 1.625 -1 0]\n",
"l = [f ; 0 ; 0 ]\n",
"f_ans = k\l;\n",
"\n",
"f_ab = f_ans(1)\n",
"f_c = f_ans(2)\n",
"x = f_ans(3)\n",
"\n",
"//Display:\n",
"\n",
"printf('\n\nThe Net force on AB       = %.2f N',ceil(f_ab));\n",
"printf('\nNet force on C            = %.2f N',f_c);\n",
"printf('\nDistance of force from AB = %.2f mm',ceil(x));\n",
"\n",
"\n",
"//------------------------------------------------------------------------------END------------------------------------------------------\n",
""
   ]
   }
],
"metadata": {
		  "kernelspec": {
		   "display_name": "Scilab",
		   "language": "scilab",
		   "name": "scilab"
		  },
		  "language_info": {
		   "file_extension": ".sce",
		   "help_links": [
			{
			 "text": "MetaKernel Magics",
			 "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
			}
		   ],
		   "mimetype": "text/x-octave",
		   "name": "scilab",
		   "version": "0.7.1"
		  }
		 },
		 "nbformat": 4,
		 "nbformat_minor": 0
}