Dec-17-2019, 03:04 PM
Hi, we have been provided with this section of code:
0.00224790572643
instead I get an error of
SyntaxError: unexpected EOF while parsing
what am I doing wrong??
thanks
(full code below)
class beam(object): '''This class is models the deflection of a simply supported beam under multiple point loads, following Euler-Bernoulli theory and the principle of superposition ''' def __init__(self, E, I, L): '''The class costructor ''' self.E = E # Young's modulus of the beam in N/m^2 self.I = I # Second moment of area of the beam in m^4 self.L = L # Length of the beam in m self.Loads = [(0.0, 0.0)] # the list of loads applied to the beam def setLoads(self, Loads): '''This function allows multiple point loads to be applied to the beam using a list of tuples of the form (load, position) ''' self.Loads = Loadswe then have to create a function within the class, called
def beamDeflection(self, Load, x):I have entered the following code:
def beamDeflection(self, Load, x): P1, a = Load b = (self.L - a) if x>a: return ((p1*b)/6*L*E*I)*((L/b)*(x-a)**3 -x**3 +((L**2 -b**2)*x)) else: return ((p1*b*x)/(6*L*E*I))*(L**2 - x**2 - b**2)to test, we are given the following inputs:
z = beam(8.0E9, 1.333E-4, 5.0) print(z.beamDeflection((1000,1.9),2.5)this should provide an output of
0.00224790572643
instead I get an error of
SyntaxError: unexpected EOF while parsing
what am I doing wrong??
thanks
(full code below)
class beam(object): '''This class is models the deflection of a simply supported beam under multiple point loads, following Euler-Bernoulli theory and the principle of superposition ''' def __init__(self, E, I, L): '''The class costructor ''' self.E = E # Young's modulus of the beam in N/m^2 self.I = I # Second moment of area of the beam in m^4 self.L = L # Length of the beam in m self.Loads = [(0.0, 0.0)] # the list of loads applied to the beam def setLoads(self, Loads): '''This function allows multiple point loads to be applied to the beam using a list of tuples of the form (load, position) ''' self.Loads = Loads def beamDeflection(self, Load, x): P1, a = Load b = (self.L - a) if x>a: return ((p1*b)/6*L*E*I)*((L/b)*(x-a)**3 -x**3 +((L**2 -b**2)*x)) else: return ((p1*b*x)/(6*L*E*I))*(L**2 - x**2 - b**2) z = beam(8.0E9, 1.333E-4, 5.0) print(z.beamDeflection((1000,1.9),2.5)