Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Chemical Engineering Calculations - Solutions to Exam 2 | CH E 111, Study notes of Chemistry

Material Type: Notes; Professor: Rockstraw; Class: Introduction to Computer Calculations in Chemical Engineering; Subject: CHEMICAL ENGINEERING; University: New Mexico State University-Main Campus; Term: Spring 2006;

Typology: Study notes

Pre 2010

Uploaded on 08/09/2009

koofers-user-qlw
koofers-user-qlw 🇺🇸

4.7

(6)

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
D.A. Rockstraw, Ph.D., P.E.
NEW MEXICO STATE UNIVERSITY
Department of Chemical Engineering
Ch E 111 – Chemical Engineering Calculations
Spring 2006, Exam 2
Full Name (please print) SOLUTION
Social Security Number
By my signature, I attest that the work contained within this exam is a result of my own efforts. I did not
receive, provide, or supplicate assistance from anyone during the course of this examination. Further, I
understand that if found guilty of ethical violations regarding my solution to this exam, I will be punished
to the maximum extent allowable described under "Academic Misconduct" in the NMSU Student
Handbook. I understand the "Student Code of Conduct" provides policies and procedures that will be
followed by the faculty member administering this examination should an accusation be made by the
exam proctor or a fellow student. Finally, I accept and agree to fulfill my responsibility to report (in
writing) to the supervising professor should I observe any solicitation for assistance or action that can
be regarded as cheating within 24 hours of the completion of the exam.
Signature Date
Examination Rules & Directions
Open Book & Notes
Save the script file under the name ChE111X2___.m, where ___ should be your
last name. Email the file to drockstr@nmsu.edu. Assure you have delivered it to
the correct address, files will not be accepted after 2:25 PM, Thursday 3/30/2006.
Sign this document and staple it to a hardcopy of your script file. Deliver it to my
box in JH 259 with by the due date/time.
NOTE:
This exam is to be solved independently, and may not be discussed with
other persons. Collaboration will result in a 0 assigned for this exam.
pf3
pf4

Partial preview of the text

Download Chemical Engineering Calculations - Solutions to Exam 2 | CH E 111 and more Study notes Chemistry in PDF only on Docsity!

NEW MEXICO STATE UNIVERSITY

Department of Chemical Engineering

Ch E 111 – Chemical Engineering Calculations

Spring 2006, Exam 2

Full Name (please print) SOLUTION

Social Security Number

By my signature, I attest that the work contained within this exam is a result of my own efforts. I did not

receive, provide, or supplicate assistance from anyone during the course of this examination. Further, I

understand that if found guilty of ethical violations regarding my solution to this exam, I will be punished

to the maximum extent allowable described under "Academic Misconduct" in the NMSU Student

Handbook. I understand the "Student Code of Conduct" provides policies and procedures that will be

followed by the faculty member administering this examination should an accusation be made by the

exam proctor or a fellow student. Finally, I accept and agree to fulfill my responsibility to report (in

writing) to the supervising professor should I observe any solicitation for assistance or action that can

be regarded as cheating within 24 hours of the completion of the exam.

Signature Date

Examination Rules & Directions

• Open Book & Notes

• Save the script file under the name ChE111X2___.m, where ___ should be your

last name. Email the file to drockstr@nmsu.edu. Assure you have delivered it to

the correct address, files will not be accepted after 2:25 PM, Thursday 3/30/2006.

• Sign this document and staple it to a hardcopy of your script file. Deliver it to my

box in JH 259 with by the due date/time.

• NOTE:

This exam is to be solved independently, and may not be discussed with

other persons. Collaboration will result in a 0 assigned for this exam.

Problem 1 (100 points):

Write a Matlab7 script file that accomplishes the following objectives:

1. The program input section should prompt the user to select one of four program functions,

requiring the user enter either F, S, C, or P as defined:

F = function S = term summation

C = combination P = permutation

The program should insist the user provide one of these four inputs, or exit the program, and

should indicate when an error in input is made, and repeat the request. This section should use

