Question: I have python code that calculates the bending moment and deflection for a UDL beam with some user input. Can someone help me plot a

I have python code that calculates the bending moment and deflection for a UDL beam with some user input. Can someone help me plot a deflection diagram and bending moment diagram based off of the user input to complete the rest of the code.

Here is my code:

I have python code that calculates the bending moment and deflection for

8import matplotlib.pyplot as plt 9import math 10 11def moment calc(Type) 12 TypeType. lower) 13 14 if Type "Bending moment of Beam with only UDL" or Type"1" or Type"UDL": 15 16 bending_moment1) deflection1) elif Type = "Bending Moment of Beam with UDL and Point Load" or Type--"2" or Type "UDL Point". 18 19 20 21 + bending_moment2) print ("The Deflection calculation is below:") deflection2() 23 else: 24 25 26def bending moment1): 27 28 UDL_Loadfloat (input ("Enter the distributed load on beam: ")) 29 Beam_Lengthfloat (input("Enter the length of the beam: ")) 30 Beam-UDL ((UDL-Load) * (Beam-Length ** 2)) / 8 31 32 print ("The Bending Moment of the Beam is {}KN.m format (Beam-UDL)) print("Enter UDL or UDL Point Load") 34def bending, moment2() : #Calculation for beam with a UDL and Point Load. 35 36 UDL-Load float (input("Enter the distributed load on beam: ")) 37 Beam_Length-float (input("Enter the length of the beam: ") 38 Point Loadfloat (input("Enter the point Load applied to beam: ")) 39 Beam-UDL-PointLoad = ((UDL-Load) * (Beam-Length ** 2)) / 8 + (((Point-Load * Beam-Length)) / 4) 40 41 print("The Bending Moment of the Beam is OKN.m format (Beam-UDL-Point Load)) 42 43def deflection1) 45 UDL_Loadfloat (input ("Enter the distributed load on beam")) 46 Beam Length-float (input("Enter the length of the beam in mm: ")) 47 mof float (input ( "Enter Moment of Inertia of beam in cm^4: ")) 48 e-float(input ("Enter Modulus of Elasticity of beam in N/mm 2: ")) 49 bean_deflec (5 * UDL-Load * Bean-Length **4)/(e*mof*384*10000) 50 print("The deflection of the Beam is mm ".format (beam_deflec)) 51 52def deflection2) 53 UDL_Load float(input ("Enter the distributed load on beam ")) 54 Point load-float (input("Enter Point Load on beam: ")) 55 Beam Lengthfloat(input("Enter the length of the beam in mm: ")) 56 mof-float(input("Enter Moment of Inertia of beam in cm 4: ")) 57 e-float(input ("Enter Modulus of Elasticity of beam in N/mm 2: ")) 58 beam-deflection (5 * UDL-Load * Bean_Length ** 4) / (e * mof * 384 * 10000) + (Point-load *1000* Beam-Length ** 3) / (e * mof * 48 * 10000) 59 print("The deflection of the Beam is mm ".format (beam_deflection)) 60 61def main): 62 63 calculation_type- input("Calculate Bending Moment and Deflection of Beam with UDL only(Type 1) or UDL Point Load (Type 2): ") 64 moment_calc(calculation_type) 65 66main() 67 68 69#Resul t 70print ("The Bending Moment Diagram is shown") 71 72 8import matplotlib.pyplot as plt 9import math 10 11def moment calc(Type) 12 TypeType. lower) 13 14 if Type "Bending moment of Beam with only UDL" or Type"1" or Type"UDL": 15 16 bending_moment1) deflection1) elif Type = "Bending Moment of Beam with UDL and Point Load" or Type--"2" or Type "UDL Point". 18 19 20 21 + bending_moment2) print ("The Deflection calculation is below:") deflection2() 23 else: 24 25 26def bending moment1): 27 28 UDL_Loadfloat (input ("Enter the distributed load on beam: ")) 29 Beam_Lengthfloat (input("Enter the length of the beam: ")) 30 Beam-UDL ((UDL-Load) * (Beam-Length ** 2)) / 8 31 32 print ("The Bending Moment of the Beam is {}KN.m format (Beam-UDL)) print("Enter UDL or UDL Point Load") 34def bending, moment2() : #Calculation for beam with a UDL and Point Load. 35 36 UDL-Load float (input("Enter the distributed load on beam: ")) 37 Beam_Length-float (input("Enter the length of the beam: ") 38 Point Loadfloat (input("Enter the point Load applied to beam: ")) 39 Beam-UDL-PointLoad = ((UDL-Load) * (Beam-Length ** 2)) / 8 + (((Point-Load * Beam-Length)) / 4) 40 41 print("The Bending Moment of the Beam is OKN.m format (Beam-UDL-Point Load)) 42 43def deflection1) 45 UDL_Loadfloat (input ("Enter the distributed load on beam")) 46 Beam Length-float (input("Enter the length of the beam in mm: ")) 47 mof float (input ( "Enter Moment of Inertia of beam in cm^4: ")) 48 e-float(input ("Enter Modulus of Elasticity of beam in N/mm 2: ")) 49 bean_deflec (5 * UDL-Load * Bean-Length **4)/(e*mof*384*10000) 50 print("The deflection of the Beam is mm ".format (beam_deflec)) 51 52def deflection2) 53 UDL_Load float(input ("Enter the distributed load on beam ")) 54 Point load-float (input("Enter Point Load on beam: ")) 55 Beam Lengthfloat(input("Enter the length of the beam in mm: ")) 56 mof-float(input("Enter Moment of Inertia of beam in cm 4: ")) 57 e-float(input ("Enter Modulus of Elasticity of beam in N/mm 2: ")) 58 beam-deflection (5 * UDL-Load * Bean_Length ** 4) / (e * mof * 384 * 10000) + (Point-load *1000* Beam-Length ** 3) / (e * mof * 48 * 10000) 59 print("The deflection of the Beam is mm ".format (beam_deflection)) 60 61def main): 62 63 calculation_type- input("Calculate Bending Moment and Deflection of Beam with UDL only(Type 1) or UDL Point Load (Type 2): ") 64 moment_calc(calculation_type) 65 66main() 67 68 69#Resul t 70print ("The Bending Moment Diagram is shown") 71 72

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!