-
Notifications
You must be signed in to change notification settings - Fork 157
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
Added the ability to pass known SymPy symbols to symbolics_to_sympy function #351
Conversation
If you can add the metadata to |
the metadata system already exists. LoadError: Base.Meta.ParseError("unknown property type positive")
in expression starting at C:\Users\accou\OneDrive\Computer\Desktop\test.jl:2
option_to_metadata_type(#unused#::Val{:positive}) at variable.jl:173
setprops_expr(expr::Expr, props::Vector{Any}, macroname::Symbol, varname::Expr) at variable.jl:189
construct_var(macroname::Symbol, var_name::Expr, type::Type, call_args::Nothing, val::Nothing, prop::Vector{Any}) at variable.jl:231
construct_vars(macroname::Symbol, v::Symbol, type::Type, call_args::Nothing, val::Nothing, prop::Vector{Any}, transform::Function, isruntime::Bool) at variable.jl:165
_parse_vars(macroname::Symbol, type::Type, x::Tuple{Symbol, Expr}, transform::Function) at variable.jl:136
_parse_vars(macroname::Symbol, type::Type, x::Tuple{Symbol, Expr}) at variable.jl:81
var"@variables"(__source__::LineNumberNode, __module__::Module, xs::Vararg{Any}) at variable.jl:339
eval at boot.jl:373 [inlined] |
If you want to play nice with SymPy you'd need to register or map all possible SymPy assumptions. Can the properties be arbitrary or is it a fixed set? |
It can be arbitrarily extended. Now, some of those stem from the type information, so So I think the metadata ones would be:
Of course, we aren't doing all of the cryptography stuff yet, so I think the main ones are how to handle |
function Symbolics.option_to_metadata_type(::Val{:foo})
FooType
end
@variables x [foo=1]
getmetadata(x, FooType) #=> 1
|
For metadata like odd/even see https://juliasymbolics.github.io/Metatheory.jl/dev/egraphs/#EGraph-Analyses |
The sign of expressions forms a semilattice. This also fits well for an e-graph analysis. Using e-graph analyses doesn't require e-graph rewriting tho. |
SymPy has the ability to add constraints to variables:
These variables however are different than those created by
symbolics_to_sympy
:I added the ability to pass a dictionary, a vector or a tuple of known SymPy symbols to
symbolics_to_sympy
function.This solves #347.
┆Issue is synchronized with this Trello card by Unito