{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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
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 [email protected] Initial version. 2009-09-29 0.2 [email protected] Updated doc header, standardized imports. ''' return np.sin(xy[1]) * np.exp(-xy[0]/1000.)...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern