# Symbolics.jl collect like terms?

**URL:** <https://discourse.julialang.org/t/symbolics-jl-collect-like-terms/92426>\
**Category:** General Usage\
**Tags:** symbolics\
**Created:** [January 2, 2023, 6:47pm UTC](https://discourse.julialang.org/t/symbolics-jl-collect-like-terms/92426 "2023-01-02T18:47:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Remedios](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samuel_remedios/32/45546_2.png) [@Samuel\_Remedios](https://discourse.julialang.org/u/Samuel_Remedios)\
**Post date:** [January 2, 2023, 6:47pm UTC](https://discourse.julialang.org/t/symbolics-jl-collect-like-terms/92426/1 "2023-01-02T18:47:05Z")

</div>

Is there functionality similar to SymPy’s `collect` in Symbolics.jl?

Alternatively I would appreciate another solution to this problem which maybe makes more sense:

I’m manipulating a multivariate symbolic equation in the Z-domain and want to pick off specific variables. This is what I’m looking at:

`(c*h + c*f*z + a*f*(z^2) + a*h*z - d*g - b*g*z - b*e*(z^2) - d*e*z) / (z^3)`

I’d like this simplified in terms of `z^(-n)` rather than `z^(+n) / z^(+m)`. Also, I want to reorganize the terms such that the symbolic coefficients are grouped by powers of `z`. In SymPy this is done as `my_expr.expand().collect(z)`. Is there a way to do this with Symbolics.jl?

Also, I want all symbolic coefficients of particular powers of `z`; ideally I could have an iterator over all coefficients with the variable `z^(-1)` and another iterator over all coefficients with variables not equal to `z^(-1)`

---

<div class="post-metadata">

**Author:** ![Andrea\_Pagnani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrea_pagnani/32/3136_2.png) [@Andrea\_Pagnani](https://discourse.julialang.org/u/Andrea_Pagnani)\
**Post date:** [January 3, 2023, 7:56am UTC](https://discourse.julialang.org/t/symbolics-jl-collect-like-terms/92426/2 "2023-01-03T07:56:56Z")

</div>

I don’t think it is possible as polynomials assume monomials with non negative integer powers. It would be a nice extension to extend the concept o polynomial to [Laurent polynomials](https://www.dropbox.com/scl/fi/0vn04fevqc0pul4ij1rno/Verbale-COMMISSIONI-DOTTORATI-seduta-preliminare_3s.docx?dl=0&rlkey=jyggtdosp7cjhyksuov2ihqx0)
