Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed output format of zero dimension sols #1237

Merged
merged 15 commits into from
Sep 7, 2024
5 changes: 0 additions & 5 deletions ext/SymbolicsGroebnerExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,6 @@ function Symbolics.solve_multivar(eqs::Vector, vars::Vector{Num}; dropmultiplici
isempty(tr_basis) && return nothing
vars_gen = setdiff(vars, tr_basis)
sol = solve_zerodim(eqs, vars_gen; dropmultiplicity=dropmultiplicity, warns=warns)
for roots in sol
for x in tr_basis
roots[x] = x
end
end
sol
end

Expand Down
5 changes: 4 additions & 1 deletion src/solver/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ function symbolic_solve(expr, x::T; dropmultiplicity = true, warns = true) where
isequal(sols, nothing) && return nothing
for sol in sols
for var in x
sol[var] = postprocess_root(sol[var])
root = get(sol, var, missing)
if !isequal(wrap(root), missing)
sol[var] = postprocess_root(sol[var])
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ end
@test isequal(symbolic_solve([x^4 - 1, x - 2], [x]), [])

# TODO: test this properly
sol = symbolic_solve([x^3 + 1, x*y^3 - 1], [x, y])
# sol = symbolic_solve([x^3 + 1, x*y^3 - 1], [x, y])
n0rbed marked this conversation as resolved.
Show resolved Hide resolved

eqs = [x*y + 2x^2, y^2 -1]
arr_calcd_roots = sort_arr(symbolic_solve(eqs, [x,y]), [x,y])
Expand Down Expand Up @@ -278,7 +278,7 @@ end

@variables t w u v
sol = symbolic_solve([t*w - 1 ~ 4, u + v + w ~ 1], [t,w,u,v])
@test isequal(sol, [Dict(u => u, t => -5 / (-1 + u + v), v => v, w => 1 - u - v)])
@test isequal(sol, [Dict(t => -5 / (-1 + u + v), w => 1 - u - v)])
end

@testset "Factorisation" begin
Expand Down
Loading