JuliaSymbolics / SymbolicUtils.jl

Symbolic expressions, rewriting and simplification
https://docs.sciml.ai/SymbolicUtils/stable/
Other
527 stars 100 forks source link

Unexpected behaviour of rules #426

Open xtalax opened 2 years ago

xtalax commented 2 years ago
using ModelingToolkit, SymbolicUtils, Test

@parameters x, t
@variables u(..)

r = @rule u(t, 0) => 0

@test r(u(t, 0)) !== nothing

@test r(u(t, 0.0)) !== nothing
shashi commented 2 years ago

You need to Symbolics.unwrap the expression before running rules.

try:

r(Symbolics.unwrap(u(t, 0)))

Should be documented for sure.

xtalax commented 2 years ago
using ModelingToolkit, SymbolicUtils, Test

@parameters x, t
@variables u(..)

r = @rule u(t, 0) => 0

@test r(Symbolics.unwrap(u(t, 0))) !== nothing

@test r(Symbolics.unwrap(u(t, 0.0))) !== nothing

Still fails