Symbolics.jl icon indicating copy to clipboard operation
Symbolics.jl copied to clipboard

Restrict `Equation`s lhs/rhs types

Open lamorton opened this issue 2 years ago • 1 comments

From https://github.com/SciML/ModelingToolkit.jl/issues/1788#issuecomment-1234612365 Goal is to prevent non-numeric stuff from getting into build_function. Something like:

struct Equation
    """The expression on the left-hand side of the equation."""
    lhs <: Union{Real,Complex}
    """The expression on the right-hand side of the equation."""
    rhs <: Union{Real,Complex}
    function Equation(lhs, rhs)
        new(value(lhs), value(rhs))
    end
end

That would rule out, for instance, strings.

lamorton avatar Sep 03 '22 05:09 lamorton

@YingboMa what's the full set, Union{Number, BasicSymbolic}`?

ChrisRackauckas avatar Feb 22 '24 16:02 ChrisRackauckas