out[ ]in [ ]plt title("image plot of $\sqrt{ ^ ^ }for grid of values"out[ ]see figure - here used the matplotlib function imshow to create an image plot from array of function values figure - plot of function evaluated on grid expressing conditional logic as array operations the numpy where function is vectorized version of the ternary expression if condi tion else suppose we had boolean array and two arrays of valuesin [ ]xarr np array([ ]in [ ]yarr np array([ ]in [ ]cond np array([truefalsetruetruefalse]suppose we wanted to take value from xarr whenever the corresponding value in cond is true otherwise take the value from yarr list comprehension doing this might look likein [ ]result [( if else yfor xyc in zip(xarryarrcond)in [ ]result out[ ][ numpy basicsarrays and vectorized computation www it-ebooks info