I try to replicate this example using Jupyter:
My problem is in the last lines where a plot exist. It seems that not all iterations completed
import re