Observation
The result of the mathematical operation (see code section) is not in its simplest algebraic form.
Obtained results: [(1//2)*√(4y), (-1//2)*√(4y)]
Expected result: [√(y), -√(y)]
Question
Does anyone have insight into why it is not expressed in its simplest or reduced form?
Is there a method to achieve maximum algebraic simplification?
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)]
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
The issue here is just that simplify
seems to be missing rules for handling perfect squares:
using SymbolicUtils
@syms y
simplify.([(1//2)*√(4y), (-1//2)*√(4y)])
I’ll open an issue in Symbolics.jl asking for this, it would probably be a good thing to add.
opened 10:11AM - 24 Mar 25 UTC
MWE:
```julia
using Symbolics
@variables y
simplify.([(1//2)*√(4y), (-1//2)*√(4… y)])
simplify_fractions.([(1//2)*√(4y), (-1//2)*√(4y)])
```
```julia
julia> simplify.([(1//2)*√(4y), (-1//2)*√(4y)])
2-element Vector{Num}:
(1//2)*sqrt(4y)
(-1//2)*sqrt(4y)
julia> simplify_fractions.([(1//2)*√(4y), (-1//2)*√(4y)])
2-element Vector{Num}:
(1//2)*sqrt(4y)
(-1//2)*sqrt(4y)
```
I think step one is to make this `√(4)*√(y) * 1//2`, and then have it learn it can simplify perfect squares.
3 Likes
Appreciate your insight and thank you for having created an issue in Symbolics.jl