Section 47-02.mws

Unit 9: Calculus of Variations

Chapter 47: Constrained Optimization

Section 47.2: Queen Dido's problem

Copyright

Copyright * 2001 by Addison Wesley Longman, Inc.

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America.

Initializations

> restart;

> libname:="C:/Program Files/Maple 6.01/Calcvar",libname:

> with(Calcvar):

> libname:="C:/Program Files/Maple 6.01/Partials",libname:

> with(Partials):

> with(student):
with(plots):

Warning, the name changecoords has been redefined

>

The Isoperimetric Problem

The problem of stationarizing the functional

J = Int(f(x,y,`y'`),x = a .. b)

subject to the condition that y(x) should satisfy

Int(sqrt(1+``(`y'`)^2),x = a .. b) = c

where c is a fixed constant, is called the isoperimetric problem because the constraint demands that y(x) have a fixed length. (The constraint integral is simply the arclength for y(x) .) The word isoperimetric is a derivation of the Greek words for same and perimeter .

A most amusing version of this problem is given in [1]. Supposedly, in 850 B.C., Queen Dido of Carthage, a refugee from Tyria, asked the North African chieftain named Jarbas for as much land as could encompassed with the hide of a cow. Queen Dido's solution was to cut the hide into strips, and to lay the strips out in a semicircle with the coast of North Africa as a diameter. By this account, the enclosed area was maximized, and the city-state of Carthage founded.

Queen Dido solved the isoperimetric problem with free endpoints by enclosing the maximum area with a semicircle. The isoperimetric problem with fixed endpoints, the version of the problem we solve first in this section, does not turn out to be a semicircle! However, we still refer to it as Queen Dido's problem with fixed endpoints.

>

Queen Dido's Problem with Fixed Endpoints

In the fixed-endpoint version of Queen Dido's problem, we are to find the curve y = y(x) which has a fixed and given perimeter c , and which, together with the interval [-a, a] on the x -axis, encloses a maximum area.

The functional to maximize is

J = Int(y(x),x = -a .. a)

and the constraint is

Int(sqrt(1+``(`y'`)^2),x = -a .. a) = c .

(Of course, there is no loss in generality by arranging the endpoints symmetrically with respect to the origin.)

To solve this problem with the formalism of the calculus of variations, write, according to Table 47.1 of Section 47.1,

F(x,y,`y'`) = f+lambda*g = y+lambda*sqrt(1+``(`y'`)^2)

as the integrand of the modified functional M . This integrand does not explicitly contain the independent variable x , so from Section 46.4 we immediately have the first integral

F-`y'`*F[`y'`] = k

that is,

(y*sqrt(1+``(`y'`)^2)+lambda)/sqrt(1+``(`y'`)^2) = ...

Separation of variables gives for the solution of the Euler-Lagrange equation

(x-d)^2+(y-k)^2 = lambda^2

the equation of a circle centered at ``(d,k) . This is an implicit form of the function y(x) we are trying to determine. It contains three parameters, lambda, d , and k . Two conditions we can impose are the endpoint conditions

y(-a) = y(a) = 0

resulting in

(d+a)^2+k^2 = lambda^2

and

(d-a)^2+k^2 = lambda^2

from which we get, by subtracting the second from the first, 4*d*a = 0 . This tells us that d = 0 because a <> 0 . Hence, the two endpoint equations both reduce to

a^2+k^2 = lambda^2

Setting this relationship aside for the moment, we turn our attention to the integral constraint. We must apply the constraint to the solution y(x) in order to obtain a second equation relating the parameters lambda and k . The constraint equation is an arc length integral, so we need to compute `y'` . Implicit differentiation then gives

`y'` = + x/sqrt(lambda^2-x^2)

and

sqrt(1+``(`y'`)^2) = lambda/sqrt(lambda^2-x^2)

The arc length constraint them becomes

2*lambda*arcsin(a/lambda) = c

Eliminating lambda from the arc length constraint and a^2+k^2 = lambda^2 leads to

a/sqrt(a^2+k^2) = sin(c/2/sqrt(a^2+k^2))

as an implicit definition of k .

Let us next implement these calculations in Maple. To use the formalism of the Calcvar package, establish the dependence of y on x via

