20/06/2025, 13:44 Notebook
MSDS 400 Practice Final Solutions
Question 1
Setup: Let x be the number of belts
a) Cost function:: C(x) = 6x + 880
b) Revenue Function:: R(x) = 17x
c) Profit function:: P(x) = 11x - 880
d) To find break-even point set profit function to 0 and solve for x.
** See code below **
The number of engine belts to break even = 80
Question 2
[Link] 400 Practice Final [Link] 1/13
20/06/2025, 13:44 Notebook
Inverse of matrix B:
[[ 13. 12. -29.]
[ 4. 4. -9.]
[ -3. -3. 7.]]
Question 3
[ 7. 2. -2.]
Question 4
[Link] 400 Practice Final [Link] 2/13
20/06/2025, 13:44 Notebook
Setup:
(a) Total number of people
t + s = 288
(b) Total amount of money collected
30t + 20s = 5860
(c) Number of students = 278.0
(d) Number of teachers = 10.0
Question 6
Eigenvalues (largest to smallest):
[2. 1. 1.]
Question 7
Setup: Let be the number of MX300 video games and let be the number of XL2000
x1 x2
video games
[Link] 400 Practice Final [Link] 3/13
20/06/2025, 13:44 Notebook
Maximize: z = 18x1 + 13x2
Subject to:
3x1 + x2 ≤ 255
3x1 + 6x2 ≤ 720
18x1 + 10x2 ≤ 1590
x1 ≥ 0, x2 ≥ 0
If you have not installed pulp, uncomment the cell below and run the cell before running the
code for the next two problems. Contact your TA if you run into difficulties.
30.0
105.0
1905.0
Question 8
[Link] 400 Practice Final [Link] 4/13
20/06/2025, 13:44 Notebook
Setup:
Minimize: w = 680y1 + 700y2 + 720y3
Subject to:
20y1 + 30y2 + 10y3 ≥ 1030
20y2 + 15y3 ≥ 520
15y1 + 25y2 ≥ 680
y1 ≥ 0, y2 ≥ 0, y3 ≥ 0
[Link] 400 Practice Final [Link] 5/13
20/06/2025, 13:44 Notebook
Number of hours to operate Orchard 1: 0.0
Number of hours to operate Orchard 2: 34.333333
Number of hours to operate Orchard 3: 0.0
Minimum Cost is $ 24033.33
Question 9
Marginal cost to produce 10 units is $ -1.68
Question 10
613170 people per year
Question 11
[Link] 400 Practice Final [Link] 6/13
20/06/2025, 13:44 Notebook
In 1971 the percent of persons over 65 in poverty was 20.1703 and the rate of cha
nge was -0.9767
In 1992 the percent of persons over 65 in poverty was 11.3564 and the rate of cha
nge was -0.2170
In 2009 the percent of persons over 65 in poverty was 8.4946 and the rate of chan
ge was -0.1332
Question 12
[Link] 400 Practice Final [Link] 7/13
20/06/2025, 13:44 Notebook
The extrema for this equation are FiniteSet(1.71561572218165, 7.2318830395816)
After 1.71561572218165 years the value is 0.985244462049230
After 7.23188303958160 years the value is 1.21117813960046
Question 13
The total number of barrels that the ship will leak on the first day = 373
The total number of barrels that the ship will leak on the second day = 172
Question 14
[Link] 400 Practice Final [Link] 8/13
20/06/2025, 13:44 Notebook
Total profit in first three years = ${.1f} 77235.0000000000
Profit in fourth years = $ 62462.0000000000
Question 16
y = 0
x = 10
Minimal costs will be $ 210
Question 17
The number of verticies is odd: True
He [is not] able to achieve his goal because by Euler's Theorem, since this graph [does]
have a vertex with odd degree, it [does not] have a Euler circuit.
[Link] 400 Practice Final [Link] 9/13
20/06/2025, 13:44 Notebook
Question 17 (continued)
The written approach to this problem is much different than the solution in Python. The first
thing to do it to sketch the graph of this scenario. We can think of the vertices as the street
corners and each side of the road as an edge. So there are vertices and edges. Next,
9 14
consider the image with vertices labeled:
Now consider the degrees of each vertex. In order from through , the degrees are
A I
. Since there is at least one vertex with odd degree, there is not an
2, 3, 3, 3, 4, 4, 3, 4, 2
Euler circuit.
False
Question 18
Q: Is a Hamilton circuit possible for this graph? If so, give your answer as a list of vertices,
starting and ending at the same vertex. Example: ABCA If it is not possible, enter DNE.
Q: Is a Hamilton path possible for the given graph? If so, give your answer as a list of
vertices, for example, ABCD. If it is not possible, enter DNE.
We have Python code to find the Hamiltonian Circuit first. Then we can find the Hamiltonian
Path:
[Link] 400 Practice Final [Link] 10/13
20/06/2025, 13:44 Notebook
Hamilton Circuit:
array([[0, 1, 0, 0, 1],
[1, 0, 1, 1, 0],
[0, 1, 0, 1, 0],
[0, 1, 1, 0, 1],
[1, 0, 0, 1, 0]])
Solution Exists: Following is one Hamiltonian Cycle
A B C D E A
True
Hamilton Path:
Now that we know the Hamiltonian Circuit,
Hamiltonian Circuit: ABCDEA -->
Edges: AB , BC, CD, DE, EA
You can find the Hamiltonian Path by removing one edge from the Hamiltonian Cycle,
like the last one "EA":
So now we know the Hamiltonian Path,
Edges: AB, BC, CD, DE -->
Hamiltonian Path: ABCDE
Question 19
[Link] 400 Practice Final [Link] 11/13
20/06/2025, 13:44 Notebook
Q: Apply the repeated nearest neighbor algorithm to the graph above. Starting at which
vertex or vertices produces the circuit of lowest cost?
array([[ 0, 0, 0, 3, 13, 2],
[ 0, 0, 0, 11, 8, 1],
[ 0, 0, 0, 6, 15, 7],
[ 3, 11, 6, 0, 0, 0],
[13, 8, 15, 0, 0, 0],
[ 2, 1, 7, 0, 0, 0]])
{'A': (['A', 'F', 'B', 'E', 'C', 'D', 'A'], 35),
'B': (['B', 'F', 'A', 'D', 'C', 'E', 'B'], 35),
'C': (['C', 'D', 'A', 'F', 'B', 'E', 'C'], 35),
'D': (['D', 'A', 'F', 'B', 'E', 'C', 'D'], 35),
'E': (['E', 'B', 'F', 'A', 'D', 'C', 'E'], 35),
'F': (['F', 'B', 'E', 'A', 'D', 'C', 'F'], 38)}
(['A', 'B', 'C', 'D', 'E'], 35)
Q: What is the circuit produced by the nearest neighbor algorithm? Give your answer as a
list of vertices, starting and ending at vertex A.
Example: ABCDEFA
['A', 'F', 'B', 'E', 'C', 'D', 'A']
Question 20
array([[ 0, 0, 0, 10, 13, 2],
[ 0, 0, 0, 15, 14, 6],
[ 0, 0, 0, 7, 12, 4],
[10, 15, 7, 0, 0, 0],
[13, 14, 12, 0, 0, 0],
[ 2, 6, 4, 0, 0, 0]])
[Link] 400 Practice Final [Link] 12/13
20/06/2025, 13:44 Notebook
The selected graph edges for the minimum tree is ['a-f', 'c-f', 'b-f', 'c-d', 'c-
e']
Question 20 (continued)
Apply Kruskal's algorithm and order the edges by weight in ascending order:
AF → 2
CF → 4
BF → 6
CD → 7
AD → 10
CE → 12
AE → 13
BE → 14
BD → 15
Add edges in order except if adding an edge forms a circuit. Once all vertices have been
used, the spanning tree is complete.
AF → CF → BF → CD → AD forms a circuit
AF → CF → BF → CD → CE and the spanning tree is complete.
The total weight of the edges is 2 + 4 + 6 + 7 + 12 = 31 .
Cost: 2
Cost: 4
Cost: 6
Cost: 7
Cost: 12
Computed cost: 31
[Link] 400 Practice Final [Link] 13/13