EGR 103/Spring 2019/Lab 4

From PrattWiki
Revision as of 14:42, 6 February 2019 by DukeEgr93 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Errors / Additions

None yet!

BASH Shortcuts

During lab, we will set up your account to have two new Unix shortcuts to make working with labs a little easier. To make this work, you will need to follow the instructions at BASH Shortcuts to:

  • Create a ~/.bashrc file in your home directory with the contents described on BASH Shortcuts
  • Create a ~/.bash file in your home directory with the two functions (get103 and ltx) described on BASH Shortcuts

From this point forward, every time you log in those shortcuts will be available. To make them available immediately without having to log out and log back in, you will need to type

source ~/.bashrc

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.


Class Document Protection