Building a Beam Deflection Calculator

Building a Beam Deflection Calculator

In this Python project, we build a Beam Deflection Calculator using numerical integration

⏰ 1 h 51 min | 8 lessons
Published: August 2021
After completing this course, you will...
understand how we can use the bending moment diagram to calculate the deflection of a structure
be able to formulate and implement a numerical integration using Python
be comfortable building data visualisations using the plotting library Plotly
be able to apply what you learn to automate other routine engineering calculations

In this project, we’ll build a beam deflection calculator that can generate beam deflections by directly integrating the bending moment diagram. By calculating the deflection in this way, you'll complete this project with two key things:

  • an understanding of how to implement numerical integration in Python - a very handy skill to have in your engineering toolkit.
  • an excellent understanding of how the bending moment diagram is related to beam deflection - this is fundamental to understanding flexural behaviour!

Since our approach will require a complete bending moment diagram, we’ll add this code onto the end of our Shear Force and Bending Moment Diagram Calculator.

So at the end of this project, the final result will be a complete beam analysis code that calculates beam reactions, shear forces, bending moments and deflections.

We'll also complete a validation exercise at the end of the project using Macauley’s method (discussed in more detail here) - this will be a great review of this classic engineering analysis technique.

In our previous beam analysis project, we were limited to analysing statically determinate beams since we relied on the equations of statics. The technique we’ll use for calculating deflection in this project is not limited to statically determinate structures, although you will need a complete bending moment diagram to integrate.

If you’re new to Python, don’t worry – you don’t need to be a Python programmer to complete this project! Complete beginners can work through this project and pick up the programming basics along the way.

If you need help getting your coding environment setup, check out this lecture (part of another course but covers what you need to get up and running). So, with all of that out of the way, let’s get into it.

Section 1
Beam Deflection Calculator Project
1. Project overview and demo 📂
2. Beam deflection using numerical integration
3. Solving for beam rotations and deflections
4. How to find the correct initial beam rotation
5. How to minimise the deflection error
6. Dealing with overhang cantilever deflections
7. Plotting the beam deflected shape
8. Validating our beam deflections with Macauley’s Method 📂
Dr Seán Carroll
BEng (Hons), MSc, PhD, CEng MIEI, FHEA
Hi, I’m Seán, the founder of (formerly I hope you found this tutorial helpful. After spending 10 years as a university lecturer in structural engineering, I started this site to help more people understand engineering and get as much enjoyment from studying it as I do. Feel free to get in touch or follow me on any of the social accounts.

Do you have some knowledge or expertise you'd like to share with the EngineeringSkills community?
Check out our guest writer programme - we pay for every article we publish.
Beam and Frame Analysis using the Direct Stiffness Method in Python
Beam and Frame Analysis using the Direct Stiffness Method in Python
Build a sophisticated structural analysis software tool that models beams and frames using Python.