SymPy normalizes the order of the sections, so I don't know if it suits my purpose, but how about this?
from sympathy import cos
from sympy.abc import x,y
y = 1 + 2 * x - 3 * cos(x)
print(y)
print(y.args)
Results
2*x-3*cos(x)+1
(1,-3*cos(x), 2*x)
Alternatively, you can use y.as_terms()
to obtain a section.
© 2025 OneMinuteCode. All rights reserved.