Week 9: October 26 - 30
Generating Random Numbers
Sequences of random numbers are frequently needed to simulate processes in which outcomes are uncertain. Although computers work on deterministic principles, we see that they can be used to generate "pseudo-random" numbers that satisfy various tests for randomness.
Week 9 Notebook
NumPy
Matplotlib
Quiz 5
- loglog
- semilogx
- semilogy
- mean
- subplot
- Indexing using boolean arrays.
- imread
- imsave
- imshow
- Complex numbers
Sample Quiz 5
Assignment 7: Newton in the Complex Plane
Activity:
- Use Newton's method to find which root different points in a rectangular portion of the complex plane converge to for the equation f(z) = z3 - 1.
- Color the points in this region according to which root they converge to using red, green, and blue (or some other colors of your choice).
- Make an additional zoomed in picture of some interesting region.
- Make a picture encoding the number of iterations needed to converge in the brightness of the color.
Tools:
- Use meshgrid to generate the points in the complex plane, then iterate these points in parallel to find the root they converge to.
- Use NumPy "fancy" indexing with boolean and/or integer arrays to set the colors according to the root.
- Use imshow and imsave to display and save these images.
Report 7 Gallery