character input rather than numerical input.

2. If the user selects “F”, the input section of this portion of the program should request the user

provide a function in a string format. The program input should also request the beginning and

end values of the range variable (x) for which the function should be plotted. The program output

should include a plot of the function, with labels for the x and y axes, and a title on the plot that

reads “f(x) = ____”, where the blank contains the function string provided by the user.

3. If the user selects “S”, the input section of this part of the program requests the user input a

function in the form of a string and the number of terms (n) to be summed as:

∑^ ( )

=

n

x

y f x 1

The program should then indicate “the sum of the first n terms of the function f(x) = y is sum”,

where the underlined items are replaced with the user inputs or calculated quantities as

appropriate. The program should plot two results on the same graph:

  • each term in the series vs. x with a red line and a red circle for each point
  • cumulative sum vs. x with a blue line and a black five-pointed star for each point

4. If the user selects “P” for permutation calculation, the input section should request how many

items the user wishes to apply to a permutation calculation (n), and the number of items taken at

a time (k). The program should then calculate the number of possible permutations using:

( )!

!

n k

n P

=

Note that there is a built-in function that calculates factorials. If you are unfamiliar with a

“factorial”, it is the product of all integer terms including and less than the value n.

( )( )( ) ( )( )

7! 7 6 5 4 3 2 1

! 1 2 3 21

= × × × × × ×

n = nnnn − K

The output section of the program should then indicate “n items taken k at a time can be

permutated in P different ways”, where the underlined items are replaced with the user inputs or

calculated quantities as appropriate.

5. Finally, if the user selects “C” for combination calculation, the input section of the program should

request how many items the user wishes to apply to a combination calculation (n), and how many

are taken at a time (k). The program should then calculate the number of possible combinations:

( ) ( )!!

!

n k k

n C

=

The output section of the program should then indicate “n items taken k at a time can be

combined in P different ways”, where the underlined items are replaced with the user inputs or

calculated quantities as appropriate.

Session 1: Run your program, Select F;

Use the following function: f(x)= x^2+1; Plot over the interval for x of [-3, 3]

>> exam

Enter which program feature do you wish to use?

F = function

S = term summation

C = combination

P = permutation

Enter F, S, C, or P:

F

enter the function of x you wish to plot as a string:

'x^2+1'

enter the minimum x value: -

enter the maximum x value: 3

Session 2:; Run your program, Select S

Use the following function: f(x)=exp(-x/n)/abs(cos(x/n2pi))

Specify ten terms for the summation

>> exam

Enter which program feature do you wish to use?

F = function

S = term summation

C = combination

P = permutation

Enter F, S, C, or P:

S

enter the number of terms in the summation: 10

enter the function of x to be summed as a string:

'exp(-x/n)/abs(cos(x/n2pi))'

sum of the first 10 terms of the function f(x)=exp(-

x/n)/abs(cos(x/n2pi)) is 12.

Current plot held

Current plot released

Session 3: Run your program, Select P; Specify a permutation of 10 items taken 4 at a time

>> exam

Enter which program feature do you wish to use?

F = function

S = term summation

C = combination

P = permutation

Enter F, S, C, or P:

P

how many items in the permutation?: 10

how many are taken at a time?: 4

10 items taken 4 at a time can be permuted in 5040 different ways

Session 4: Run your program, Select C; Specify a combination of 10 items taken 4 at a time

>> exam

Enter which program feature do you wish to use?

F = function

S = term summation

C = combination

P = permutation

Enter F, S, C, or P:

C

how many items in the combination?: 10

how many are taken at a time?: 4

10 items taken 4 at a time can be combined in 210 different ways

(^1) -3 -2 -1 0 1 2 3

2

3

4

5

6

7

8

9

10

x

f(x)

f(x)=x 2 +

(^01 2 3 4 5 6 7 8 9 )

2

4

6

8

10

12

14

x

term evaluation and cumulative sum

evaluation of the series exp(-x/n)/abs(cos(x/n2pi))

term sum