-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Beam - fixed inconsistencies of draw method #24073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Hi, I am the SymPy bot. I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.13. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
@AdvaitPote, given that you are also working on draw methods for the trusses, it would be in your best interest to review this PR and discuss. |
Very Good work @Davide-sd on this PR. The points that you raised in the corresponding issue are valid and the from sympy import *
from sympy.plotting import PlotGrid
from sympy.physics.continuum_mechanics import Beam
init_printing()
E, I, P = symbols('E, I, P')
R1, R2 = symbols('R1, R2')
M1, M2 = symbols('M1, M2')
L = symbols("L", positive=True)
b1 = Beam(L, E, I)
b1.apply_load(-R1, 0, -1)
b1.apply_load(R2, L, -1)
b1.apply_load(M1, L/4, -2)
b1.apply_load(-M2, 3*L/4, -2)
p1 = b1.draw()
b2 = Beam(L, E, I)
b2.apply_load(-2*R1, 0, -1)
b2.apply_load(R2, L, -1)
b2.apply_load(M1, L/4, -2)
b2.apply_load(-2*M2, 3*L/4, -2)
p2 = b2.draw()
PlotGrid(1, 2, p1, p2) In the first case, what you have suggested having symbols with a negative sign to have directions the same as negative loads works. The Force |
This has merge conflicts now. I'll mark this as draft. Feel free to mark it as ready for review later. |
I wish that were not flagged: it is convenient way to avoid having to type string quotation marks.
Benchmark results from GitHub Actions Lower numbers are good, higher numbers are bad. A ratio less than 1 Significantly changed benchmark results (PR vs master) Significantly changed benchmark results (master vs previous release) | Change | Before [8059df73] <sympy-1.12^0> | After [cd89bf0b] | Ratio | Benchmark (Parameter) |
|----------|------------------------------------|---------------------|---------|----------------------------------------------------------------------|
| - | 87.3±2ms | 57.1±0.1ms | 0.65 | integrate.TimeIntegrationRisch02.time_doit(10) |
| - | 85.3±1ms | 56.7±0.9ms | 0.67 | integrate.TimeIntegrationRisch02.time_doit_risch(10) |
| + | 22.2±0.07μs | 38.9±0.2μs | 1.76 | integrate.TimeIntegrationRisch03.time_doit(1) |
| - | 6.98±0.02ms | 3.77±0.02ms | 0.54 | logic.LogicSuite.time_load_file |
| - | 2.11±0ms | 654±1μs | 0.31 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| - | 10.4±0.04ms | 1.96±0ms | 0.19 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'sparse') |
| - | 369±1μs | 82.0±0.2μs | 0.22 | polys.TimePREM_QuadraticNonMonicGCD.time_op(1, 'sparse') |
| - | 4.85±0.02ms | 363±1μs | 0.07 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'sparse') |
| - | 10.7±0.04ms | 1.09±0ms | 0.1 | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'sparse') |
| - | 6.26±0.01ms | 3.95±0ms | 0.63 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(2, 'sparse') |
| - | 27.3±0.07ms | 12.0±0.03ms | 0.44 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| - | 6.91±0.01ms | 1.18±0ms | 0.17 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(1, 'sparse') |
| - | 16.3±0.06ms | 9.23±0.02ms | 0.57 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(2, 'sparse') |
| - | 212±0.4ms | 71.0±0.2ms | 0.34 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'sparse') |
| - | 6.37±0.01ms | 539±0.6μs | 0.08 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'sparse') |
| - | 27.8±0.05ms | 857±2μs | 0.03 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'sparse') |
| - | 611±1μs | 201±0.9μs | 0.33 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(1, 'sparse') |
| - | 6.49±0.02ms | 203±1μs | 0.03 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'sparse') |
| - | 17.0±0.04ms | 205±0.4μs | 0.01 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'sparse') |
| - | 164±0.2μs | 89.6±0.5μs | 0.55 | solve.TimeMatrixOperations.time_rref(3, 0) |
| - | 315±0.4μs | 108±0.8μs | 0.34 | solve.TimeMatrixOperations.time_rref(4, 0) |
| - | 31.7±0.07ms | 13.5±0.01ms | 0.43 | solve.TimeSolveLinSys189x49.time_solve_lin_sys |
Full benchmark results can be found as artifacts in GitHub Actions |
@AdvaitPote @moorepants , please give this another look. |
Further modifications can be made in a new PR. |
References to other Issues or PRs
Fixes #24043
Brief description of what is fixed or changed
This PR is fixing the inconsistencies mentioned on Issue #24043 , thus providing a schematic view which is consistent with the sign convention used by the
Beam
class. Not only this improves the visualization. It also allows the users to better make sense of the symbolic results. In particular:draw
method is no longer looking at the assumptions on symbolic loads and moments, which are not used by theBeam
class either in its computations.draw
method is now able to visualize symbolic distributed loads without raising errors.Other comments
Release Notes
Beam.draw
method.