nest / ode-toolbox Goto Github PK
View Code? Open in Web Editor NEWAutomatic selection and generation of integration schemes for systems of ordinary differential equations
License: GNU General Public License v2.0
Automatic selection and generation of integration schemes for systems of ordinary differential equations
License: GNU General Public License v2.0
See sympy/sympy#23417. This is causing tests to fail for sympy 1.10 and up.
See #19:
Finally, I want to point out that Scipy's odeint does automatic switching between stiff and non-stiff methods and can return method choice and step size information for every step,
sol, info = scipy.integrate.odeint(f, y0, t, (), jac, full_output=True)
step_size_per_step = info['hu']
method_used_per_step = info['mused']
stiff_steps = (method_used_per_step == 2).sum()
non_stiff_steps = sol.size - stiff_steps
# etc
given your API, it would be straightforward to provide this as a fallback when PyGSL is not available (and looking at PyGSL's website does not inspire confidence as a long-term dependency).
This might require a slight redefinition of our solver selection criteria if automatic switching between solvers cannot be disabled in Scipy. Note that Scipy essentially wraps the ODEPACK solver library.
The system of ODEs is
u_bar_plus' = -u_bar_plus / tau
foo' = u_bar_plus / tau + b
The system has a solution when solved with pen and paper, which is as below
u_bar_plus = e^(-t/tau) + c1
foo = -e^(-t/tau) + b.t + c2
However, the output of ode-toolbox is with an undefined value zoo
which indicates a bidirectional limit of 1/x
with x->0
as mentioned here
"propagators": {
"__P__foo__foo": "1",
"__P__foo__u_bar_plus": "1 - exp(-__h/tau)",
"__P__u_bar_plus__u_bar_plus": "exp(-__h/tau)"
},
"solver": "analytical",
"state_variables": [
"u_bar_plus",
"foo"
],
"update_expressions": {
"foo": "-__P__foo__foo*(b*zoo - foo) - __P__foo__u_bar_plus*(b*zoo - u_bar_plus) + 2*b*zoo",
"u_bar_plus": "__P__u_bar_plus__u_bar_plus*u_bar_plus"
}
Between sympy 1.4 and 1.7, the sympy API was changed leading to the error 'sympy.core' has no attribute 'all_classes'
.
For now, requirements.txt has been updated to require exactly version 1.4. A more permanent fix should involve rewriting the ODE-toolbox function _is_sympy_type()
.
Why shape_state_variables
and shape_state_updates
are stored in the reversed order wrt their derivation order in the json output. But shape_initial_values
are sorted by the derivation order? That should be fixed.
To speed up processing, a caching mechanism should be implemented.
See https://ode-toolbox.readthedocs.io/en/latest/index.html#caching-of-results
Due to API change on upstream matplotlib. See https://github.com/timhoffm/matplotlib/blob/9e1eaac2d38749c42ccc51081fad714cd6ac3cdd/doc/api/next_api_changes/removals.rst: "The parameter warn
of matplotlib.use
has been removed. A failure to switch the backend will now always raise an ImportError
if force
is set; catch that error if necessary."
Thanks to @shraddhajain13 for reporting this!
ODE-toolbox tries to import matplotlib:
ode-toolbox/odetoolbox/__init__.py
Line 46 in d733ea1
The disadvantage of this is that it (re)sets the plotting backend to Agg. A command-line flag should be added to disable this import.
ode-toolbox globally redirects stderr to /dev/null:
ode-toolbox/odetoolbox/stiffness.py
Line 36 in 404b665
This is a problem when another Python package imports odetoolbox but still wants to use stderr for error reporting (I encountered this bug because antlr4's parse errors during NESTML parsing were not being printed to console).
Consider using sympy common subexpression elimination to make returned expressions less long and repetitive. See: https://docs.sympy.org/latest/modules/rewriting.html
Running the script against the aeif_cond_alpha_implicit.json
file in the tests directory raises an error
(NameError: name 'V_m' is not defined).
This must be cached through tests! And test and/or implementation must be fixed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.