minor optimization in simulate (removed list.append)
minor optimization in theta(x), not using np.any now, expecting scalar