CIVE 1331 COMPUTING FOR ENGINEEERS
LAB 7 -Linear Optimization
1. Introduction.
The objective of this lab is to introduce you to solving linear
optimization problems with Excel.
2. Instructions.
a. Leary Chemical manufactures three chemicals. A, B, and C.
These chemicals are produced via two production processes: 1
and 2. Running process 1 for an hour costs $4 and yields 3 units
of A, 1 of B, and 1 of C. Running process 2 for an hour costs
$1 and produces 1 unit of A and 1 of B. To meet customer demands,
at least 10 units of A, 5 of B, and 3 of C must be produced daily.
Put this problem in standard form. Then, using Excel, graphically
determine a daily production plan that minimizes the cost of meeting
Leary Chemical’s daily demands. Lastly, check your answer by
using the Excel solver tool. (Hint: Use a xy plot without markers
to make the graphical solution.)
b. Rylon corporation manufactures Brute and Chanelle perfumes.
The raw material needed to manufacture each type of perfume can
be purchased for $3 per pound. Processing 1 lb. of raw material
requires 1 hour of laboratory time. Each pound of processed raw
material yields 3 oz of Regular Brute Perfume and 4 oz of Regular
Chanelle Perfume. Regular Brute can be sold for $7/oz and Regular
Chanelle for $6/oz. Rylon also has the option of further processing
Regular Brute and Regular Chanelle to produce Luxury Brute, sold at
$18/oz, and Luxury Chanell, sold at $14/oz. Each ounce of Regular
Brute processed further requires an additional 3 hours of laboratory
time and $4 processing cost and yields 1 oz of Luxury Brute. Each
ounce of Regular Chanelle processed further requires an additional
2 hours of laboratory time and $4 processing cost and yields 1 oz
of Luxury Chanelle. Each year, Rylon has 6000 hours of laboratory
time available and can purchase up to 4000 lbs of lab material. How
can Rylon maximize profits. Assume that the cost of the laboratory
hours is a fixed cost and does not enter into the problem. Put this
problem into standard form and use the Excel solver tool. Do not
attempt to obtain a graphical solution to this problem. (Hint: you
need to know how much of each type of perfume to make and also how
much raw material to buy. Also, profit is defined as revenues-
processing cost-raw material costs.)
3. Deliverables.
Write up a short report for this lab. You should have a single workbook
with a separate sheet for each exercise. Each sheet should be
labeled with the exercise number. Make sure that you include a sheet
which shows your cell formulas. Use the equation editor to put the
problems into standard form into your Word report. The report should
include a summary of the lab and a hard copy of each worksheet.
Include a disk copy of your lab report and workbook. Scan your disks
for viruses. Submit your report and disk to the TA at the next lab
meeting.
CIVE 1331 COMPUTING FOR ENGINEEERS
LAB 8 -Mathematica Fundamentals
1. Introduction.
The objective of this lab is to introduce you to Mathematica.
2. Instructions.
a. Work through the Try It! exercises in Chapter 2 of the Mathematica
Engineers Toolkit on pages 12 to 25. Replace your name in the
appropriate cell. Save this notebook as lab08a.ma.
b. Do Exercises 4, 5, and 6 on pages 31 and 32. Save the notebook
for 4 and 5 as lab08b.ma. Save the notebook for 6 as lab08c.ma.
Note that the notebook contents for exercise 6 is located on page 7.
3. Deliverables.
Write up a short report for this lab. The report should include a
summary of the lab and a hard copy of your workbooks. Submit your
report to the TA at the next lab meeting.
CIVE 1331 COMPUTING FOR ENGINEEERS
LAB 9 -Mathematica Functions
1. Introduction.
The objective of this lab is to extend your knowledge of Mathematica.
2. Instructions.
Create a Mathematica notebook called lab09.ma. In an organized manner
(using section titles), evaluate the following items. Use the help
capability of Mathematica to assist you in making these calculations.
1. The number of minutes in a 365 day year
2. The value of Pi to the first 770 places
3. The exact value of 3 plus the square root of 3
4. A numerical approximation of 3 plus the square root of 3
5. The value e raised to the power 2 Pi
6. 5 is greater than 3
7. Assign a random value to the variable rand1
8. Take the previous result and cube it
9. Derivative of x Sin(x) with respect to x
10. Third derivative of x raised to the nth power
11.
12.
13.
14. The numerical approximation to 40 digits of Sin (Sin (x))
integrated between 0 and 1
15. Make a plot of the sin (x) and the cos (x) over 0 to 2Pi
16. Make a 3 by 3 matrix with the value of each cell being the
product of the row and column
17. Calculate the inverse of this matrix
18. Return the value in the third row and second column
19. Make a plot of the sin (x) and the cos (x) over 0 to 2Pi
20. Make a three dimensional plot of Sin (xy) over 0 to 3 for x and y
3. Deliverables.
Write up a short report for this lab. The report should include a
summary of the lab and a hard copy of your workbook. Include a
disk copy of your lab report and workbook. Scan your disks for
viruses. Submit your report and disk to the TA at the next lab
meeting.
CIVE 1331 COMPUTING FOR ENGINEEERS
LAB 10 -Mathematica Input/Output and Plotting
1. Introduction.
The objective of this lab is to extend your knowledge of Mathematica.
2. Instructions.
Create a Mathematica notebook called lab10.ma. In an organized manner
(using section titles), evaluate the following items. If necessary
use the help capability of Mathematica to assist you in completing
these calculations.
1. Read in the ASCII file called lab10.txt into a one dimension list
called dataset1. This file contains data on the volume of Vodka in
1 liter bottles in a sample of bottles taken from the production line
in a factory over a period of time. Use the appropriate function to
determine how many samples are in the file. Remember about the
possible bug that you may encounter while reading in data.
2. Make a connected line plot of the data in this file. Enhance your
plot with a frame and labels. Adjust the axis as necessary to make
the plot look good. Experiment with other plotting options.
3. Load the statistics package (page 108). Calculate the mean,
median, maximum, minimum, sample standard deviation, and population
standard deviation of this data.
4. Reread the data in the file lab10.txt. This time put the data in
a two dimensional list with sublists holding 4 values. Call this
list dataset2.
5. Create a one dimensional array with 5 elements called meanvals.
6. Use the DO programming function to calculate the mean for each of
the 5 sublists in dataset2. Put these values in the array meanvals.
Inside the DO structure put a print statement so that you know that
your DO structure worked properly.
3. Deliverables.
Write up a short report for this lab. The report should include a
summary of the lab and a hard copy of your workbooks. Include a disk
copy of your lab report and workbooks. Scan your disks for viruses.
Submit your report and disk to the TA at the next lab meeting.
DOS Commands
1. Using filemanager, Connect the network drive R:\bird\fortran.
2. Start a MSDOS shell by clicking the MSDOS icon.
3. Perform the following exercises within the MSDOS shell:
a) change directories to R:\bin
b) list the files in the directory, write down on a piece of paper
how many files there are and the total disk space these file occupy.
c) change directories back to your home directory ( look in file
manager should be something such as h:\)
d) Make a directory called lab11.
e) Change to the directory lab11.
f) Using the MS text editor, make a file called lab11.txt
In the file put Lab #11, your name, your email address, the number
of files and size that you found in R:\bin in step b above. Save
the file and exit the text editor.
g) Make a subdirectory (within the directory lab11) called temp1.
h) Copy the file lab11.txt to the subdirectory temp1.
i) Change directories to the subdirectory temp1.
j) Edit the file lab11.txt. Play with the file, make changes and
save the file.
k) Exit the file. Delete the copy of the file lab11.txt in the
directory temp1.
l) Change directories back to lab11.
m) Remove the subdirectory temp1.
Deliverables: Briefly describe the DOS commands that you used in this
laboratory. What does each command do? Include a copy of the file
lab11.txt that you made.
CIVE 1331 COMPUTING FOR ENGINEEERS
LAB 12 -FORTRAN Programming
1. Introduction.
The objective of this lab is to become familiar with the basic
structure of Fortran programming by writing a simple program,
compiling the program, and executing the program.
2. Instructions.
Create a Fortran program which will prompt the user to input the
vertical component (VCOMP) of a cable and the horizontal component
(HCOMP). From this data, compute the cable length (LENGTH) and
return this output to the screen.
Be careful with the names of the variables and the intrinsic type of
data associated with each.
Check the results of your program by running the following example:
VCOMP=225.3
HCOMP=130.4
3. Deliverables
Write up a short report for this lab. The report should include a
summary of the lab and a hard copy of the source code for your program.
Include a hand calculation checking the accuracy of your program with
the example. Submit your report to the TA at the next lab meeting.
Extra Practice
Once you get your program working, save the source code under a
different name. Play with the variable names such as LENGTH by not
declaring it a REAL value. You may either use the SQRT(number)
function or use ( number)**0.5. Change the horizontal and vertical
components to integer type names and don’t declare them REAL VALUES.
If you instead use (number)**(1/2) how does this affect the answer.
Note that each time you change your source code you must recompile
your program.
CIVE 1331 COMPUTING FOR ENGINEEERS
LAB 12 -FORTRAN Programming
1. Introduction.
The objective of this lab is to become familiar with input and output
data files, as well as programming with DO LOOPS and arrays.
2. Instructions.
Create a Fortran program which will read two arrays (which are the
same size) from an input file. The program should then add the two
arrays. Your program should print the two matrices as well as the
result to an output file. Format counts!
Check the results of your program by running the following example:
3. Deliverables
Write up a short report for this lab. The report should include a
summary of the lab and a hard copy of the source code for your program.
Include a hand calculation checking the accuracy of your program with
the example. Submit your report to the TA at the next lab meeting.
Extra Practice
How would you change the program for matrix multiplication?