> depends(y,x);

Warning, alias or macro ddy defined in terms of y

Warning, alias or macro dy defined in terms of y

Warning, alias or macro y'' defined in terms of y

Warning, alias or macro y' defined in terms of y

Point, `y''`, `y'`, y

>

and write

> F := y+m*sqrt(1+dy^2);

F := y+m*sqrt(1+`y'`^2)

>

where we have opted to use the single m rather than lambda which requires six characters to create in Maple. This is a case where the integrand is free of the independent variable x , so a first integral exists. Using Maple's Euler_Lagrange command, we obtain

> q :=Euler_Lagrange(F,x,y);

q := {1+m*`y'`^2*diff(y,`$`(x,2))/((1+`y'`^2)^(3/2)...

>

We have obtained both the first integral and the expanded form of the Euler-Lagrange equation. Extracting the first integral, and simplifying it somewhat, we have

> Q := normal(op(select(has,q,K[1])));

Q := (y*sqrt(1+`y'`^2)+m)/(sqrt(1+`y'`^2)) = K[1]

>

Let us also replace the cumbersome K[1] with the simpler k , obtaining

> Q1 := subs(K[1]=k,Q);

Q1 := (y*sqrt(1+`y'`^2)+m)/(sqrt(1+`y'`^2)) = k

>

This first integral can be integrated by separating variables, but we prefer to obtain the solution with Maple's dsolve command. We get

> q1 := dsolve(Q1,y);

q1 := y = k+sqrt(-x^2+2*x*_C1+m^2-_C1^2), y = k-sqr...

>

Selecting one branch, and replacing the cumbersome integration constant _C1 with the simpler d , we have

> q2 := subs(_C1=d,q1[1]);

q2 := y = k+sqrt(-x^2+2*x*d+m^2-d^2)

>

The remaining manipulations belong to the domain of algebra. The calculus of variations is behind us now, and it is wise to have access to an unaliased variable y . Hence,

> free(y,x);

Point

>

to remove the alias attached to y . However, at this point, Maple has recorded

> q2;

y(x) = k+sqrt(-x^2+2*x*d+m^2-d^2)

>

for the solution of the Euler-Lagrange equation. Hence, we must also replace y(x) with y via the substitution

> q4 := subs(y(x)=y,q2);

q4 := y = k+sqrt(-x^2+2*x*d+m^2-d^2)

>

It helps to remove the square root by squaring both sides. Beforehand, however, let's move the x to the other side of the equation so that the radical is isolated on the left. Subtracting k from both sides of the equation is the precise way to move it to the other side. Hence, we have

> q5 := q4 - (k = k);

q5 := y-k = sqrt(-x^2+2*x*d+m^2-d^2)

>

Now square both sides, obtaining

> q6 := map(x -> x^2, q5);

q6 := (y-k)^2 = -x^2+2*x*d+m^2-d^2

>

Complete the square on the left is as useful as it is aesthetic, and we find

> q7 := completesquare(q6,y);

q7 := (y-k)^2 = -x^2+2*x*d+m^2-d^2

>

If we bring the term in y to the right by subtracting it from both sides, we obtain

> q8 := q7 - ((y-k)^2=(y-k)^2);

q8 := 0 = -x^2+2*x*d+m^2-d^2-(y-k)^2

>

which is the equation of a circle. This is an implicit form of the function y(x) we are trying to determine. It contains three parameters, m , d , and k . Two conditions we can impose are the endpoint conditions y(-a) = y(a) = 0. This results in the two equations

> eq1 := subs(x=-a,y=0,q8);
eq2 := subs(x=a, y=0,q8);

eq1 := 0 = -a^2-2*a*d+m^2-d^2-k^2

eq2 := 0 = -a^2+2*a*d+m^2-d^2-k^2

>

from which we get, by subtracting the second from the first,

> q9 := simplify(eq1-eq2);

q9 := 0 = -4*a*d

>

This tells us that d = 0 because a <> 0 . Hence, the two endpoint equations both reduce to

> eq3 := subs(d=0,eq1);

eq3 := 0 = -a^2+m^2-k^2

>

Setting this relationship aside for the moment, we turn our attention to the integral constraint. We must apply the constraint to the solution y(x) in order to obtain a second equation relating the parameters m and k . The constraint equation is an arclength integral, so we need to compute `y'` . We opt for implicit differentiation implemented via Maple's implicitdiff command. Since the solution to which we will apply this command contains the parameter d , we take the trouble to set that parameter to zero upon differentiating.

Hence, `y'` is

> q10 := subs(d=0,implicitdiff(q8,y,x));

q10 := x/(-y+k)

>

But the expression for `y'` contains y(x) itself, so we need to solve for y explicitly. We get

> q11 := subs(d=0,[solve(q8,y)]);

q11 := [k+sqrt(-x^2+m^2), k-sqrt(-x^2+m^2)]

>

where we again made sure to set d to zero. Picking a branch, and replacing y with it in the expression for `y'` , we get

> q12 := subs(y=q11[2],q10);

q12 := x/(sqrt(-x^2+m^2))

>

The integrand of the constraint integral is sqrt(1+``(`y'`)^2) , which is then

> q13 := simplify(sqrt(1+q12^2),symbolic);

q13 := m/(sqrt(-x^2+m^2))

>

Integrating in Maple gives

> int(q13,x=-a..a);

2*m*arctan(a/(sqrt(-a^2+m^2)))

>

Again, Maple's propensity to choose the log form of the inverse trig functions is a disaster. Rather than grapple with this most inhospitable result, we simply consult an elementary calculus text and write the antiderivative of

m/sqrt(m^2-x^2)

as

> q14 := m*arcsin(x/m);

q14 := m*arcsin(x/m)

>

For sure, the derivative of this antiderivative is again m/sqrt(m^2-x^2) , as we verify by

> simplify(diff(q14,x),symbolic);

m/(sqrt(-x^2+m^2))

>

Evaluating this antiderivative at the endpoints, we get

> q15 := simplify(subs(x=a,q14) - subs(x=-a,q14)) = c;

q15 := 2*m*arcsin(a/m) = c

>

as the value of the constraint integral. To eliminate the parameter m , we solve the relationship

> eq3;

0 = -a^2+m^2-k^2

>

for m , and make the obvious substitution. However, there are two solutions for m , as we see by

> q16 := solve(eq3,m);

q16 := sqrt(a^2+k^2), -sqrt(a^2+k^2)

>

so we select the first, and with it, obtain the equation

> q17 := subs(m=q16[1],q15);

q17 := 2*sqrt(a^2+k^2)*arcsin(a/(sqrt(a^2+k^2))) = ...

>

Since a and c are given, this is a single equation in the single unknown k . It cannot be solved explicitly for k , but it can be slightly simplified if the arcsine function is isolated via

> q18 := q17/2/sqrt(a^2+k^2);

q18 := arcsin(a/(sqrt(a^2+k^2))) = 1/2*c/(sqrt(a^2+...

Computing the sine of each side then gives

> q19:=map(sin,q18);

q19 := a/(sqrt(a^2+k^2)) = sin(1/2*c/(sqrt(a^2+k^2)...

>

as an implicit definition of k .

>

Example 47.1

As a specific example of this version of Queen Dido's problem with fixed endpoints, take a = 1 and c = 2*Pi/3 . Then, the parameter k is determined by the equation

> q20 := subs(a=1,c=2*Pi/3,q19);

q20 := 1/(sqrt(1+k^2)) = sin(1/3*Pi/(sqrt(1+k^2)))

>

A numeric solution is

> fsolve(q20,k);
fsolve(q20,k,-2..0);

1.732050808

-1.732050808

>

which looks suspiciously like + sqrt(3) , a guess we confirm with

> sqrt(3.);

1.732050808

>

Surprisingly, Maple does not recognize that the equation is just 1/z = sin(Pi/3/z) and with z = sqrt(1+k^2) = 2, we are looking at sin(Pi/6) = 1/2 . Hence, k really is + sqrt(3) .

To graph y(x) , we need to compute m = + sqrt(a^2+k^2) = + sqrt(1+3) = + 2.

This gives y(x) implicitly as

> q21 := subs(m=2,d=0,k=-sqrt(3),q8);

q21 := 0 = -x^2+4-(y+sqrt(3))^2

>

where we have chosen k = -sqrt(3) so the circle has its center below the x -axis. That assures us the arc of the circle, namely, y(x) , graphed in Figure 47.1, lies above the x -axis.

> implicitplot(q21,x=-1..1,y=0..2,scaling=constrained, xtickmarks=3, ytickmarks=3, labels=[x,`y `], labelfont=[TIMES,ITALIC,12]);

[Maple Plot]

>

To find the area enclosed by this arc, we need to obtain y(x) explicitly. Hence, solve for y , obtaining the two branches

> q22 := solve(q21,y);

q22 := -sqrt(3)+sqrt(4-x^2), -sqrt(3)-sqrt(4-x^2)

>

The appropriate branch is the one with the plus sign in front of the radical. Hence,

> if has(q22[1],-sqrt(4-x^2)) then Y:=q22[2] else Y:=q22[1]; fi;

Y := -sqrt(3)+sqrt(4-x^2)

>

selects the appropriate branch, and

> q23 := int(Y,x=-1..1):
q23 = evalf(q23);

-sqrt(3)+2/3*Pi = .362344295

>

gives the area encompassed by y(x) and that portion of the x -axis in the interval [-1, 1] .

>

Queen Dido's Problem with Free Endpoint

With fixed arclength c , enclose the maximum area between the curve y(x) and the x -axis, if y(0) = 0 characterizes the fixed left endpoint, and y(b) = 0 characterizes the free right endpoint. The transversal is g(x) = 0 , and b must be determined by the transversality condition.

Thus, maximize the functional

J = Int(y(x),x = 0 .. beta)

subject to the arclength constraint

Int(sqrt(1+``(`y'`)^2),x = 0 .. beta) = c

The Euler-Lagrange operator is applied to the integrand

F = y(x)+lambda*sqrt(1+``(`y'`)^2)

for which the transversality condition

[F[`y'`]+F/(`g'`-`y'`)] ``[x = beta] = 0

becomes

[lambda*`y'`/sqrt(1+``(`y'`)^2)+(y+lambda*sqrt(1+``... ``[x = beta] = [-lambda/`y'`/sqrt(1+``(`y'`)^2)] ``[x = beta] = 0

because `g'` = 0 and y(beta) = 0 .

The extremal y(x) can be obtained from

(x-d)^2+(y-k)^2 = lambda^2

the general solution of the Euler-Lagrange equation solved in the case of fixed endpoints. However, the endpoint conditions are now

y(0)-y(b) = 0

where for convenience, we use b instead of beta . These conditions give the equations

d^2+k^2 = lambda^2

and

(d-b)^2+k^2 = lambda^2

Subtracting the second from the first, we find 2*d*b-b^2 = 0 , or b = 0, 2*d . Clearly, b = 0 cannot be a solution because that would make the initial and terminal points coincide. Hence, we have the relationship b = 2*d .

The transversality condition requires that 1/`y'`(b) = 0 . We interpret this to mean that y(x) has a vertical tangent at x = b . This can be implemented analytically by requiring dx/dy to vanish at x = b . Thus, by implicit differentiation, we ahve

dx/dy = (k-y)/(x-d) = 0

which, at the point ``(b,0) becomes

0 = k/(b-d) = k/d

because b = 2*d . Hence, k = 0 , and the extremal is given implicitly by

(x-b/2)^2+y^2 = b^2/4

As soon as the transversality condition determined the extremal had a vertical tangent at x = b , we knew it was a semicircle. This equation tells us the center for the circle is ``(b/2,0) and the radius is b/2 . We can find the value of b from the arc length condition since we know that c = Pi*r or c = Pi*b/2 . Hence, b = 2*c/Pi , and the extremal is

(x-c/Pi)^2+y^2 = (c/Pi)^2

Let us now implement these calculations in Maple. Thus, establish y = y(x) via

> depends(y,x);

Warning, alias or macro ddy defined in terms of y

Warning, alias or macro dy defined in terms of y

Warning, alias or macro y'' defined in terms of y

Warning, alias or macro y' defined in terms of y

Point, `y''`, `y'`, y

>

and recall that F is

> F;

y+m*sqrt(1+`y'`^2)

>

and the Euler-Lagrange equation, and its first integral, is

> q := Euler_Lagrange(F,x,y);

q := {y+m*sqrt(1+`y'`^2)-`y'`^2*m/(sqrt(1+`y'`^2)) ...

>

Therefore, the first integral can be put into the form

> Q1;

(y*sqrt(1+`y'`^2)+m)/(sqrt(1+`y'`^2)) = k

>

which is the same differential equation we had to solve in the previous example. Since we know the solution to that equation, we remove the aliases on y by

> free(y,x);

Point

>

and recall that the general solution of the Euler-Lagrange equation is

> q8;

0 = -x^2+2*x*d+m^2-d^2-(y-k)^2

>

However, the endpoint conditions are now y(0) = 0 and y(b) = 0 , where for convenience, we use b instead of beta . These conditions give the equations

> eq1 := subs(x=0,y=0,q8);
eq2 := subs(x=b,y=0,q8);

eq1 := 0 = m^2-d^2-k^2

eq2 := 0 = -b^2+2*b*d+m^2-d^2-k^2

>

Subtracting the second from the first, we find

> eq3 := simplify(eq1-eq2);

eq3 := 0 = b^2-2*b*d

>

whose solution is

> solve(eq3,b);

0, 2*d

>

Clearly, b = 0 cannot be a solution because that would make the initial and terminal points coincide. Hence, we have the relationship b = 2*d .

The transversality condition requires that 1/`y'`/``(b) = 0 . We interpret this to mean that y(x) has a vertical tangent at x = b . This can be implemented analytically by requiring dx/dy to vanish at x = b . Thus, by implicit differentiation, we have for dx/dy ,

> q24 := implicitdiff(q8,x,y);

q24 := -(y-k)/(x-d)

>

Evaluating the derivative at the point ``(b,0) , and setting it to zero, gives

> q25 := subs(x=b,y=0,q24)=0;

q25 := k/(b-d) = 0

>

Recalling that b = 2*d , we have

> q26 := subs(b=2*d,q25);

q26 := k/d = 0

>

so we conclude that k = 0 , and hence, that the extremal is

> subs(eq1,d=b/2,k=0,q8);

m^2-1/4*b^2 = -x^2+x*b+m^2-1/4*b^2-y^2

>

As soon as the transversality condition determined the extremal had a vertical tangent at x = b , we knew it was a semicircle. This equation tells us the center for the circle is ``(b/2,0) and the radius is b/2 . We can find the value of b from the arclength condition since we know that c = Pi*r or c = Pi*b/2 . Hence, b = 2*c/Pi .

To determine b analytically, just from the data of the problem, requires evaluating the arclength integral. Once again, we need to find `y'` by implicit differentiation, which we do via

> q27 := implicitdiff(q8,y,x);

q27 := (x-d)/(-y+k)

>

Then, y(x) must be explicitly obtained via

> q28 := solve(q8,y);

q28 := k+sqrt(-x^2+2*x*d+m^2-d^2), k-sqrt(-x^2+2*x*...

>

and sqrt(1+``(`y'`)^2) put into the form

> q29 := completesquare(simplify(sqrt(1+subs(y=q28[1],q27)^2),symbolic),x);

q29 := m/(sqrt(-(x-d)^2+m^2))

>

As before, Maple will evaluate

Int(m/sqrt(m^2-(x-d)^2),x)

in terms of logarithms. So, once again, we simply use results from elementary calculus, and write the antiderivative as

> q30 := m*arcsin((x-d)/m);

q30 := m*arcsin((x-d)/m)

>

Evaluating at the endpoints gives

> q32 := subs(x=b,q30)-subs(x=0,q30)=c;

q32 := m*arcsin((b-d)/m)-m*arcsin(-d/m) = c

>

and remembering that k = 0 , so m^2 = k^2+d^2 gives m = + d , and that d = b/2 , we have, upon choosing m = d ,

> q33 := eval(subs(m=d,d=b/2,q32));

q33 := 1/2*b*Pi = c

>

Solving for b gives

> isolate(q33,b);

b = 2*c/Pi

>

in agreement with our more geometric aproach.

>

References

[1] Hans Sagan, Boundary and Eigenvalue Problems in Mathematical Physics, John Wiley & Sons, Inc., 1961.

>