Comments (7)
Reproduced with sympy 1.5.x but not 1.4.y.
from mumot.
With sympy 1.4 these lines after line 2893 in models.py
:
ODE_1 = solve(ode1, Derivative(PhiDict[nvec[0]], t), dict=True)
ODE_2 = solve(ode2, Derivative(PhiDict[nvec[1]], t), dict=True)
result in [{Derivative(Phi_A, t): -Phi_A**2*r_{A} - Phi_A*Phi_B*r_{A} - Phi_A*Phi_B*s - Phi_A*a_{A} - Phi_A*g_{A} + Phi_A*r_{A} - Phi_B*g_{A} + g_{A}}]
and [{Derivative(Phi_B, t): -Phi_A*Phi_B*r_{B} - Phi_A*Phi_B*s - Phi_A*g_{B} - Phi_B**2*r_{B} - Phi_B*a_{B} - Phi_B*g_{B} + Phi_B*r_{B} + g_{B}}]
being assigned when running model2.showODEs(method='vanKampen')
in the user guide Notebook.
But with Sympy 1.5.1 only empty lists are returned from the solve()
calls.
This appears to be due to
Vlist_lhs, Vlist_rhs, substring = _get_orderedLists_vKE(stoich)
assigning different values to Vlist_lhs
for the two sympy versions.
(The latest docs for Sympy indicate that both the API and implementation of solve()
are a bit of a mess and people should switch to using solveset()
instead: https://docs.sympy.org/latest/modules/solvers/solveset.html)
from mumot.
Exploring further, with Sympy 1.4 simplify(-sqrt(\overline{V})*Derivative(Phi_A, t)*Derivative(P(eta_A, eta_B, eta_U, t), eta_A))
appears to just return its argument, whereas with SymPy 1.5.0 and 1.5.1 simplify
returns 0
(sympy.core.numbers.Zero
).
@jarmarshall Can you identify anything in the SymPy 1.5 or 1.5.1 release notes that might explain this?
from mumot.
I don't see how that could ever be simplified to 0 with the assumptions SymPy has access to, so think it must be a bug...
The following (fairly) minimal working example recreates the problem for me in terms of different behaviour between sympy v1.4 and 1.5, so I will raise an issue on sympy's GitHub:
from sympy import simplify, sqrt, symbols, Symbol, Derivative, Function
V = Symbol(r'\overline{V}', real=True, constant=True)
ea = Symbol('eta_A')
eb = Symbol('eta_B')
eu = Symbol('eta_U')
pa = Symbol('Phi_A')
t = symbols('t')
P = Function('P')
simplify(expr = -sqrt(V)*Derivative(pa, t)*Derivative(P(ea, eb, eu, t), ea))
from mumot.
Hmmm... checking a bit further, it's the simplification of the derivative of pa
wrt t
that returns 0 - presumably it treated the derivative as something it knew nothing about before, whereas now it assumes it is of the form pa*t^0
- need to check if this is a documented change before raising the issue...
from mumot.
OK, my thinking is evolving on this - since the simplification is apparently happening inside a call to solve
we need to figure out what we should actually be doing now - maybe that is an option for solve
, maybe it is replacing with solveset
, or maybe it is actually switching to dsolve
...
I think this is our only remaining upper-bounded package dependency, and 1.5.* is pretty recent so 1.4 should be good for a while longer - are there any other downsides with sticking with 1.4 for a while longer until this is figured out?
from mumot.
Not that I know of. Given SymPy 1.5 was released in December 2019 I agree that pinning sympy <1.5
makes sense for the pending MuMoT release.
The task of comparing solve
/ dsolve
/ solveset
and deciding on a way forward would definitely be suited to someone who's worked with SymPy much more than I have.
from mumot.
Related Issues (20)
- Automatic build and deploy process for releases not working HOT 1
- Test new release of pydstool HOT 1
- Upgrade nbval when new version released HOT 1
- Incompat with Python 3.8: changing dictionary keys during iteration now results in a RuntimeError
- Configure logging via 'logging' module
- Do not suppress tracebacks when running 'test' notebooks via nbval HOT 3
- Multicontroller do not accept some of the plotting parameters that normal controllers support
- ANTLR runtime and generated code versions disagree: 4.8!=4.7.1 HOT 2
- Use of bare 'except:' is bad HOT 1
- MuMoTstochasticSimulationView should support the graphical keywords as other views do
- TkAgg error on MyBinder
- Only define versions in one place (using setuptools-scm) HOT 1
- runtime plot update for multiagent within multicontrollers disables runtime update
- Erroneous line breaks before some (not all) in-line LaTeX in Markdown cells (Safari only) HOT 6
- Intermittently hitting cell execution timeout of 120 seconds HOT 2
- Changing visualisation type of MuMoTstochasticSimulationViews through GUI causes plot deformations (squeezing)
- bifurcation() causes TypeError: cannot determine truth value of Relational HOT 2
- Add CFF file to make it easier for others to cite MuMoT HOT 1
- Controllers broken on MyBinder HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mumot.