Hi SymPy Community,
I'm Chidroopa, and I'm working on a proposal to improve the physics.continuum_mechanics.beam module for GSoC 2026.My goal is to provide a high-level interface for arbitrary symbolic load distribution.
Problem: The existing Beam module is optimised for MacCauley's technique using SingularityFunction. Although this is ideal for point loads and constant distributed loads, applying a transcendental or non-polynomial symbolic load, such as q(x) = sin(x) or e^x, requires the user to manually create intricate singularity representations, which is counterintuitive and restricts the module's applicability for complex engineering problems.
My Proposed Solution: I am exploring a Symbolic-to-Singularity Transformer.
1. For polynomial loads, I plan to map them directly to singularity powers.
2. To handle non-polynomial equations, I'm considering adding a Taylor Series expansion fallback to the apply_load method. This would approximate complex loads as high-order polynomials that the current integration engine can handle without a core change.
My Question for Mentors:
Before finalising my approach, I wanted to ask:
I've begun getting acquainted with the codebase through recent PRs (#29411, #29449, #29339, #29332), and I would appreciate any feedback to make sure my idea aligns with the module's long-term goals.
Best regards,
Chidroopa Kanaparthy
When we integrate a load q(x) that starts at a, the resulting shear force V(x) must be zero for x < a. If we simply return an indefinite integral F(x) .H(x-a), we get a mathematical jump at x=a unless F(a)=0.
My plan is to implement the definite-style subtraction directly in the core:
int q(x) <x-a>^0 dx = [F(x) - F(a)] . Heaviside(x - a)
Structural Logic (The L/2 & Nesting Bugs): These stem from how `Beam._assemble_loads` and the boundary condition solver handle symbolic coordinates. I will refactor the internal dictionary management to ensure symbolic expressions are simplified before they are passed to the solver.
Functional Logic (The Piecewise Fallback): This addresses the type of math that can be handled. By fixing the structural logic first, the Piecewise fallback will automatically benefit from more robust boundary condition handling.
The issue I’m addressing is the "Integration Constant Drift" in singularity functions. Currently, integrating <x-a>^n sometimes leads to expressions that aren't zero for x < a without manual intervention. By defining the behavior as int {a}->{x} f(t) dt = F(x) - F(a), ensures:
Shear Force (V) is zero at the very start of a partial load.
Beam module wraps every integration step in a subtraction of the lower-bound evaluation.piecewise_fold`. To mitigate this, I will implement Targeted Simplification. Instead of a global fold, I will use a specific visitor pattern that only simplifies Piecewise expressions if they share the same condition boundaries (e.g., x > a), preventing the expression tree from exploding in complexity. 1. Plotting: The `piecewise` loads must be compatible with `sympy.plotting.plot`. I will ensure the `Beam.plot()` method can handle the transition between singularity-based and piecewise-based diagrams.
2. Evalf: Numerical evaluation of complex nested Piecewise structures can be slow. I will include performance benchmarks as part of my milestones.
3. Core Impact: I plan to keep the heavy lifting inside the `continuum_mechanics` module to minimize the risk of breaking SingularityFunction behavior in other areas of SymPy .
- Integrated Testing & Documentation
I believe adding tests with every pr will make the function much better. I am updating my timeline. Tests will no longer be a separate phase. Every PR will include:
Unit tests for the specific math fix.
Integration tests comparing the output against known Euler-Bernoulli analytical solutions.
Docstring examples to ensure the Beam module's documentation remains the source of main info.
To clarify what my idea is:
SymPy Core: Any improvements to the SingularityFunction class itself or its integration/differentiation rules.
Beam Module: The application of these functions, the Piecewise fallback logic, and the boundary condition solvers.
--
You received this message because you are subscribed to a topic in the Google Groups "sympy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sympy/waOD96T0vrg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sympy+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/sympy/526a5b68-9a65-49c7-bc41-bb217f4c0fc1n%40googlegroups.com.