Skip to content

Commit

Permalink
groebner bug and correct solve_for deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
n0rbed committed Aug 14, 2024
1 parent 2c3803f commit fa864e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions ext/SymbolicsGroebnerExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ function Symbolics.solve_multivar(eqs::Vector, vars::Vector{Num}; dropmultiplici
for i = 1:(old_len)
eq += BigInt(rand(-n_iterations:n_iterations))*vars[i]
end

if isequal(eq, new_var)
continue
end

push!(new_eqs, eq)

new_eqs = convert(Vector{Any}, Symbolics.groebner_basis(new_eqs, ordering=Lex(vars)))

if length(new_eqs) <= length(vars)
Expand All @@ -102,6 +108,10 @@ function Symbolics.solve_multivar(eqs::Vector, vars::Vector{Num}; dropmultiplici
generating |= all(Symbolics.degree(var) > 1 for var in Symbolics.get_variables(new_eqs[i]))
end

if isequal(new_eqs[1], new_var)
generating = true
end

n_iterations += 1
end

Expand Down
2 changes: 1 addition & 1 deletion src/linear_algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function A_b(eqs::AbstractArray, vars::AbstractArray, check)
A, b
end

function solve_for(eq::Any, var::Any)
function solve_for(eq::Any, var::Any; simplify=false, check=true)
Base.depwarn("solve_for is deprecated, please use symbolic_linear_solve instead.", :solve_for, force=true)
return symbolic_linear_solve(eq, var)
end
Expand Down

0 comments on commit fa864e1

Please sign in to comment.