MATH 9 Final: Final Exam (2/3) - Fall 2017

84 views42 pages

Document Summary

[4 5 6]] shape was: (2, 3) zeros: We also spoke about how numpy makes it easy to combine arrays with different shapes (dimensions): [10 11 12 13 14 15 16 17 18] The number 10 is broadcast into a one-dimensional array of the same size as x and then combined with it elementwise. We also spoke about how numpy allows you to apply functions, e. g. sum, to sub-arrays of a given array: Np . sin(xs) zs plt . plot(xs, ys) plt . plot(xs, zs) Typeerror: only length-1 arrays can be converted to python scalars. What happened? math. cos cannot swallow an array (but np. cos can). We can make math. cos do so by "vectorizing" it: Np . vectorize(math . cos)(xs) ys plt . plot(xs, ys) plt . plot(xs, zs) If we transpose the matrix that represents the image, then hopefully the image will be the right-way up:

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related textbook solutions

Related Documents

Related Questions