> restart;

The final exam in on Monday 2 May 2004 from 1 till 3PM in SES 238.

Review Questions for MCS 494 Spring 2005

1. On average, due to bad road conditions, one has 5 flat tires per year.

What is the chance of getting two or more flat tires in a week? (Use the discrete Poisson distribution.)

Answer

> restart;

> lambda := 5; T := 7/365;

lambda := 5

T := 7/365

> q := sum(exp(-lambda*T)*(lambda*T)^k/k!,k=0..1);

q := 80/73*exp(-7/73)

> p := 1 - evalf(q);

p := .43138858e-2

2. We have to decide between two types of light bulbs, say A and B, which are expected to last 1000 hours.

Type A has an average life span of 1100 hours with a variation of 200 hours.

Type B has an average life span of 1000 hours with a variation of 400 hours.

Which lamp has the best quality?

Answer

> restart;

> mu[A] := 1100; sigma[A] := 200; mu[B] := 1000; sigma[B] := 400;

mu[A] := 1100

sigma[A] := 200

mu[B] := 1000

sigma[B] := 400

> E[L(A)] := sigma[A]^2 + (mu[A]-1000)^2;

E[L(A)] := 50000

> E[L(B)] := sigma[B]^2 + (mu[B]-1000)^2;

E[L(B)] := 160000

Bulbs of type B has a greater expected loss of quality. Type A has best quality.

3. A supplier of meals is invited to offer its selection for lunch to a school of 100 kids.

There are three types of meals, A, B, and C. Past experience has indicated that 50% of

all kids prefer type A, 30% prefer type B, while type C i s prefered by the remaining 20%.

A kid who will receive its first choice will be happy, while a second choice is still deemed okay,

a kid who has no choice left than to take the third type of meal (whatever that might be) is unhappy.

Suppose the supplier brings in 47 meals of type A, 33 of type B and 25 of type C.

Simulate how many kids will be unhappy.

Answer

> restart;

> A := 47: B := 33: C := 25: # selection of meals available

> happy := 0: okay := 0: unhappy := 0: # counters

> left_to_choose := 100: turn := 1:

> while (left_to_choose > 0) and (turn < 3) do

> choice := stats[random,uniform[0,1]](left_to_choose):

> kids_for_A := select(x -> x <=0.5,[choice]):

> kids_for_B := select(x -> x > 0.5 and x <=.8,[choice]):

> kids_for_C := select(x -> x > 0.8,[choice]):

> nA := nops(kids_for_A);

> nB := nops(kids_for_B);

> nC := nops(kids_for_C);

> left_to_choose := max(nA-A,0) + max(nB-B,0) + max(nC-C,0);

> A := max(A-nA,0); B := max(B-nB,0); C := max(C-nC,0);

> if turn = 1 then

> happy := 100 - left_to_choose;

> elif turn = 2 then

> okay := 100 - happy - left_to_choose;

> unhappy := left_to_choose;

> end if;

> turn := turn + 1;

> end do:

> happy;

97

> okay;

2

> unhappy;

1

>

4. The Fibonacci sequence f(k+2) = f(k+1) + f(k), f(0) = 1, f(1) = 1, can be interpreted as a model

for unlimited growth. Consider the modified sequence s(k+2) = s(k+1) - a*s(k), s(0)=a,s(1)=1,

for some parameter a in [0,1]. What is the behaviour of the sequence in function of a?

Answer

> restart;

> p := x^2 - x + a;

p := x^2-x+a

> solve(p,x);

1/2+1/2*(1-4*a)^(1/2), 1/2-1/2*(1-4*a)^(1/2)

> rsolve({f(n) = f(n-1) - a*f(n-2),f(0)=a,f(1)=0},f(n));

-a*(2*a-1+(1-4*a)^(1/2))/(1-4*a)^(1/2)*(-2*a/(-1+(1...

For a = .25, the sequence becomes constant. For a > .25, the sequence oscillates but is in decline.

5. Suppose we have to assist in scheduling a political campaign. We must decide how many residences

to visit in three towns, we call them A, B, and C. The restrictions are as follows:

1) We can visit at most 50,000 residences, as this is the number of pamphlets we have.

2) Our travel budget is $40,000. In town A, it takes $0.50 to visit one residence, in B it takes $1.00,

while visiting one residence in town C costs $2.00.

3) We can spend at most 300 hours. A visit to a residence takes 2 minutes in town A, 3 minutes in town B, and 1 minute in town C.

4) The number of visits in B and C should not exceed that the number of visits to residences in A.

5) We are expected to raise $1 per visit to a residence in A, $.25 in B, and $3 in C.

We must raise at least $10,000.

The goal is to maximize the votes. Of all residences visited in A, 60% will vote in favor,

in B, the votes will be 50% of all residences visited, and in C it is 75%.

Set up the linear-programming model for this problem.

Answer

Denote by x1, x2, and x3 the number of residences visited in town A, B, and C respectively.

We want to maximize the number of votes:

max 0.6*x1 + 0.5*x2 + 0.75*x3

subject to the following five constraints:

x1 + x2 + x3 <= 50,000

0.5*x1 + x2 + 2*x3 <= 40,000

2*x1 + 3*x2 + x3 <= 60*300

-x1 + x2 + x3 <= 0

- x1 - 0.25*x2 - 3*x3 <= -10,000

6. Consider a function f(t) = exp(a*t)*b, sampled for t = 0.3, 0.6, 0.9 giving the values

v := [8.607079764, 7.408182207, 6.376281516]. Use least squares to determine a and b.

Answer

> restart;

> form := exp(a*t)*b;

form := exp(a*t)*b

> T := [seq(k*3/10,k=1..3)];

T := [3/10, 3/5, 9/10]

> v := [8.607079764, 7.408182207, 6.376281516];

v := [8.607079764, 7.408182207, 6.376281516]

> line := a + b*t:

> s := [seq(subs(t=T[k],line)=log(v[k]),k=1..3)];

s := [a+3/10*b = 2.152585093, a+3/5*b = 2.002585093...

> A,b := LinearAlgebra[GenerateMatrix](s,[a,b]);

A, b := _rtable[137550928], _rtable[136899992]

> c := LinearAlgebra[LeastSquares](A,b);

c := _rtable[135282768]

> a := c[2]; b := exp(c[1]);

a := -.499999999999996668

b := 10.00000000

> form;

10.00000000*exp(-.499999999999996668*t)

7. An investment of $10,000 will save us $1,500 each year for the coming eight years.

Use continuous compounding and a discount rate of 6% to compute the present worth of the savings.

Is the investment worthwhile?

Answer

> restart;

> s := 1500: r := 0.06:

> pw := sum(s*exp(-r*t),t=1..8);

pw := 9247.361702

Since the present value of the savings is less than $10,000, the investment is not worthwhile.

8. Consider the demand function q = D(p) = 1/p.

Compute the elasticity of this demand function. Interpret the value you obtain.

If the unit price is currently $2 per unit, should the producer change this price. Justify.

Characterize all demand functions for which the elasticity is one.

Answer

> restart;

> demand := 1/p;

demand := 1/p

> e := -p*diff(demand,p)/demand;

e := 1

Since the elasticity is two, the revenue of the producer will not change if the price changes.

> ode := -p*diff(f(p),p)/f(p) = 1;

ode := -p*diff(f(p),p)/f(p) = 1

> dsolve(ode,f(p));

f(p) = _C1/p