Skip to content

Commit ab2f7e0

Browse files
committed
save progress
1 parent b043fd5 commit ab2f7e0

File tree

5 files changed

+832
-810
lines changed

5 files changed

+832
-810
lines changed

src/expression_utils.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,31 @@ function is_escaped_expr(expr)
101101
end
102102

103103

104+
# the following function is adapted from SymbolicUtils.jl v.19
105+
# later on (Spetember 2023) modified by Torkel and Shashi (now assumes input not on polynomial form, which is handled elsewhere, previous version failed in these cases anyway).
106+
# Copyright (c) 2020: Shashi Gowda, Yingbo Ma, Mason Protter, Julia Computing.
107+
# MIT license
108+
"""
109+
to_multivariate_poly(polyeqs::AbstractVector{BasicSymbolic{Real}})
110+
111+
Convert the given system of polynomial equations to multivariate polynomial representation.
112+
For example, this can be used in HomotopyContinuation.jl functions.
113+
"""
114+
function to_multivariate_poly(polyeqs::AbstractVector{Symbolics.BasicSymbolic{Real}})
115+
@assert length(polyeqs)>=1 "At least one expression must be passed to `multivariate_poly`."
116+
117+
pvar2sym, sym2term = SymbolicUtils.get_pvar2sym(), SymbolicUtils.get_sym2term()
118+
ps = map(polyeqs) do x
119+
if istree(x) && operation(x) == (/)
120+
error("We should not be able to get here, please contact the package authors.")
121+
else
122+
PolyForm(x, pvar2sym, sym2term).p
123+
end
124+
end
125+
126+
ps
127+
end
128+
104129
### Old Stuff ###
105130

106131
#This will be called whenever a function stored in funcdict is called.

0 commit comments

Comments
 (0)