AllenDowney / ModSimPy

Text and supporting code for Modeling and Simulation in Python
https://allendowney.github.io/ModSimPy/
MIT License
823 stars 1.76k forks source link

Issue: Multiple assignment of State in code #39

Closed BhagchandLomore11 closed 5 years ago

BhagchandLomore11 commented 5 years ago

Hi, Could anyone help me? I am try to execute examples from chapter 18. I am facing this issue with multiple assignment G, X = state in slope_func. where G and X assigned randomly to values inside state but not on position basis. which is creating further problem. I tried to assign G = state.G and X = state.X but that cause problem while running run_ode_solver and shows AttributeError: 'numpy.ndarray' object has no attribute 'G'

AllenDowney commented 5 years ago

This might be an issue with versions of Python prior to Python 3.6, which do not guarantee the order of elements in a dictionary. If you are not on Python >=3.6, you might have to upgrade.