Thanks, Robert! DG
--- On Mon, 6/8/09, Robert Kern <robert.k...@gmail.com> wrote: > I haven't been able to figure out (though I haven't yet > really buckled down and tried real hard) how to broadcast a > conditionally-terminated iteration where the number of > iterations will vary among the array elements. Hopefully > someone else already has. :-) > > You can't, really. What you can do is just keep iterating > with the > whole data set and ignore the parts that have already > converged. Here > is an example: > > z = np.zeros((201,201), dtype=complex) > Y, X = np.mgrid[1:-1:-201j, -1.5:0.5:201j] > c = np.empty_like(z) > c.real = X > c.imag = Y > N = np.zeros(z.shape, dtype=int) > > while ((N<30) | (abs(z)<2)).all(): > N += abs(z) < 2 > z = z ** 2 + c > > N[N>=30] = 0 > > -- > Robert Kern > > "I have come to believe that the whole world is an enigma, > a harmless > enigma that is made terrible by our own mad attempt to > interpret it as > though it had an underlying truth." > -- Umberto Eco > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion