Closed chooron closed 7 months ago
Just set the interpolation to be a callable function that is registered. DataInterpolations.jl already does this for its interpolators, so you can just use or copy that: https://github.com/SciML/DataInterpolations.jl/blob/master/ext/DataInterpolationsSymbolicsExt.jl
I want to build a function that can automatically perform interpolation based on input data and register the interpolation function for each variable using @register_symbolic. Then, I want to construct an ODESystem and concatenate it with other ODESystem. The code is as follows:
However, after reading the documentation, I found that only
@variables
can define variables using Symbols in a "non-interactive way", while@register_symbolic
does not support this. Therefore, I usedeval(:(@register_symbolic $(func_nm)(t)))
to register my function. But this approach also has problems. When testing, this method raises an error:And when I delete line mtk.jl:120, i.e., not registering this function, the error doesn't occur, but the equations' result is not aesthetic.
I would like to ask if there is any way to optimize my code and solve this problem.