Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Microsoft Word - Lab11.docx ENGR 102 - Lab 11 This weeks activities are to be done with others. You can work with friends and classmates outside of class and will work with classmates during...

1 answer below »
Microsoft Word - Lab11.docx
ENGR 102 - Lab 11
This weeks activities are to be done with others. You can work with friends and classmates outside of
class and will work with classmates during recitation. PLEASE BE SURE TO INCLUDE THE NAMES OF
THOSE YOU WORKED WITH IN THE HEADER FILE.
Deliverables:
There are two pdf files for this team assignment. Please submit the following files to eCampus:
• Lab11a_Act1.pdf
• Lab11a_Act2.pdf

This week’s lab and individual assignments are meant to familiarize you with two of the most commonly
used engineering packages in Python: numpy and matplotlib. It will also begin to give you more
experience in making function calls and using a module. To do this, as a team you will work some of the
asic tutorial/intro material for each one, and ensure that each member of the team knows how it
works.

numpy is a package for performing scientific computing. In particular, it offers functions and types that
will allow you to create vectors and matrices, and perform linear alge
a operations more easily. The
website for numpy is: http:
www.numpy.org/

matplotlib is a li
ary for creating plots, graphs, and charts. It supports a wide range of plots and
graphs, and is often used for visualizing data. The website for matplotlib is: https:
matplotlib.org/
Activity #1: Functions
The key idea is to write functions that can be used to analyze the amount of material remaining after
drilling a hole through a metal block. In creating your function, you should create a program that will
essentially “test” the functions. For example, you might include several function calls and the results,
or create a program where a user can enter values and see the results.
Imagine that you have a block of material in which a hole has been drilled:







a. Write a function that will take in (arguments/parameters) the dimensions of the metal block,
length, width, and height. The function should also take in a numpy a
ay of radii of 32 linearly
spaced values between 0 and the maximum value of (width or length). The radii is for a hole that
is to be bored through the metal block. Assume the hole has been drilled along the height
direction. The function should return two a
ays: 1) the diameter of the hole; and, 2) the
volume of material remaining.
. Write a function that will take in two a
ays co
esponding to diameter of a cylinder (from the
function above) and the volume of material remaining as well as a string co
esponding to the
units used for the dimension of the hole (i.e. cm, m, in. etc.) The function should produce a
figure with a plot with two curves. The first curve, shown as a blue solid line, should plot the
volume of material remaining (ordinate) versus the diameter of the bore (abcissa). A second
curve should also be plotted that co
esponds to the volume of the bore (ordinate) versus the
diameter of the bore (abcissa). The second curve should be a red dashed line. Your plot should
include major gridlines for both axes, a legend, axes labels that include units, and a title. The
scale of your abcissa should be from zero to the maximum value rounded up to the next whole
number. Example: 4.3 would round to 5, 123 would round to 130.
c. Create a third function that will take in two arguments. The first is a single float that
co
esponds to the volume of metal remaining and the second is a value for density. The
function should return the mass of material remaining.
https:
www.engineersedge.com/materials/densities_of_metals_and_elements_table_13976.h
tm

Name your program Lab11a_Act1.py. This activity will be manually graded.

Activity #2: Linear equations
This activity will focus on using numpy a
ays and plotting. You are working on developing a new
insecticide. A mixture of 12 liters of chemical A, 16 liters of chemical B, and 26 liters of chemical C is
equired to kill a destructive crop insect. Product X contains 1, 2, and 2 parts, respectively, of these
chemicals (A, B, and C). Product Y contains only chemical C. Product Z contains only chemicals A and B in
equal amounts. How much of each type of commercial spray is needed to get the desired mixture?

a. Setup the three linear equations. The unknowns will be X, Y, and Z co
esponding to the three
products available to mix and each equation will co
espond to the chemicals A, B, and C. The
three equations should have the unknowns on the left hand side of the equal sign and the
constants on the right hand side.
. Create a coefficient matrix from your three equations along with a solution vector. Use the
numpy function to solve this linear equation as described in the lecture notes. Print the solution
for X, Y, and Z. Be sure to use a descriptive statement including units.
c. Create numpy a
ays for X, Y, Z each consisting of 101 points between 0 and 20 each (the units
will be liters). Plot the three lines in 3D space. The following link may help.
https:
matplotlib.org/examples/mplot3d/lines3d_demo.html Include a red circle at the X, Y, Z
point determined in part b. Print out any interesting observation.

Name your program Lab11a_Act2.py. This activity will be manually graded.
Answered Same Day Nov 13, 2021

Solution

Yogesh answered on Nov 14 2021
156 Votes
import numpy as np
from matplotlib.pyplot import *
def func1(length, width, height, rad_a
ay):
global c_height
c_height = height #for use in func2

dia_a
ay = rad_a
ay*2

block_volume = length*width*height
cylinder_volume_a
ay = 3.14*(rad_a
ay**2)*height

remain_volume_a
ay = block_volume - cylinder_volume_a
ay

#for dia in dia_a
ay:
# print(dia)
# print("\n\n\n")
# for vol in remain_volume_a
ay:
# print(vol)
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here