Sheldon wrote: > Thanks again for showing me this. I have been trying to read up on > reduce() as I have never used it before. I would like to know what it > does. So far my search has found nothing that I can grasp. The > reference library notes are estoteric at best. > Can you enlighten me on this matter?'
The .reduce() method on ufuncs works pretty much like the reduce() builtin function. It applies the binary ufunc along the given axis of the array (the first one by default) cumulatively. a = [3, 2, 1, 0] minimum.reduce(a) == minimum(minimum(minimum(a[0], a[1]), a[2]), a[3]) I will note, in the form of enticement to get you to try the currently active array package instead of Numeric, that in numpy, arrays have methods to do minimums and maximum rather more conveniently. >>> import numpy as N >>> a = N.rand(3, 5) >>> a array([[ 0.49892358, 0.11931907, 0.37146848, 0.07494308, 0.91973863], [ 0.92049698, 0.35016683, 0.01711571, 0.59542456, 0.49897077], [ 0.57449315, 0.99592033, 0.20549262, 0.25135288, 0.04111402]]) >>> a.min() 0.017115711878847639 >>> a.min(axis=0) array([ 0.49892358, 0.11931907, 0.01711571, 0.07494308, 0.04111402]) >>> a.min(axis=1) array([ 0.07494308, 0.01711571, 0.04111402]) -- 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 -- http://mail.python.org/mailman/listinfo/python-list