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

Unable to reconstruct system from result

Open ctessum opened this issue 2 years ago • 3 comments

When following this SINDy example, a logical final step would be to run a simulation with the discovered system of equations to inspect the result that it gives. One of the steps to do this would be to replace c[1] (the placeholder value for the forcing function) with the actual forcing function in the resulting equations. From a previous version of the documentation that seems like it may have disappeared, it seems that the way to do this would be something like:

t = get_iv(system)
subs_control = Dict(
    c[1] => exp(-((t - 5.0) / 5.0)^2)
)


eqs = map(equations(system)) do eq
    eq.lhs ~ substitute(eq.rhs, subs_control)
end

However, this gives the error ERROR: MethodError: <ₑ(::Num, ::SymbolicUtils.Mul{Real, Int64, Dict{Any, Number}, Nothing}) is ambiguous. Candidates: <ₑ(a::Number, b::SymbolicUtils.Symbolic) in SymbolicUtils at /.../.julia/packages/SymbolicUtils/qulQp/src/ordering.jl:9

Does anyone have any suggestions of how to fix this? Thanks!

[[deps.DataDrivenDiffEq]]
...
git-tree-sha1 = "52b8cdc6a05707d4385bba499653955a16466b86"
uuid = "2445eb08-9709-466a-b3fc-47e12bd697a2"
version = "1.0.0"

[[deps.Symbolics]]
...
git-tree-sha1 = "718328e81b547ef86ebf56fbc8716e6caea17b00"
uuid = "0c5d862f-8b57-4792-8d23-62f2024744c7"
version = "4.13.0"

ctessum avatar Nov 27 '22 18:11 ctessum