EGR 103/Spring 2019/Lab 4
Errors / Additions
None yet!
4.1 Introduction
The main purpose of this lab will be to look at selective and iterative structures and to learn about logical masks. The following is a companion piece to the lab handout itself. The sections in this guide will match those in the handout.
4.2 Resources
See main EGR 103 page for links to these
4.3 Getting Started
Same as it ever was.
4.4 Ungraded
These problems are good ones to look at and to solve but are not a part of the graded work. Given that, you can absolutely consult with classmates about how to get the answers to these ungraded problems but you may not share those answers outside of the members of the class.
4.5 Assignment
4.5.1 Sinusoidal Functions
See the Python:Plotting page as well as the matplotlib.pyplot.plot page for information about the additional pieces of information you can give the plt.plot
command to change sizes and colors.
4.5.2 Based on P&E 4.48
The heart of this code will be nested for loops and proper format specifiers to make sure things fit.
4.5.3 P&E 2.32
The heart of this code should be a nested set of for
loops. You will need to think about how to compare the final two digits of the square to the two digit number as well as how to make sure the square is a three digit number before printing a solution.
4.5.4 P&E 2.3.8
The solution to this will require understanding recursion, which requires understanding recursion. More on that in lab.
4.5.5 Beam Deflection
While this references the Chapra book, you will not need to bring the Chapra book to lab - I will have the figure available on screen when we discuss the problem. The main concepts here are using logical masks to create piecewise functions, using different sets of points for mathematical analysis versus graphing, and determining and locating extrema as discussed in Plotting.
General Concepts
This section is not in the lab report but rather has some items in it that span multiple problems in the lab.
Determining and Locating Extrema
See Python:Plotting#Using_Different_Scales for some examples.
Logical Masks
See Python:Logical Masks.