Skip to content

Simplification and equality checking not good with arrays #1643

@baggepinnen

Description

@baggepinnen

I have two expressions that are clearly equal, but I cannot figure out a way to simplify them enough so that Symbolics understand this. I have a feeling that it's due to simplify failing to do much with arrays

julia> result.control_law
(Num[1;;] \ broadcast(-, v, SymbolicUtils.BasicSymbolic{Real}[x2^3]))[Base.OneTo(1)]

julia> simplify(result.control_law)
(Num[1;;] \ broadcast(-, v, SymbolicUtils.BasicSymbolic{Real}[x2^3]))[Base.OneTo(1)]

julia> isequal(result.control_law, result.v - [x2^3])
false

Also, scalarize does not have the desired effect

julia> Symbolics.scalarize(result.control_law)
1-element Vector{Num}:
 (Num[1;;] \ broadcast(-, v, SymbolicUtils.BasicSymbolic{Real}[x2^3]))[1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions