Sai: Enhance Beam, Column and Structure2D modules in SymPy#
The goal of this project was to enhance the Beam, Column, and Structure2D modules in SymPy’s
continuum_mechanics
package, improving both usability and analytical power. During the early stages, I identified several critical issues. The Beam module, though a capable one-dimensional solver, lacked validation checks. Specifically, theapply_supports
method, when given an incorrect support type, internally mistook it for another type—resulting in an obscure index error rather than a clear exception. Meanwhile,solve_for_reaction_loads
would raise an uninformative key index error instead of providing a helpful message when users omitted or misassigned reaction symbols.The
point_cflexure
method incorrectly returned all algebraic roots instead of only those indicating actual contraflexure points, and it failed entirely in constant-zero regions. The maximum-finding methods—max_bending_moment
,max_shear
, andmax_deflection
—would enter infinite loops under zero constant region conditions and fail to report multiple points or intervals occuring maxima, thus undermining their usefulness for analysis purposes.The newly introduced Column module offers axial loading capabilities, but it lacks essential methods like
max_axial_force()
andmax_extension()
, limiting its analytical utility. Structure2D, intended to reduce code duplication by building upon the Beam module, currently supports only vertical analysis and lacks integration with the Column module for for full horizontal (axial) behavior. It also suffers from minimal documentation, only supports plotting of unwrapped 1D structures (instead of full 2D visuals), and its summary method only reports vertical metrics and 1D x-coordinates. Additionally, while Alex’s algorithm from his thesis is used, it has not been rewritten for clarity and test coverage is not wide to test all.Through out my project, I worked on several enhancements: I refined Column module that supports integration into Structure2D; improved error handling and user feedback within the Beam module; and extended Structure2D to support horizontal analysis, added methods for plotting deflection, axial force, shear, bending moment, and deformation on the full 2D structure; introduced
apply_rotation_hinges
; enhanced the summary method to show 2D coordinates along with axial and bending data at critical points, and refactored Alex’s algorithm for improved readability and code quality.
Udayagiri (2025)