Docsity

Test 2 Resolution - Engineering Analysis Numerical Methods | ME 2004, Exams of Mechanical Engineering

Toggle sidebar
bg1
Name__________________________ Fall 2006
ME 2004: Test 2
Test rules: open book, open notes, no computers permitted.
Problem 1: 20%
Alice buys three apples, a dozen bananas, and one cantaloupe for $2.36.
Bob buys a dozen apples and two cantaloupes for $5.26.
Carol buys two bananas and three cantaloupes for $2.77.
Set up the matrix equation
bxA
, needed to determine the prices of the individual fruits,
where
cantaloupeper price
bananaper price
appleper price
c
b
a
x
x
x
x
77.2
26.5
36.2
320
2012
1123
c
b
a
x
x
x
1
pf3
pf4
pf5

Partial preview of the text

Download Test 2 Resolution - Engineering Analysis Numerical Methods | ME 2004 and more Exams Mechanical Engineering in PDF only on Docsity!

Name__________________________ Fall 2006

ME 2004: Test 2

Test rules: open book, open notes, no computers permitted.

Problem 1: 20%

Alice buys three apples, a dozen bananas, and one cantaloupe for $2.36.

Bob buys a dozen apples and two cantaloupes for $5.26.

Carol buys two bananas and three cantaloupes for $2.77.

Set up the matrix equation A  x  b , needed to determine the prices of the individual fruits,

where

priceper cantaloupe

priceper banana

priceper apple

c

b

a

x

x

x

x

c

b

a

x

x

x

Problem 2: 30%

For each of the following special cases of linear systems of equations, state the row and column

interpretations, sketch the graphical interpretations and answer the questions concerning the rank

and solution. Remember that the rank of a matrix indicates the number of independent rows or

columns.

Case 1

2

1

x

x

Row Interpretation

2 2

1 1

eq : x

eq : x

Column Interpretation

 

 

2

2

1

0

0

1

1 2

x x

Graphical Row Interpretation Graphical Column Interpretation

Rank A Rank

[A,b]

Possibility of Solutions

(check one)

Solution: If the solution is unique, what is it? If

multiple solutions exist, what are they?

___x__Unique solution

_____Multiple solutions

_____No solution

2

1

x

x

x 1

x 2

eq 1

eq 2

C 2 b

C 1

Case 4

 

1

1

2

0 1

1 0

1 1

2

1

x

x

Row Interpretation

3 2

2 1

1 1 2

eq : x

eq : x

eq : x x

Column Interpretation

1

1

2

1

0

1

0

1

1

1 1

x x

Graphical Row Interpretation Graphical Column Interpretation

Rank A Rank

[A,b]

Possibility of Solutions

(check one)

Solution: If the solution is unique, what is

it? If multiple solutions exist, what are

they?

2 2 ___x_Unique solution

_____Multiple solutions

_____No solution

2

1

x

x

x 1

x

2

eq 1 eq 2

eq 3

C 2 b

C 1

Problem 3: 25%

Consider the following psuedocode, intended to compute an approximation to the integral

f(x) dx

b

a

using the trapezoid rule for a specified number of trapezoids, Ntrap.

BEGIN trapWithErrors(f, a, b, Ntrap)

dx = (b-a)/Ntrap

ApproxInt = 0

x = a

FOR n = 1 to Ntrap

ApproxInt = (f(x)+f(x+dx))/2 *dx + ApproxInt

x = x+dx

END FOR

OUTPUT ApproxInt

END trapWithErrors(f, a, b, Ntrap)

a) What answer does ' trapWithErrors' return for the following test case:

f(x) = x, a = 0, b = 1, Ntrap = 2

ApproxInt = 0.

b) What does ' trapWithErrors' return when Ntrap is extremely large? Express

your answer in terms of f, a and b.

After many times through the loop, only the final interval is returned.

ApprroxInt = (f(b)+ f(b-dx))/2  f(b)

Note that dx is small since Ntrap is large.

c) Correct the code, marking your changes directly on the psuedocode. Note that we are

only considering logic problems, not syntax since this is a psuedocode. Also, simply copying

some code from the book receives no credit.

As marked on the psuedocode, there are 2 problems

1) the total sum is not computed: only the last interval

2) the factor dx is missing