Using Symbolics & Nemo; Unexpected roots of simple 2nd degree polynomial equation

[Issue]
Unexpected roots of simple 2nd degree polynomial equation using Symbolics.jl and Nemo.jl

Obtained results: [(1//2)*√(4y), (-1//2)*√(4y)]
Expected result: [√(y), -√(y)]

[Environment]

  • Linux thinkpad 6.1.0-32-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.129-1 (2025-03-06) x86_64 GNU/Linux
  • julia version 1.11.3
  • nemo.jl version v0.48.4
  • symbolics.jl version v6.33.1

[Code]

using Pkg
Pkg.add("Symbolics"); using Symbolics
Pkg.add("Nemo"); using Nemo

@variables x, y
exp1 = x^2 ~ y
roots = symbolic_solve(exp1,x)
println(roots)

[Output]
SymbolicUtils.BasicSymbolic{Real}[(1//2)*√(4y), (-1//2)*√(4y)]

Shouldn’t the answer be +/- sqrt(y)…? Which is what symbolics finds as the 1//2 and the sqrt(4) cancel out.

3 Likes

You are entirely correct, and I value your quick reply. I am uncertain how I failed to recognize this (obvious) fact; I must have been fatigued while addressing this equation.

I have corrected this post and opened a new query [1] to explore how to simplify the output further, specifically why it is not presented in its simplest form and if there is a way to enforce maximum algebraic reduction.

[1] Achieving Maximum Algebraic Simplification in Symbolic Computation