> restart;

>

Optimization Problems

Example 1. A plane has crashed in the desert, 15 miles from a straight road. A rescue team can travel 50 miles per hour on the road but only 10 miles per hour in the desert. The rescue truck is 60 miles from the point P on the road which is exactly 15 miles from the crash site. It can leave the road at the point P but perhaps it can arrive faster by leaving the road sooner. What should the rescue team do?

[Maple OLE 2.0 Object]

Let x denote the distance from the initial position of the rescue truck to the point at which the truck leaves the road and turns into the desert. It will then travel a distance of x miles along the road and (by the Pythagorean theorem) a distance [Maple Math] miles through the desert. The travel time along the road is then (by time = distance/speed) [Maple Math] hours. Similarly, the time through the desert is [Maple Math] hours. Thus we want to determine x, the distance that the truck travels along the road before it turns to the desert, for which that the total travel time [Maple Math] is minimal. In other words, we are looking for the global minimum of the function T(x) in the interval [0,60]. Indeed, the only values of x which make sense physically are those in between 0 and 60. Here's the solution using Maple. We begin by defining the function T(x).

> T:= x->x/50+sqrt((60-x)^2+15^2)/10;

[Maple Math]

Let's plot the function T(x) in the interval [0,60] to see where the global minimum might be.

> plot(T(x),x=0..60,labels=["x-miles before turning to desert", "T-total travel time"]);

[Maple Plot]

>

We see that the global minimum is somewhere between 50 and 60. That is, the truck should leave the road sometime after having traveled fifty miles along the road. Let's plot T(x) on the smaller interval to have a better idea when it might be.

> plot(T(x),x=50..60,labels=["x-miles before turning to desert","T-total travel time"]);

[Maple Plot]

>

Now we see more clearly that the global minimum is between 56 and 58 miles. To find the exact value we have to find the corresponding zero of the derivative D(T)(x).

> D(T);

[Maple Math]

> bestx:=solve(D(T)(x)=0,x);

[Maple Math]

> evalf(bestx);

[Maple Math]

>

We see that the truck should leave the road after having traveled about 56.94 miles along the road.

Example 2. If the truck could go, say, 15 mph in the desert, should it leave the road before having traveled 56.94 miles, or after? More generally, if the truck can travel r mph through the desert, where r is a given positive speed, 0<r<50, find a formula involving r for the position at which the truck should leave the road. (Note that for r=0 or r=50, the solution is obvious). For which values of r, if any, should the truck stay on the road right up to point P? For which values of r, if any, should the truck go straight through the desert?

This problem also can be solved using Maple. Assume that the truck can travel r mph through the desert. As before, let x denote the number of miles traveled along the road after which the truck leaves the road. The function S(x) which gives the total travel time is then [Maple Math] . (We denote the function by S, rather than T, as we have already used T in this worksheet.) We want to find a formula, in terms of r, which gives the global minimum of S(x) in the interval [0,60]. We begin by defining S(x) .

> S:=x-> x/50+sqrt((60-x)^2+225)/r;

[Maple Math]

Let's find the derivative D(S) with respect to x.

> D(S);

[Maple Math]

Next, we find zeros of the derivative. They are possible candidates for the global minimum of S(x) in [0,60], that is, possible candidates for the optimal, the best, x corresponding to a given speed r.

> bestxforr:=solve(D(S)(x)=0,x);

[Maple Math]

>

We found a zero of the derivative D(S), but we don't know if it is a global minimum of the function S(x) in [0,60]. For all we know, it could be only a local minimum, or maximum, or neither. Since S(x) contains a parameter r, we cannot draw the graph of S(x) to determine its behavior in [0,60]. Let's calculate and simplify the second derivative D(D(S)).

> simplify(D(D(S))(x));

[Maple Math]

>

We see that the second derivative S''(x) is always positive. (It is easy to check that the quadratic function [Maple Math] is always positive.) That means that the derivative S'(x) is always increasing. Hence, bestxforr is the only zero of S'(x). Left of bestxforr, S'(x) is negative, to the right of bestxforr, S'(x) is positive. (Can you see why?) Therefore, S(x) is decreasing left of bestxforr, and increasing right of bestxforr. Does it mean that x = bestxforr is the solution to our optimization problem for any given r and represents the optimal distance after which the truck should turn into the desert? Yes, as long as x = bestxforr falls within the interval [0,60]. Otherwise, the global minimum over [0,60] is at x = 60 or at x=0. Let's plot values of bestxforr for speeds r between 0 and 50.

> plot(bestxforr,r=0..50,labels=["r-speed through desert","bestxforr"]);

[Maple Plot]

>

We see that bestxforr falls in the interval [0,60] for all values of r between 0 and somewhere shortly before 50. For those values of r, bestxforr is, indeed, our optimal solution. Hence, as evident from the graph, for speed through the desert r close to zero, the optimal x is near 60; that is, the truck should go almost to the point P before turning to the desert. With increasing values of r, the truck should turn to the desert sooner. Observe that bestxforr is always strictly smaller that 60, except for r=0, which is not under consideration. Hence, surprisingly, the truck should never travel right up to the point P. We see that for values of r near 50 mph the critical point bestxforr is outside the interval [0,60]. More precisely, bestxforr is negative, hence, it is to the left of the interval [0,60]. In that case, bestxforr does not represent the optimal solution. Since S'(x) is positive to the right of the critical point bestxforr, the function S(x) is increasing throughout [0,60]. Thus, the global minimum of S(x) in [0,60] is at x =0, which means that the truck should leave the road immiediately and travel entirely through the desert. Let's find the values of r for which that happens.

> solve(bestxforr=0,r); evalf(%);

[Maple Math]

[Maple Math]

>

What is our conclusion then? For all speeds r between about 48.51 and 50, bestxforr is negative and x=0 is the global minimum of S(x) in the interval [0,60]. In that case, the truck should leave the road immediately and travel entirely through the desert.

Homework Problems

Problem 1. A man in a rowboat finds himself at a point P which is 1 mile from the nearest point A on a straight shoreline. His goal is to reach a point Q which is 1 mile directly inland from a point B on the shore 2 miles from A. He decides to row directly to a point on the shore between A and B, x miles from A, and then walk directly to Q. His rowing speed is 2 mph. His walking speed is 5 mph. Using similar methods as in Example 1, find the value of x which results in the shortest travel time from P to Q.

Problem 2. At noon ship A was 100 miles due east of ship B. Ship A is sailing west at 11 mph and ship B is sailing south at r mph.

(a) Assume that r = 9.5 mph. At what time will the ships be nearest to one another and what will this distance be?

(b) This time you know only that r is a given positive speed. Let t =besttforr be the time, in hours after noon, at which the ships are nearest to one another for a given speed r. Find the formula for besttforr in terms of r. Plot besttforr as a function of r, for r, say, between 0 and 100 mph. Comment on the behavior of the function as r gets close to 0, and as r gets larger and larger. Explain, in practical terms, what you see. Find a formula for the minimal distance between the ships as a function of r. Plot the function and interpret its behavior in practical terms.

MTH 141 Maple Worksheets written by B. Kaskosz and L. Pakula, Copyright 1998.

Last modified August 1999.

>