Open azev77 opened 3 years ago
Try isequal
instead of ==
. That's usually my problem when I run into that error.
This isn't all implemented yet, so it might be good to use this issue to start talking design. For the PDESystem work https://github.com/SciML/ModelingToolkit.jl/issues/822 we've been discussing using DomainSets.jl for representing domains: we might want to make sure the representation is the same for assumptions.
https://github.com/JuliaSymbolics/Symbolics.jl/issues/97 showcased an interesting example of branch elimination via assumptions in SymPy.
@shashi could you do a bit of a lit review on how other CAS's handle assumptions? I think it would make sense to do it through the metadata system, but comments from https://discourse.julialang.org/t/ann-symbolics-jl-a-modern-computer-algebra-system-for-a-modern-language/56251 say we should look at the details here.
Q1: how do I make assumptions about the variables? x1 ∈ Real ∩ Positive ρ ∈ Real ∩ (-Inf, 1]
Is there any update on satisfying assumptions? I have been using SymPy
, where a simple positive=true
flag gives positive numbers, but I cannot seem to find similar functionality for Symbolics
. For my purposes I would like to check positive elements of a matrix (or array), which currently throws an error:
julia> using Symbolics
julia> @variables x[1:3]::Real
julia> x = substitute(Symbolics.scalarize(x), Dict([x[1] => 0]))
julia> indices = findall(x .> 0)
ERROR: TypeError: non-boolean (Num) used in boolean context
Q1: how do I make assumptions about the variables?
x1 ∈ Real ∩ Positive
ρ ∈ Real ∩ (-Inf, 1]
Q2: should the following be equal?
┆Issue is synchronized with this Trello card by Unito