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

Recent bug: parameter tuples no longer preserve parameter types

Open isaacsas opened this issue 1 year ago • 3 comments

It seems like a breaking change was made to how parameter tuples are handled in a recent release? In the last Catalyst release, 13.4.1, we had doc examples that relied on parameter tuples with mixed types as the underlying ODEs involved factorial functions (a very common term within reaction models). The ODEs were:

 Differential(t)(A(t)) ~ (-k₊*m*(A(t)^m)) / factorial(m) + k₋*B(t)
 Differential(t)(B(t)) ~ (k₊*m*n*(A(t)^m)) / factorial(m) - k₋*B(t)

Previously when building an ODEProblem

p  = (k₊ => 1.0, k₋ => 1.0, m => 2, n => 2)
u₀ = [A => 1.0, B => 1.0]
oprob = ODEProblem(osys, u₀, (0.0, 1.0), p)

and p would contain the same tuple. This seems broken now on master with p being promoted to all floating point, causing code that previously worked just fine to fail.

As this is a breaking change, I would have expected MTK to make a major release but this doesn't seem to have occurred?

This seems like a major issue for Catalyst, since we need the ability to have integer parameters as this is intrinsic to many model types.

Can anyone point me to what version of MTK I should cap the project dependency at until this is fixed?

isaacsas avatar Oct 02 '23 15:10 isaacsas

That is unintended.

ChrisRackauckas avatar Oct 02 '23 15:10 ChrisRackauckas

We unfortunately may not have had a test on this, so I only caught it when the doc examples broke...

isaacsas avatar Oct 02 '23 15:10 isaacsas

Also, the issue is present with the latest Catalyst release and not just master (since the former declares compatibility with all < v9 versions of MTK).

isaacsas avatar Oct 02 '23 15:10 isaacsas

Fixed in v9

ChrisRackauckas avatar Feb 22 '24 13:02 ChrisRackauckas