Final Pred401
Final Pred401
Final Pred401
PREDICT_400DL_SEC59
Moin Uddin Siddique
1. A local copy center needs to buy white paper and yellow paper. They can buy from
three suppliers. Supplier 1 sells a package of 20 reams of white and 10 reams of yellow
for $60. Supplier 2 sells a package of 10 reams of white and 10 reams of yellow for $40.
Supplier 3 sells a package of 10 reams of white and 20 reams of yellow for $50. The
copy center needs 350 reams of white and 400 reams of yellow. Using Python,
determine (1) how many packages they should buy from each supplier in order to
minimize cost and (2) the minimum cost.
Ans: Assuming x1, x2, and x3 as the number of packages the local copy center should buy
from supplier 1, 2, and 3 respectively in this problem, we have to minimize,
Result:
Minimized cost: 1350.0
x1, x2, x3 : [ 10. 0. 15.]
They should buy 10 packages from supplier 1 and 15 packages from supplier 2 for the minimum
cost of $1350.
2. A new test has been developed to detect a particular type of cancer. A medical
researcher selects a random sample of 1,000 adults and finds (by other means) that 4%
have this type of cancer. Each of the 1,000 adults is given the new test and it is found
that the test indicates cancer in 99% of those who have it and in 1% of those who do
not. Based on these results, what is the probability of a randomly chosen person having
cancer given that the test indicates cancer? What is the probability of a person having
cancer given that the test does not indicate cancer? Round the probabilities to four
decimal places.
Ans: Let, C indicating people having actual cancer and T indicating Test positive for cancer.
3. If a tank holds 5000 gallons of water, which drains from the bottom of the tank in 40
minutes, then the volume of the water remaining in the tank after 𝑡 minutes is given by
𝑡 2
𝑉(𝑡) = 5000 (1 − 40) , 0 ≤ 𝑡 ≤ 40. Using Python, determine the rate at which water
is draining from the tank. When will it be draining the fastest?
Ans: The rate of change of a function can be derived by finding the derivative of that
function. Let’s find that using python.
if __name__=="__main__":
deriv = [-(25*t/4 - 250) for t in range(0,41)] # minus in the begining is for making this function
concave
time_index = 0
val_index = 0
maximum = -999
for ind,val in enumerate(deriv):
print("Draining rate at time {} is {}".format(ind,val))
if(val>=maximum):
maximum = val
time_index = ind
print("\nThe Fastest Draining was in time {}, and the rate was
{}".format(time_index,maximum))
Results:
Draining rate at time 0 is 250.0
Draining rate at time 1 is 243.75
Draining rate at time 2 is 237.5
Draining rate at time 3 is 231.25
Draining rate at time 4 is 225.0
Draining rate at time 5 is 218.75
Draining rate at time 6 is 212.5
Draining rate at time 7 is 206.25
Draining rate at time 8 is 200.0
Draining rate at time 9 is 193.75
Draining rate at time 10 is 187.5
Draining rate at time 11 is 181.25
Draining rate at time 12 is 175.0
Draining rate at time 13 is 168.75
Draining rate at time 14 is 162.5
Draining rate at time 15 is 156.25
Draining rate at time 16 is 150.0
Draining rate at time 17 is 143.75
Draining rate at time 18 is 137.5
Draining rate at time 19 is 131.25
Draining rate at time 20 is 125.0
Draining rate at time 21 is 118.75
Draining rate at time 22 is 112.5
Draining rate at time 23 is 106.25
Draining rate at time 24 is 100.0
Draining rate at time 25 is 93.75
Draining rate at time 26 is 87.5
Draining rate at time 27 is 81.25
Draining rate at time 28 is 75.0
Draining rate at time 29 is 68.75
Draining rate at time 30 is 62.5
Draining rate at time 31 is 56.25
Draining rate at time 32 is 50.0
Draining rate at time 33 is 43.75
Draining rate at time 34 is 37.5
Draining rate at time 35 is 31.25
Draining rate at time 36 is 25.0
Draining rate at time 37 is 18.75
Draining rate at time 38 is 12.5
Draining rate at time 39 is 6.25
Draining rate at time 40 is -0.0
The Fastest Draining was in time 0, and the rate was 250.0
4. A rectangular container with a volume of 475 ft3 is to be constructed with a square base
and top. The cost per square foot for the bottom is $0.20, for the top is $0.10, and for
the sides is $0.015. Find the dimensions of the container that minimize the cost. Round
to two decimal places.
Ans:
A rectangular container is like a rectangular prism. Volume of a rectangular prism is, V =
Length (l) * Width (w) * Height (h).
The container has a square base and top. That means its length & width is same.
So, in our case, V = l*l*h = l^2 * h
The surface area of the top and bottom is l^2. The surface area of the lateral sides is 4lh.
To find the minimum cost, we should take the first derivative of Cost with respect to l, set it to
zero, and solve for l.
h = 475/3.63^2 ≅ 36.05
Justification: We first took the derivative of the profit function with respect to x and set the
equation equal to 0 in order to find the critical point and hence the point where profit is
maximum. Let’s try to put some other value to check whether my claim is true or not. Let’s
check for 188, 190 item and their profit accordingly.
So, as we can see the profit increases till 189 item and starts decreasing after that.
6. For the following function, determine the domain, critical points, intervals where the
function is increasing or decreasing, inflection points, intervals of concavity, intercepts,
and asymptotes where applicable. Use this information and Python to graph the
function.
1
𝑓(𝑥) = − +4
(𝑥 + 2)2
Ans:
Let’s graph the function with these information in python:
def graph(formula, x_range):
x = np.array(x_range)
y = eval(formula)
plt.plot(x, y)
plt.show()
Result:
7. The rate of growth of the profit (in millions) from an invention is approximated by the
2
function 𝑃′ (𝑥) = 𝑥𝑒 −𝑥 where 𝑥 represents time measured in years. The total profit in
year two that the invention is in operation is $25,000. Find the total profit function.
Round to three decimals.
Ans:
P'(x) = xe^-x^2
let -x^2 = u
so, du = -2x dx
6 1
𝑅 ′ (𝑡) = +
𝑡 + 1 √𝑡 + 1
where 𝑡 is time (in hours) after the drug is administered. Find the total reaction to the
drug from 1 to 8 hours after it is administered. Round to two decimal places.
Ans:
9. Determine if the following function is a probability density function on[0, ∞).
𝑥 3⁄ , 𝑖𝑓 0 ≤ 𝑥 ≤ 2
𝑓(𝑥) = { 8
4⁄ , 𝑖𝑓 𝑥 > 2
𝑥3
Ans:
The function needs to meet two conditions to be a pdf.
1. F(x) cannot be negative.
2. Total probability should equal to 1.
The first condition holds. The probability will never be negative on the given intervals.
The main interval has been separated and made into two intervals. So, we’ll check both parts of
the function and add the results to see whether f(x) is a pdf.
5
P(1≤x≤5) = ∫1 𝑓(𝑥) 𝑑𝑥
2 5
= ∫1 𝑓(𝑥) 𝑑𝑥 + ∫2 𝑓(𝑥) 𝑑𝑥
=1/8 (2^4/4 – 1^4/4) + 4(-1/2*5^2 + 1/2*2^2)
= 31/32 – 2/25 = 0.8888 (rounded to four decimal places)
10. Researchers have shown that the number of successive dry days that occur after a
rainstorm for a particular region is a random variable that is distributed exponentially
with a mean of 9 days. Using Python, determine the (separate) probabilities that 13 or
more successive dry days occur after a rainstorm, and fewer than 2 dry days occur after
a rainstorm. Round the probabilities to four decimal places.
Let’s get this last problem done with python.