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

_varmap_to_vars can lead to InexactError

Open david-pl opened this issue 3 years ago • 0 comments

The type inference of _varmap_to_vars depends on the order of variables in the varmap. If the example_val happens to be real, but there are also complex values in the varmap, an InexactError is thrown. This can happen e.g. when having a complex u, but passing in real parameters (at least that was my use-case).

using ModelingToolkit
using ModelingToolkit: _varmap_to_vars

@parameters t a b
@variables c(t)::Complex
varmap = Dict(a=>1,b=>1,c=>1im)
varlist = [c]
_varmap_to_vars(varmap, varlist)

david-pl avatar Jan 29 '22 17:01 david-pl