Answers to Ma 162 Spring 2005 final
> | with(linalg): |
Q.1.
> | eq1:=x+y+z=100000; ## Total Investment |
> |
> | eq2:=(10*x+6*y+2*z)/100=8000; ##Income |
> | eq3:=z=20*x/100+10*y/100; ##Extra condition |
> | M:=matrix(3,4,[1,1,1,100000,1/10,3/50,1/50,8000,1/5,1/10,-1,0]);##Augmented matrix |
> | A:=matrix(3,4,[1,1,1,100,5,3,1,400,2,1,-10,0]); ##This is same as above, except the variables are scaled to 1000's of dollars and equations simplified. |
> | A1:=addrow(A,1,2,-5); |
> | A2:=addrow(A1,1,3,-2); |
> | A3:=addrow(A2,2,3,-1/2); |
Now solve by backsub. if we let maple to the work, then:
> | gaussjord(A); |
> | x=65,y=20,z=15; ##Final answer read off. |
> |
Q.2
Let x,y be resp. the number of days of operation of the two mines saddle and Horseshoe.
> | ## Cost calculations C:=14*x+16*y ;## Cost in thousand dollars! |
> | ## Gold target ineq1:=50*x+75*y>=650; |
> | ##Silver target ineq2:=3*x+y>=18; ##Target in 1000 ounces |
> | ##Natural constraints x>=0,y>=0; |
The set up is to minimize C as above subject to the listed inequalities.
Q.3.
> | ## The region has four corners P,Q,R,S where P:=[0,0];Q:=[4,0];S:=[0,6]; |
> | sol:=solve({x+y=6,2*x+y=8},{x,y}); |
> | R:=subs(sol,[x,y]); |
> | chval:=(p,f)->subs([x=p[1],y=p[2]],f); |
> | ["P"=P,chval(P,2*x+6*y)];["Q"=Q,chval(Q,2*x+6*y)];["R"=R,chval(R,2*x+6*y)];["S"=S,chval(S,2*x+6*y)]; |
So the max. is at S =[0,6]
Q.4.
> | ans[a]:=(110-39)/110; ## remove non drinkers, you have the union of the coffee and tea drinker sets. |
> | ans[b]:=(52+41-71)/110; ## find intersection by usual formula. The numerator is 22 |
> | ans[c]:=(52-22)/110; ## coffee drinkers minus both coffee and tea drinkers. |
> | ans[d]:=[52/110*41/110,22/110]; |
> | evalf(%); |
The probabilty of the intersection and the product of two probabilities are within 0.5 so in a crude sense they are independent. If the required agreement is stricter, then they are not!
Q.5.
> | with(combinat): |
> | ans[a]:=numbcomb(120,7);## Sample space size. Choices of 7 tapes from 120 form the sample space. |
> | ans[b]:=numbcomb(15,2)*numbcomb(105,5)/numbcomb(120,7);evalf(%); |
> | ## First find the prob. of no defective tapes and subtract from 1. goodtapes:=numbcomb(105,7)/numbcomb(120,7); ans[c]:=evalf(1-goodtapes); |
> | ans[d]:=evalf(goodtapes); |
Q.6. Sample space is the set of 400 seniors.
> | maleprob:=evalf(150/400);femaleprob:=evalf(250/400); |
> | ## Path: female and with D.L. ans[a]:=femaleprob*0.70; |
> | ## Path male and with D.L. ans[b]:=maleprob*0.50; |
> | ## Paths ending with D.L. -> the above two paths added. ans[c]:=ans[a]+ans[b]; |
> | ## The population with no D.L. has two paths: femaleprob*0.30+maleprob*0.5; |
> | ## out of these, one path has all the females. femaleprob*0.30; |
> | ## So the probability is: ans[d]:=(maleprob*0.50)/(femaleprob*0.30+maleprob*0.5); |
> |
> |
> |