For my program I'm attempting to have the user input attributes of a cantilever beam and from their input the program would output a shear diagram. I'm starting off simple with a singular downward load (user inputs point on beam where this load occurs and the load value). I figured a piecewise function sort of setup would work, so here is my code below:
length = input("input the length of your beam: ")
load = input("input your load: ")
distl = input("input the distance from the wall where your load starts: ")
distr = input("input the disance from the wall where your load ends: ")
load = float(load)
load = -load
length = int(length)
distl = int(distl)
distr = int(distr)
i = 0
graph = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
while i<=length:
if distl < i < distr:
graph[i] = load
else:
graph[i] = 0
i = i +1
plt.ylabel('Shear (V(x))')
plt.xlabel('x (meters)')
plt.plot(graph)
plt.show()
This ends up outputting the graph below: enter image description here
Can someone explain to me why this includes a slope and not simply a jump? Thanks.