sbmlteam / libsbml

LibSBML is a native library for reading, writing and manipulating files and data streams containing the Systems Biology Markup Language (SBML). It offers language bindings for C, C++, C#, Java, JavaScript, MATLAB, Perl, PHP, Python, R and Ruby.

Home Page:https://sbml.org/software/libsbml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug in `SBMLTransforms::replaceFD`?

lkeegan opened this issue · comments

I was using SBMLTransforms::replaceFD to expand/inline functions in math expressions but ran into incorrect results in some cases:

spatial-model-editor/spatial-model-editor#856 (comment)

I think substituting each argument sequentially like this is only valid if there is no overlap between the variables in the function body and the variables that are passed to the function?

This has now been fixed and merged into development. We plan to have a new release including the fix within the next couple of weeks.

@fbergmann thanks! Unfortunately while this fixes the failing test case I don't think it is correct in general, e.g. changing the expression from p * S1 to p - S1 gives incorrect results. I think to do the substitution correctly it needs to be done for all variables at the same time - I've made a PR with an attempt at doing this here: #303