-
Notifications
You must be signed in to change notification settings - Fork 31
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
finding all Steady state solutions function using HC method integrated with ModelingToolKits.jl #487
Comments
Hi, at least on our side we have not tried to integrate HC.jl with MTK. The first integration into DiffEqBiological.jl was done by an external person. I don't think that there is a problem in general, just that someone needs to take care of updating compatibilities. |
Hi, jumping in here (think I was that external person). Quite a lot have happened in Catalyst and ModelingToolkit over the last while, and keeping HC support hasn't been possible with those changes, sadly. However, there has also been some improvements that would enable HC steady state finding for a wider range of systems. Hence, I was thinking it would be nice to make another attempt to re-integrate support. Also, we are writing a paper of Catalyst, and it would be nice to show how HC can be used there, since I think its use is not well known within the community. Initially, I just wanted to create a tutorial of how to use HC on a ModelingToolkit system, and figured from there it might be possible to discuss the best way to create more integrated support between the two packages. I already had some code like this which I previously had received from @saschatimme but I am not able to get it to work anymore. Initially, it was like this: using ModelingToolkit
import HomotopyContinuation
const HC = HomotopyContinuation
# Define a MT nonlinear system
@variables x y z
@parameters σ ρ β
eqs = [0 ~ σ*(y-x),
0 ~ x*(ρ-z)-y,
0 ~ x*y - β*z]
ns = NonlinearSystem(eqs, [x,y,z], [σ,ρ,β])
# convert variables and parametrs from nonlinear system to HC vars
hc_vars = HC.Variable.(Symbol.(ns.states))
hc_params = HC.Variable.(Symbol.(ns.ps))
# Now we just would need to evaluate the nonlinear system at (hc_vars, hc_params)
# However this seems to be possibel without actually compiling a function (sigh...)
nlsys_func = generate_function(ns, [x,y,z], [σ,ρ,β], expression=Val{false})[1]
hc_eqs = nlsys_func(hc_vars, hc_params)
HC.System(hc_eqs; variables = hc_vars, parameters = hc_params) However, with recent MTK changes it should be modified slightly to this: using ModelingToolkit
import HomotopyContinuation
const HC = HomotopyContinuation
# Define a MT nonlinear system
@variables x y z
@parameters σ ρ β
eqs = [0 ~ σ*(y-x),
0 ~ x*(ρ-z)-y,
0 ~ x*y - β*z]
@named ns = NonlinearSystem(eqs, [x,y,z], [σ,ρ,β])
# convert variables and parametrs from nonlinear system to HC vars
hc_vars = HC.Variable.(Symbol.(ns.states))
hc_params = HC.Variable.(Symbol.(ns.ps))
# Now we just would need to evaluate the nonlinear system at (hc_vars, hc_params)
# However this seems to be possibel without actually compiling a function (sigh...)
nlsys_func = generate_function(ns, [x,y,z], [σ,ρ,β], expression=Val{false})[1]
hc_eqs = nlsys_func(hc_vars, hc_params)
HC.System(hc_eqs; variables = hc_vars, parameters = hc_params) Unfortunatley, the line
error, and at this point I am kind of stuck. I was reading through the document but didn't find anything on how to combine it with ModelingToolkit. Do you know how we might get it to work on a nonlinear system? |
I think the approach would still be the same, i.e., you "just" need to evaluate the nonlinear system defined with ModelingToolkit at Is there any progress in MT / SymbolicUtils that would give us a simple generic evaluation? |
Got it, will check closer. There has certainly been a lot of progress on MT / SymbolicUtils in the last while. Unfortunately, I haven't been able to follow it properly. I think https://github.com/isaacsas keeps better track, I'll ask him. |
@TorkelE looks to me like there have been some changes to |
Thanks for the help! Yes, I'll open an issue there. |
I just wanted to make you guys aware that HarmonicBalance.jl also got a Symbolics.jl to HomotopyContinutation.jl interface. Maybe it can be useful. |
@danielchen26 given we have added this support back to Catalyst can this be closed? |
yes, thanks. @isaacsas |
OK (FYI, you need to close it since I'm not a maintainer on HomotopyContinuation). |
Thanks for the info. |
I was wondering, is it possible to integrate the HC method into ModelingToolKits.jl right now? Previously, DiffEqBiological.jl has
steady_states
function using HomotopyContinuation.jl. However, since DiffEqBiological.jl been updated to Catalyst.jl, thesteady_states
function is removed. I was told before that the modelingtoolkit.jl framework is somehow not compatible with HC.jl. Is it still true even after a year? I would like to understand the current difficulty of building such steady states function in MTK with HC method.The text was updated successfully, but these errors were encountered: