Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_units() fail on expressions with binomial (causes a crash in Catalyst) #2554

Closed
TorkelE opened this issue Mar 19, 2024 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@TorkelE
Copy link
Member

TorkelE commented Mar 19, 2024

Ran into this one while trying to update Catalyst for MTKv9:

@parameters p
ModelingToolkit.get_unit(p) # OK
ModelingToolkit.get_unit(binomial(p,2)) # Error

gives

ERROR: MethodError: no method matching binomial(::DynamicQuantities.Quantity{…}, ::DynamicQuantities.Quantity{…})

Closest candidates are:
  binomial(::Number, ::Integer)
   @ Base intfuncs.jl:1193

Stacktrace:
 [1] get_unit(op::Function, args::Vector{Any})
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/Mxj1Q/src/systems/unit_check.jl:82
 [2] get_unit(x::SymbolicUtils.BasicSymbolic{Int64})
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/Mxj1Q/src/systems/unit_check.jl:159
 [3] get_unit(x::Num)
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/Mxj1Q/src/systems/unit_check.jl:74
 [4] top-level scope
   @ ~/Desktop/Julia Playground/Environment - Catalyst test/playground.jl:96
Some type information was truncated. Use `show(err)` to see complete types.

(Specifying that @parameters p::Int64 does not seem to change this)

@TorkelE TorkelE added the bug Something isn't working label Mar 19, 2024
@TorkelE
Copy link
Member Author

TorkelE commented Mar 19, 2024

The same issue goes for factorial

ModelingToolkit.get_unit(factorial(p)) # Error

@ChrisRackauckas
Copy link
Member

Isn't this an error for DynamicQuantities missing function?

@TorkelE
Copy link
Member Author

TorkelE commented Mar 19, 2024

That might def. be the case.

@TorkelE
Copy link
Member Author

TorkelE commented Mar 22, 2024

solved by SymbolicML/DynamicQuantities.jl#125

@TorkelE TorkelE closed this as completed Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants