Help! Beam section

I am new with Grasshopper and I need help with my problem.
I have a straight line, which is stressed by a load, and it bends (as shown in the picture). I have the algorithm for that. What I now have to do is to create an optimal beam section in order to get the beam (line) to bend as little as possible. I know that the area of the section*bending must be minimal, but I cannot manage to actually make it work. The problem is that I am not allowed to work with Karamba, which makes it more complicated for me.
The second photo shows how the line bends, and what I used to do it.