EGR 103/Spring 2023/Lab 5

From PrattWiki
Jump to navigation Jump to search

Errors / Additions

None yet!

5.1 Introduction

The main purpose of this lab will be to look at logical masks. The following is a companion piece to the lab handout itself. The sections in this guide will match those in the handout.

5.2 Resources

5.3 Getting Started

5.4 Assignments

5.4.1 Group Gradescope Problem

You should complete this during the lab.

5.4.1.1 Based on Chapra 3.14

The main concept here is to use logical masks to create piecewise functions. The function itself actually only needs to be one line of code! One really, really long "line" of code, but still... Also - all the parentheses are important - each relational operator needs a set, the logical operators need a set, and the products need a set. And if you go over one line, you will need another set on the outside to get Python to code wrap. Be sure to look at the code we generated in class on Monday as well.

If you are getting almost all correct, you may need to use ``np.exp(x)`` rather than ``m.e**x`` in computing your solution.

5.4.2 Individual Lab Report

5.4.2.1 Chapra 3.10 / Beam Deflection

Note: There is an autograded portion of this. For it to work:

  • Your script must be called beam_displacement.py
  • Your function must be called beam_def and it must return an array of deflection values
  • Everything other than your function definitions must be in an if __name__=="__main__": structure

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. Here is the test code and graph from the lab document:

For finding the values and locations of local extrema, see Python:Plotting#Using_Different_Scales for some examples.

General Concepts

This section is not in the lab report but rather has some items in it that span multiple problems in the lab.


Logical Masks

See Python:Logical Masks.


Class Document Protection