summaryrefslogtreecommitdiff
path: root/MECHANICS_OF_SOLIDS_by_S.S._Bhavikatti/Chapter3_WS64jkH.ipynb
blob: 094209507a600f378e887500152efadf76dc425c (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter3-TRUSSES"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example3.1 Page number68"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "theta= 45.0 °\n",
      "FCB= 56.57 KN\n",
      "FCD= 40.0 KN\n",
      "FDB= 40.0 KN\n",
      "FDE= 40.0 KN\n",
      "FBE= 113.14 KN\n",
      "FBA= 120.0 KN\n",
      "Member , Magnitude of Force in KN , Nature\n",
      "AB , 120.0 , Tension\n",
      "BC , 56.57 , Tension\n",
      "CD , 40.0 , Compresion\n",
      "DE , 40.0 , Compresion\n",
      "BE , 113.14 , Compresion\n",
      "BD , 40.0 , Tension\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,atan,pi,sin,cos\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "#Determine the inclinations of all inclined members\n",
    "\n",
    "theta=atan(1)*180/pi\n",
    "\n",
    "print \"theta=\",round(theta,2),\"°\"\n",
    "\n",
    "#Now at joints C, there are only two unknowns,forces in members CB and CD, say FCB and FCD.\n",
    "#Now there are two equations of equilibrium for the forces meeting at the joint and two unknown forces. Hence, the unknown forces can be determined. At joint C  sum V= 0 condition shows that the force FCB should act away from the joint C so that its vertical component balances the vertical downward load at C.\n",
    " \n",
    "P=40.0\n",
    "FCB=P/sin(theta*pi/180)\n",
    "\n",
    "print \"FCB=\",round(FCB,2),\"KN\"\n",
    "\n",
    "#Now sum H=0 indicates that FCD should act towards C.\n",
    "\n",
    "FCD=FCB*cos(theta*pi/180)\n",
    "\n",
    "print \"FCD=\",round(FCD,2),\"KN\"\n",
    "\n",
    "#In the present case, near the joint C, the arrows are marked on the members CB and CD to indicate forces FCB and FCD directions as found in the analysis of joint C. Then reversed directions are marked in the members CB and CD near joints B and D, respectively.\n",
    "\n",
    "FDB=40.0\n",
    "FDE=40.0\n",
    "\n",
    "print \"FDB=\",round(FDB,2),\"KN\"\n",
    "\n",
    "print \"FDE=\",round(FDE,2),\"KN\"\n",
    "\n",
    "#In the present case, after marking the forces in the members DB and DE, we find that analysis of joint B can be taken up.\n",
    "\n",
    "FBE=(FCB*sin(theta*pi/180)+P)/(sin(theta*pi/180))\n",
    "\n",
    "FBA=FCB*cos(theta*pi/180)+FBE*cos(theta*pi/180)\n",
    "\n",
    "print \"FBE=\", round(FBE,2),\"KN\"\n",
    "print \"FBA=\", round(FBA,2),\"KN\"\n",
    "#Determine the nature of forces in each member and tabulate the results. Note that if the arrow marks on a member are towards each other, then the member is in tension and if the arrow marks are away from each other, the member is in compression.\n",
    "\n",
    "print \"Member\",\",\",\"Magnitude of Force in KN\",\",\",\"Nature\"\n",
    "print \"AB\",\",\",    round(FBA,2)            ,\",\",\"Tension\"\n",
    "print \"BC\",\",\",    round(FCB,2)            ,\",\",\"Tension\"\n",
    "print \"CD\",\",\",    round(FCD,2)            ,\",\",\"Compresion\"\n",
    "print \"DE\",\",\",    round(FDE,2)            ,\",\",\"Compresion\"\n",
    "print \"BE\",\",\",    round(FBE,2)            ,\",\",\"Compresion\"\n",
    "print \"BD\",\",\",    round(P,2)              ,\",\",\"Tension\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example3.2 Page number70"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "FAB= 83.7158 KN (Comp.)\n",
      "FAE= 41.8579 KN (Tension)\n",
      "FDC= 89.4893 KN (Comp.)\n",
      "FDE= 44.7446 KN (Tension)\n",
      "FBC= 60.6218 KN (Comp.)\n",
      "FCE= 31.7543 KN (Tension)\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,atan,pi,sin,cos\n",
    "\n",
    "#Now, we cannot find a joint with only two unknown forces without finding reactions.\n",
    "#Consider the equilibrium of the entire frame,Sum of moments about A is zero,Horizontal forces & Vertical forces is zero.\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "PB=40.0\n",
    "PC=50.0\n",
    "PE=60.0\n",
    "\n",
    "theta=60.0\n",
    "\n",
    "RD=(PC*3+PE*2+PB*1)/(4.0)\n",
    "\n",
    "RA=PB+PC+PE-RD\n",
    "\n",
    "FAB=RA/sin(theta*pi/180)\n",
    "\n",
    "print\"FAB=\",round(FAB,4),\"KN\" ,\"(Comp.)\"\n",
    "\n",
    "FAE=FAB*cos(theta*pi/180)\n",
    "\n",
    "print\"FAE=\",round(FAE,4),\"KN\" ,  \"(Tension)\"\n",
    "\n",
    "FDC=RD/sin(theta*pi/180)\n",
    "\n",
    "print\"FDC=\",round(FDC,4),\"KN\" ,  \"(Comp.)\"\n",
    "\n",
    "FDE=FDC*cos(theta*pi/180)\n",
    "\n",
    "print\"FDE=\",round(FDE,4),\"KN\" ,  \"(Tension)\"\n",
    "\n",
    "FBE=(FAB*sin(theta*pi/180)-PB)/sin(theta*pi/180)\n",
    "\n",
    "FBC=(FAB+FBE)*(0.5)\n",
    "print\"FBC=\",round(FBC,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "\n",
    "FCE=(FDC*sin(theta*pi/180)-PC)/(sin(theta*pi/180))\n",
    "print\"FCE=\",round(FCE,4),\"KN\",\"(Tension)\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example3.3 Page number72"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "FAB= 23.09 KN [Comp.]\n",
      "FAC= 11.55 KN [Tensile]\n",
      "FDB= 20.0 KN [Comp.]\n",
      "FDC= 17.32 KN [Tensile]\n",
      "FCB= 11.55 KN FCB= 11.55 KN Checked\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,atan,pi,sin,cos\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "PB=20.0       #Load at point B,KN\n",
    "PC=10.0       #Load at point C,KN \n",
    "thetaA=60.0   #angleBAC\n",
    "thetaD=30.0   #angleBDC\n",
    "\n",
    "AC=3.0   #length,m\n",
    "CD=3.0   #length,m\n",
    "\n",
    "AB=(AC+CD)*cos(thetaA*pi/180)\n",
    "BD=(AC+CD)*cos(thetaD*pi/180)\n",
    "#mistake in book\n",
    "#angleBCA=angleABC=theta\n",
    "\n",
    "theta=(180.0-thetaA)/(2.0) \n",
    "\n",
    "#Taking moment about A, we get\n",
    "\n",
    "RD=(PC*AC+PB*AC*cos(thetaA*pi/180))/(AC+CD)\n",
    "\n",
    "RA=PC+PB-RD\n",
    "#Joint A\n",
    "#vertical & horizontal forces sum to zero\n",
    "\n",
    "FAB=RA/sin(thetaA*pi/180)\n",
    "\n",
    "print \"FAB=\",round(FAB,2),\"KN\",\"[Comp.]\"\n",
    "FAC=FAB*cos(thetaA*pi/180)\n",
    "print \"FAC=\",round(FAC,2),\"KN\",\"[Tensile]\"\n",
    "\n",
    "#Joint D\n",
    "#vertical & horizontal forces sum to zero\n",
    "\n",
    "FDB=RD/sin(thetaD*pi/180)\n",
    "\n",
    "print \"FDB=\",round(FDB,2),\"KN\",\"[Comp.]\"\n",
    "FDC=FDB*cos(thetaD*pi/180)\n",
    "print \"FDC=\",round(FDC,2),\"KN\",\"[Tensile]\"\n",
    "\n",
    "#Joint C\n",
    "#vertical & horizontal forces sum to zero\n",
    "\n",
    "FCB=PC/sin(theta*pi/180)\n",
    "\n",
    "print \"FCB=\",round(FCB,2),\"KN\",\n",
    "\n",
    "#CHECK\n",
    "\n",
    "FCB=(FDC-FAC)/cos(theta*pi/180)\n",
    "print \"FCB=\",round(FCB,2),\"KN\",\"Checked\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example3.4 Page number74\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "FBF= 42.4264 KN (Tension)\n",
      "FBC= 30.0 KN (Comp.)\n",
      "FCF= 50.0 KN (Comp.)\n",
      "FCD= 30.0 KN (Comp.)\n",
      "FDF= 70.7107 KN (Tensile)\n",
      "FDF= 70.7107 KN Checked\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,atan,pi,sin,cos\n",
    "\n",
    "#Now, we cannot find a joint with only two unknown forces without finding reactions.\n",
    "#Consider the equilibrium of the entire frame,Sum of moments about A is zero,Horizontal forces & Vertical forces is zero.\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "PB=30.0      #vertical load at point B,KN\n",
    "PC=50.0      #vertical load at point C,KN \n",
    "PDv=40.0     #vertical load at point D,KN\n",
    "PDh=20.0     #Horizontal load at point D,KN\n",
    "PF=30.0      #vertical load at point F,KN\n",
    "HA=PDh\n",
    "\n",
    "RE=(PC*4+PDv*8+PDh*4+PF*4)/(8.0)\n",
    "\n",
    "VA=PB+PC+PDv+PF-RE\n",
    "\n",
    "#joint A\n",
    "#sum of vertical & sum of horizontal forces is zero.\n",
    "\n",
    "FAB=VA\n",
    "FAF=HA\n",
    "\n",
    "#joint E\n",
    "#sum of vertical & sum of horizontal forces is zero.\n",
    "\n",
    "FED=RE\n",
    "FEF=0\n",
    "\n",
    "#Joint B: Noting that inclined member is at 45°\n",
    "#sum of vertical & sum of horizontal forces is zero.\n",
    "\n",
    "theta=45.0\n",
    "FBF=(VA-PB)/sin(theta*pi/180)\n",
    "\n",
    "print\"FBF=\",round(FBF,4),\"KN\" ,  \"(Tension)\"\n",
    "\n",
    "FBC=FBF*cos(theta*pi/180)\n",
    "\n",
    "print\"FBC=\",round(FBC,4),\"KN\" ,  \"(Comp.)\"\n",
    "\n",
    "#Joint C: \n",
    "#sum of vertical & sum of horizontal forces is zero.\n",
    "\n",
    "\n",
    "FCF=PC\n",
    "\n",
    "print\"FCF=\",round(FCF,4),\"KN\" ,  \"(Comp.)\"\n",
    "\n",
    "FCD=FBC\n",
    "\n",
    "print\"FCD=\",round(FCD,4),\"KN\" ,  \"(Comp.)\"\n",
    "\n",
    "#Joint D: Noting that inclined member is at 45°\n",
    "#sum of vertical & sum of horizontal forces is zero.\n",
    "\n",
    "theta=45.0\n",
    "FDF=(RE-PDv)/cos(theta*pi/180)\n",
    "\n",
    "print\"FDF=\",round(FDF,4),\"KN\" ,  \"(Tensile)\"\n",
    "\n",
    "#check\n",
    "\n",
    "FDF=(FCD+PDh)/cos(theta*pi/180)\n",
    "\n",
    "print\"FDF=\",round(FDF,4),\"KN\" ,  \"Checked\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example3.5 Page number75"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "FED= 25.0 KN (Tension)\n",
      "FEF= 15.0 KN (Comp.)\n",
      "FAB= 20.0 KN (Comp.)\n",
      "FAF= 15.0 KN (Comp.)\n",
      "FCB= 25.0 KN (Comp.)\n",
      "FCD= 20.0 KN (Tension)\n",
      "FBF= 0.0\n",
      "FBD= 15.0 KN (Tension)\n",
      "FFD= 0.0\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,asin,pi,sin,cos\n",
    "\n",
    "#All inclined members have the same inclination to horizontal. Now, length of an inclined member is BF\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "PE=20.0\n",
    "AF=3.0\n",
    "FE=3.0\n",
    "AB=4.0\n",
    "FD=4.0\n",
    "BD=3.0\n",
    "CD=4.0\n",
    "\n",
    "BF=sqrt(pow(AF,2)+pow(AB,2))\n",
    "DE=BF\n",
    "BC=DE\n",
    "\n",
    "#sin(theta)=AB/BF\n",
    "#cos(theta)=AF/BF\n",
    "\n",
    "theta=asin(AB/BF)\n",
    "#As soon as a joint is analysed the forces on the joint are marked on members \n",
    "\n",
    "#Joint E\n",
    "#Consider the equilibrium of the entire frame,Sum of moments about A is zero,Horizontal forces & Vertical forces is zero.\n",
    "\n",
    "FED=PE/sin(theta)\n",
    "print\"FED=\",round(FED),\"KN\",\"(Tension)\"\n",
    "\n",
    "FEF=FED*cos(theta)\n",
    "print\"FEF=\",round(FEF),\"KN\",\"(Comp.)\"\n",
    "\n",
    "#At this stage as no other joint is having only two unknowns, no further progress is possible. Let us find the reactions at the supports considering the whole structure. Let the reaction be RC HORIZONTAL at point C,VA,HA at point A Vertically & Horizontally respectively.\n",
    "#Taking moment at point A,\n",
    "\n",
    "RC=PE*6/8 \n",
    "#sum of vertical & sun of horizontal forces is zero.\n",
    "\n",
    "VA=PE\n",
    "HA=RC\n",
    "\n",
    "#Joint A\n",
    "#sum of vertical & sun of horizontal forces is zero.\n",
    "FAB=VA\n",
    "print\"FAB=\",round(FAB),\"KN\",\"(Comp.)\"\n",
    "\n",
    "FAF=HA\n",
    "print\"FAF=\",round(FAF),\"KN\",\"(Comp.)\"\n",
    "\n",
    "#Joint C\n",
    "#sum of vertical & sun of horizontal forces is zero.\n",
    "FCB=RC/cos(theta)\n",
    "print\"FCB=\",round(FCB),\"KN\",\"(Comp.)\"\n",
    "\n",
    "FCD=FCB*sin(theta)\n",
    "print\"FCD=\",round(FCD),\"KN\",\"(Tension)\"\n",
    "\n",
    "#Joint B\n",
    "#sum of vertical & sun of horizontal forces is zero.\n",
    "\n",
    "FBF=(FCB*sin(theta)-FAB)/sin(theta)\n",
    "\n",
    "print\"FBF=\",round(FBF)\n",
    "\n",
    "FBD=FCB*cos(theta)\n",
    "print\"FBD=\",round(FBD),\"KN\",\"(Tension)\"\n",
    "\n",
    "#joint F\n",
    "#sum of vertical & sun of horizontal forces is zero.\n",
    "\n",
    "FFD=FBF\n",
    "print\"FFD=\",round(FFD)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example 3.6 page number 78"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "FHG= 25.0 KN (Comp.)\n",
      "FHF= 15.0 KN (Tension)\n",
      "FAC= 18.0278 KN (Comp.)\n",
      "FAB= 15.0 KN (Tension)\n",
      "FBC= 0.0\n",
      "FBD=FBA 15.0 KN (Tension)\n",
      "FCE=FCA 18.0278 KN (Comp.)\n",
      "FDE= 0.0\n",
      "FDF=FDB 15.0 KN (Tension)\n",
      "FEF= 0\n",
      "FEG=FCE= 18.0278 KN (Comp.)\n",
      "FFG= 12.0 KN (Tension)\n"
     ]
    }
   ],
   "source": [
    "from math import atan, cos , sin, pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "AB=2.0    #length of beam AB,m\n",
    "BD=2.0    #length of beam BD,m\n",
    "DF=2.0    #length of beam DF,m\n",
    "FH=3.0    #length of beam FH,m\n",
    "FG=4.0    #length of beam FG,m\n",
    "PF=12.0   #Vertical Load at point F,KN\n",
    "PH=20.0   #Vertical Load at point H,KN\n",
    "\n",
    "#mistake in book FG=4.0 , given FG=2.0 \n",
    "\n",
    "theta1=atan(FG/(AB+BD+DF))\n",
    "theta3=atan(FG/FH)\n",
    "theta2=theta3\n",
    "\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "#joint H\n",
    "\n",
    "FHG=PH/sin(theta3)\n",
    "print \"FHG=\",round(FHG),\"KN\",\"(Comp.)\" \n",
    "\n",
    "FHF=FHG*cos(theta2)\n",
    "print \"FHF=\",round(FHF),\"KN\",\"(Tension)\"\n",
    "\n",
    "#taking moment at G\n",
    "\n",
    "RA=PH*FH/(AB+BD+DF)\n",
    "\n",
    "RG=RA+PF+PH\n",
    "\n",
    "#joint A\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FAC=RA/sin(theta1)\n",
    "print \"FAC=\",round(FAC,4),\"KN\",\"(Comp.)\" \n",
    "\n",
    "FAB=FAC*cos(theta1)\n",
    "print \"FAB=\",round(FAB),\"KN\",\"(Tension)\"\n",
    " \n",
    "#joint B\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FBC=0\n",
    "print \"FBC=\",round(FBC) \n",
    "FBA=FAB\n",
    "FBD=FBA\n",
    "print \"FBD=FBA\",round(FBD),\"KN\",\"(Tension)\"\n",
    " \n",
    "#Joint C: Sum of Forces normal to AC = 0, gives FCD =0 since FBC = 0 ,sum of Forces parallel to CE =0 \n",
    "\n",
    "FCA=FAC\n",
    "FCE=FCA\n",
    "print \"FCE=FCA\",round(FCE,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "\n",
    "#joint D\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FDE=0\n",
    "print \"FDE=\",round(FDE) \n",
    "\n",
    "FDB=FBD\n",
    "FDF=FDB\n",
    "\n",
    "print \"FDF=FDB\",round(FDF),\"KN\",\"(Tension)\"\n",
    "\n",
    "#Joint E: sum of Forces normal to CG = 0, gives FEF = 0 and sum of Forces in the direction of  CG = 0, gives \n",
    "\n",
    "FEF=0\n",
    "\n",
    "print \"FEF=\",FEF\n",
    "\n",
    "FEG=FCE\n",
    "\n",
    "print \"FEG=FCE=\", round(FEG,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "#Joint F:\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FFG=PF\n",
    "\n",
    "print \"FFG=\",round(FFG),\"KN\",\"(Tension)\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 3.7 page number 80"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "FGF= 23.094 KN (Tension)\n",
      "FGE= 11.547 KN (Comp.)\n",
      "FFG= 23.094 KN (Comp.)\n",
      "FFD= 13.094 KN (Tension)\n",
      "FAB= 36.7543 KN (Comp.)\n",
      "FAC= 8.3771 KN (Tension)\n",
      "FBC= 9.4338 KN (Comp.)\n",
      "FBD= 13.6603 KN (Comp.)\n",
      "FCD= 9.4338 KN (Tension)\n",
      "FCE= 1.0566 KN (Comp.)\n",
      "FDE= 44.0748 KN (Comp.)\n"
     ]
    }
   ],
   "source": [
    "from math import sin,cos,pi\n",
    "\n",
    "# Since all members are 3 m long, all triangles are equilateral and hence all inclined members are at 60° to horizontal. Joint-by-joint analysis is carried out . Then nature of the force is determined. \n",
    "\n",
    "#variable declaration\n",
    "\n",
    "AB=3.0\n",
    "BC=AB\n",
    "AC=AB\n",
    "BD=BC\n",
    "CD=BD\n",
    "CE=CD\n",
    "DE=CE\n",
    "EF=DE\n",
    "DF=DE\n",
    "EG=DE\n",
    "FG=DF\n",
    "\n",
    "theta=60.0*pi/180 #angles BAC,BCA,DCE,DEC,FEG,FGE,°\n",
    "\n",
    "PB=40.0    #Vertical Loading at point B,KN\n",
    "PD=30.0    #Vertical Loading at point D,KN\n",
    "HF=10.0    #Horizontal Loading at point F,KN\n",
    "PG=20.0    #Vertical Loading at point G,KN\n",
    "\n",
    "#joint G\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FGF=PG/sin(theta)\n",
    "\n",
    "print \"FGF=\",round(FGF,4),\"KN\",\"(Tension)\"\n",
    "\n",
    "FGE=FGF*cos(theta)\n",
    "\n",
    "print \"FGE=\",round(FGE,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "#joint F\n",
    "\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FFG=FGF\n",
    "\n",
    "print \"FFG=\",round(FFG,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "FFE=FGF\n",
    "FFD=FGF*cos(theta)+FFE*cos(theta)-HF\n",
    "print \"FFD=\",round(FFD,4),\"KN\",\"(Tension)\"\n",
    "\n",
    "#Now, without finding reaction we cannot proceed. Hence, consider equilibrium of the entire truss\n",
    "#moment about point A\n",
    "\n",
    "RE=((PB*AC/2)-(HF*EF*sin(theta))+(PD*(AC+CE/2))+(PG*(AC+CE+EG)))/(AC+CE)\n",
    "\n",
    "VA=PB+PD+PG-RE\n",
    "\n",
    "HA=HF\n",
    "\n",
    "#joint A\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FAB=VA/sin(theta)\n",
    "\n",
    "print \"FAB=\",round(FAB,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "FAC=FAB*cos(theta)-HF\n",
    "\n",
    "print \"FAC=\",round(FAC,4),\"KN\",\"(Tension)\"\n",
    "\n",
    "\n",
    "#joint B\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FBC=(PB-FAB*sin(theta))/sin(theta)\n",
    "\n",
    "print \"FBC=\",round(FBC,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "FBA=FAB\n",
    "FBD=-FBC*cos(theta)+FBA*cos(theta)\n",
    "\n",
    "print \"FBD=\",round(FBD,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "#joint C\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FCD=FBC*sin(theta)/sin(theta)\n",
    "\n",
    "print \"FCD=\",round(FCD,4),\"KN\",\"(Tension)\"\n",
    "\n",
    "FCE=FCD*cos(theta)+FBC*cos(theta)-FAC\n",
    "\n",
    "print \"FCE=\",round(FCE,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "#joint D\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FDE=(PD+FCD*sin(theta))/sin(theta)\n",
    "\n",
    "print \"FDE=\",round(FDE,4),\"KN\",\"(Comp.)\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 3.8 page number82"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "FFH= 69.282 KN (Comp.)\n",
      "FGH= 5.7735 KN (Comp.)\n",
      "FGI= 72.1688 KN (Tensile)\n"
     ]
    }
   ],
   "source": [
    "from math import sin,cos,pi\n",
    "\n",
    "#Each load is 10 kN and all triangles are equilateral with sides 4 m.\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "PB=10.0\n",
    "PD=PB\n",
    "PF=PD\n",
    "AB=4.0\n",
    "BC=AB\n",
    "AC=BC\n",
    "BD=BC\n",
    "CD=BC\n",
    "DE=CD\n",
    "CE=CD\n",
    "DF=DE\n",
    "EF=DE\n",
    "EG=DE\n",
    "FG=EF\n",
    "#Take section (A)–(A), which cuts the members FH, GH and GI and separates the truss into two parts. \n",
    "AG=AC+CE+EG\n",
    "BG=CE+EG+AC/2\n",
    "DG=EG+CE/2\n",
    "FG1=EG/2\n",
    "RA=PB*7/2\n",
    "RO=RA\n",
    "theta=60.0*pi/180\n",
    "#moment at point G\n",
    "FFH=(RA*AG-PB*BG-PD*DG-PF*FG1)/(FG*sin(theta))\n",
    "print \"FFH=\",round(FFH,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "\n",
    "FGH=(RA-PB-PD-PF)/(sin(theta))\n",
    "print \"FGH=\",round(FGH,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "FGI=FFH+FGH*cos(theta)\n",
    "print \"FGI=\",round(FGI,4),\"KN\",\"(Tensile)\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 3.9 page number 83"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "FL3L4= 412.5 KN (Tension)\n",
      "FU4U3= 456.2 KN (Comp.)\n",
      "FU4L3= 62.5 KN (Tension)\n"
     ]
    }
   ],
   "source": [
    "from math import asin,acos,sin,cos,sqrt\n",
    "\n",
    "#To determine reactions, consider equilibrium equations\n",
    "\n",
    "#variable declaration\n",
    "  #all Vertical loading are in KN\n",
    "PL1=200.0               \n",
    "PL2=200.0\n",
    "PL3=150.0\n",
    "PL4=100.0\n",
    "PL5=100.0\n",
    "\n",
    "#length in m\n",
    "UL1=6.0\n",
    "UL2=8.0\n",
    "UL3=9.0\n",
    "UL4=UL2\n",
    "UL5=UL1\n",
    "\n",
    "L1=6.0\n",
    "L2=6.0\n",
    "L3=6.0\n",
    "L4=6.0\n",
    "L5=6.0\n",
    "L6=6.0\n",
    "\n",
    "#moment at point LO\n",
    "\n",
    "R2=(PL1*L1+PL2*(L1+L2)+PL3*(L1+L2+L3)+PL4*(L1+L2+L3+L4)+PL5*(L1+L2+L3+L4+L5))/(L1+L2+L3+L4+L5+L6)\n",
    "\n",
    "R1=PL1+PL2+PL3+PL4+PL5-R2\n",
    "\n",
    "#Take the section (1)–(1) and consider the right hand side part.\n",
    "\n",
    "U3U4=sqrt(pow(1,2)+pow(UL1,2))\n",
    "theta1=asin(1/U3U4)\n",
    "\n",
    "L3U4=sqrt(pow(UL1,2)+pow(UL2,2))\n",
    "theta2=asin(6/L3U4)\n",
    "\n",
    "#moment at U4\n",
    "\n",
    "FL3L4=(R2*(L5+L6)-PL4*L4)/UL4\n",
    "\n",
    "print \"FL3L4=\", round(FL3L4,1),\"KN\",\"(Tension)\"\n",
    "\n",
    "#moment at L3\n",
    "FU4U3=(-PL4*L4-PL5*(L4+L5)+R2*(L4+L5+L6))/(cos(theta1)*UL3)\n",
    "print \"FU4U3=\", round(FU4U3,1),\"KN\",\"(Comp.)\"\n",
    "\n",
    "#sum of horizontal forces \n",
    "FL4L3=FL3L4\n",
    "FU4L3=(-FL4L3+FU4U3*cos(theta1))/sin(theta2)\n",
    "print \"FU4L3=\", round(FU4L3,1),\"KN\",\"(Tension)\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 3.10 page number84"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "theta= 60.0 °\n",
      "F2= 51.9615 KN (Tension)\n",
      "F1= 110.0 KN (Comp.)\n",
      "F3= 69.282 KN (Tension)\n"
     ]
    }
   ],
   "source": [
    "from math import atan,tan,sin,cos,pi\n",
    "\n",
    "#Each load is 20 kN.\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "P=20.0\n",
    "AB=18.0\n",
    "A=3.0\n",
    "\n",
    "RA=P*7/2\n",
    "RB=RA\n",
    "\n",
    "theta1=30.0*pi/180\n",
    "a=(3*A)/(4*cos(theta1))\n",
    "#Take Section (A)–(A) and consider the equilibrium of left hand side part of the French Truss\n",
    "#Drop perpendicular CE on AB. \n",
    "\n",
    "CE=3*A*tan(theta1)\n",
    "DE=A\n",
    "\n",
    "theta=atan(CE/DE)*180/pi\n",
    "print \"theta=\",round(theta),\"°\"\n",
    "\n",
    "#moment at point A\n",
    "\n",
    "F2=(P*a*cos(theta1)*6)/(A*2*sin(theta*pi/180))\n",
    "print \"F2=\",round(F2,4),\"KN\",\"(Tension)\"\n",
    "\n",
    "#sum of all vertical forces & sum of all horizotal forces is zero\n",
    "F1=(F2*sin(theta*pi/180)+RA-P*3)/(sin(theta1))\n",
    "print \"F1=\",round(F1,4),\"KN\",\"(Comp.)\"\n",
    "\n",
    "F3=F1*cos(theta1)-F2*cos(theta*pi/180)\n",
    "print \"F3=\",round(F3,4),\"KN\",\"(Tension)\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 3.11 page number 85"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "FAE= 30.0 KN (Tension)\n",
      "FBC= 71.4 KN (Comp.)\n",
      "FFC= 40.98 KN (Tension)\n",
      "FAB= 92.62 KN (Comp.)\n",
      "FAF= 40.98 KN (Tension)\n"
     ]
    }
   ],
   "source": [
    "from math import sin,cos,pi,sqrt\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "PA=15.0       #vertical loading at point A,KN\n",
    "PB=30.0       #vertical loading at point B,KN\n",
    "PC=30.0       #vertical loading at point C,KN\n",
    "PD=30.0       #vertical loading at point D,KN\n",
    "PE=15.0       #vertical loading at point E,KN\n",
    "\n",
    "#Due to symmetry, the reactions are equal\n",
    "RA=(PA+PB+PC+PD+PE)/2\n",
    "RB=RA\n",
    "#Drop perpendicular CH on AF. \n",
    "#in traingle ACH\n",
    "\n",
    "angleACH=45.0*pi/180    #angleACH,°\n",
    "angleFCV=30.0*pi/180    # FC is inclined at 30° to vertical i.e., 60° to horizontal and CH = 5 m \n",
    "CH=5.0\n",
    "angleFCH=60.0*pi/180\n",
    "\n",
    "#It is not possible to find a joint where there are only two unknowns. Hence, consider section (1)–(1). \n",
    "#For left hand side part of the frame\n",
    "#moment at C\n",
    "\n",
    "FAE=(RA*CH-PA*CH-PB*CH/2)/(CH)\n",
    "print \"FAE=\",round(FAE),\"KN\",\"(Tension)\"\n",
    "\n",
    "#Assuming the directions for FFC and FBC \n",
    "#sum of vertical & sum of horizontal forces is zero\n",
    "\n",
    "#FFC=FBC*sqrt(2)-RA\n",
    "\n",
    "FBC=(RA*sin(angleFCH)-PA)/(sqrt(2)*sin(angleFCH)-(1/sqrt(2)))\n",
    "print \"FBC=\",round(FBC,2),\"KN\",\"(Comp.)\"\n",
    "\n",
    "FFC=FBC*sqrt(2)-RA\n",
    "print \"FFC=\",round(FFC,2),\"KN\",\"(Tension)\"\n",
    "\n",
    "#Assumed directions of FBC and FFC are correct. Therefore, FBC is in compression and FFC is in tension. Now we can proceed with method of joints to find the forces in other members. Since it is a symmetric truss, analysis of half the truss is sufficient. Other values may be written down by making use of symmetrry.\n",
    "\n",
    "#Joint B: sum of forces normal to AC = 0, gives \n",
    "\n",
    "FBF=PC*cos(angleACH)\n",
    "\n",
    "#sum of forces parallel to AC = 0, gives \n",
    "\n",
    "FAB=FBC+PC*sin(angleACH)\n",
    "\n",
    "print \"FAB=\",round(FAB,2),\"KN\",\"(Comp.)\"\n",
    "\n",
    "\n",
    "\n",
    "#JOINT A\n",
    "#sum of vertical & sum of horizontal forces is zero\n",
    "\n",
    "FAF=(FAB*sin(angleACH)+PA-RA)/sin(angleFCV)\n",
    "\n",
    "print \"FAF=\",round(FAF,2),\"KN\",\"(Tension)\"\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}