sinexp - >>> nx = 100 >>> ny = 100...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import numpy as np def sinexp(xy): ''' Calculates f = sin(xy[1]) * exp(-xy[0]/1000). Parameters ---------- xy: array_like Abcissas for the function. This may be any array with more than one dimension, or a linear array with 2 elements. Returns ------- result: array_like This function returns sin(xy[1]) * exp(-y[0]/1000). The shape of the output depends on that of the input. Example ------- >>> import numpy as np >>> import sinexp as se >>> import matplotlib.pyplot as plt
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: >>> nx = 100 >>> ny = 100 >>> xy = np.indices((ny,nx), dtype=float) >>> xy[0] *= 3000. / ny >>> xy[1] *= 30. / nx >>> z = se.sinexp(xy) >>> plt.imshow(z, origin='lower') >>> plt.show() Revisions---------2007-11-22 0.1 jh@physics.ucf.edu Initial version. 2009-09-29 0.2 jh@physics.ucf.edu Updated doc header, standardized imports. ''' return np.sin(xy[1]) * np.exp(-xy[0]/1000.)...
View Full Document

This note was uploaded on 11/09/2009 for the course AST 4762 taught by Professor Harrington during the Fall '09 term at University of Central Florida.

Ask a homework question - tutors are online