# Symbolics.jl Finding Coefficients of Cross Terms Problem

**URL:** https://discourse.julialang.org/t/symbolics-jl-finding-coefficients-of-cross-terms-problem/109649
**Category:** General Usage
**Tags:** question, package, symbolics
**Created:** [February 2, 2024, 10:31pm UTC](https://discourse.julialang.org/t/symbolics-jl-finding-coefficients-of-cross-terms-problem/109649 "2024-02-02T22:31:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Umut\_Can\_Turhan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/umut_can_turhan/32/49221_2.png) [@Umut\_Can\_Turhan](https://discourse.julialang.org/u/Umut_Can_Turhan)
#### Post date: [February 2, 2024, 10:31pm UTC](https://discourse.julialang.org/t/symbolics-jl-finding-coefficients-of-cross-terms-problem/109649/1 "2024-02-02T22:31:13Z")

</div>

When I try to run the following code, the print function always returns the integer 0 (zero). However, you can easily see that the coefficient of the z[1] \* z[2] term equals -2. The Symbolics.jl module is robust for just single variables, such as coefficients of z[1]^2 and z[2]^2.

```julia
using Symbolics

@variables z[1:2]

Ψ = z[1]^2 - 2 * z[1] * z[2] + z[2]^2

# Extract coefficient
coeff_value = Symbolics.coeff(Ψ, z[1]*z[2])

println(coeff_value)

```

But interestingly `Symbolics.coeff(Ψ, z[2]^0*z[1]^2)` coefficient is true. The module doesn’t work for `Symbolics.coeff(Ψ, z[1]*z[2])`. Why?

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [February 3, 2024, 5:44pm UTC](https://discourse.julialang.org/t/symbolics-jl-finding-coefficients-of-cross-terms-problem/109649/2 "2024-02-03T17:44:42Z")

</div>

Open an issue.
