The code from the page chaotic attractor reconstruction. returns an error when running under Python 3.4.4 as follows:
SyntaxError: invalid syntax
at the 2nd opening parenthesis in the parameter part of the function:
def rossler_odes((x, y, z), (a, b, c)):
return numpy.array([-y - z, x + a * y, b + z * (x - c)])
I am guessing this could be a Python version issue e.g. code created for version older than 3.4.4. I do not know Python but I wish to run this to learn the physics and of course the language.
Tuple parameter unpacking has been removed in Python 3, see PEP 3113, also What's new in Python 3.0. As suggested there, the easiest way to make your code Python 2/3 compatible is to use
def rossler_odes(x_y_z, a_b_c):
x, y, z = x_y_z
a, b, c = a_b_c
return numpy.array([-y - z, x + a * y, b + z * (x - c)])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With