MATH 209, Lab 5 Richard M. Slevinsky Problems 1. Say the temperature T at any point (x, y, z) in space is given by T = 4 x y z 2. Find the hottest point on the sphere F = x 2 + y 2 + z 2 100 = 0; We equate gradients: T = λ F, 4 y z 2, x z 2, 2 x y z = λ 2 x, 2 y, 2 z, giving us three equations for four unknowns. Adding the constraint F = 0, we have four equations for four unknowns: 4 y z 2 = 2 λ x, 4 x z 2 = 2 λ y, 8 x y z = 2 λ z, x 2 + y 2 + z 2 = 100. Simplifying by substituting the constraint equation, we find: Again for λ: And: Or: Contact: rms8@ualberta.ca 4 y(100 x 2 y 2 ) = 2 λ x, 4 x(100 x 2 y 2 ) = 2 λ y, 8 x y = 2 λ. 4 y(100 x 2 y 2 ) = 8 x 2 y, 4 x(100 x 2 y 2 ) = 8 x y 2. 100 x 2 y 2 = 2 x 2, 100 x 2 y 2 = 2 y 2. 100 3 x 2 y 2 = 0, 100 x 2 3 y 2 = 0. 1
Therefore, the values of x and y must solve the above system. By subtraction, we find x = ±5 and y = ±5. At these values, 25 + 25 + z 2 = 100, or z 2 = 50, and z = ±5 2. The hottest point occurs when T at the highest value of T (±5, ±5, ±5 2). This occurs when the signs of the x and y values are the same. Therefore, the hottest points are located at (x, y, z) = (5, 5, ±5 2) and ( 5, 5, ±5 2). 2. Show that the product of the angles of a triangle is largest when the triangle is equilateral; We seek to: Equating gradients, we find: The four equations we have are: maximize P = θ 1 θ 2 θ 3 subject to S = θ 1 + θ 2 + θ 3 180 = 0, The top three equations can be rearranged as: P = λ S, θ 2 θ 3, θ 1 θ 3, θ 1 θ 2 = λ 1, 1, 1. θ 2 θ 3 = λ, θ 1 θ 3 = λ, θ 1 θ 2 = λ, θ 1 + θ 2 + θ 3 = 180. θ 3 (θ 2 θ 1 ) = 0, θ 1 (θ 3 θ 2 ) = 0, θ 2 (θ 3 θ 1 ) = 0, θ i > 0, i = 1, 2, 3. implying θ 1 = θ 2 = θ 3 = 60 from the angular constraint. This is the equilateral triangle. 3. Let C denote the line of intersection of the planes 3 x + 2 y + z = 6 and x 4 y + 2 z = 8. Find the point on C that is closest to the origin; The point that is closest to the origin minimizes the distance, and also the distance squared, which is simpler to work with. Equating gradients: d 2 (x, y, z) = λp 1 + µp 2, 2 x, y, z = λ 3, 2, 1 + µ 1, 4, 2, These three equations with the two planes give: 2 x 3λ µ = 0, 2 y 2λ + 4µ = 0, 2 z λ 2µ = 0, 3 x + 2 y + z = 6, x 4 y + 2 z = 8. This system of five equations and five unknowns has the solution (check) x = 116 57, y = 44 57, z = 82 λ = 20 19, µ = 52 1 57. The closest point is therefore: (x, y, z) = 57 (116, 44, 82). 57, 2
4. A container is constructed in the shape of a cylinder with a top and a bottom (e.g. a beer can). If the surface area of the container has a fixed value S, find the radius and height of the container that will maximize the enclosed volume. The volume of a cylinder is V = πr 2 h, while the surface area is S = 2πrh + 2πr 2. Therefore, we wish to: maximize V = πr 2 h subject to S = 2πrh + 2πr 2. Exercises Equating gradients, we find: These two equations are: V = λ S, π 2 r h, r 2 = 2πλ h + 2 r, r. 2π r h = 2πλ(h + 2 r), π r 2 = 2πλ r. The second equation gives r = 0 or λ = r 2. Since r = 0 won t maximize anything, inserting the second possibility into the first equation above: 2π r h = 2π r (h + 2 r), 2 2 h = h + 2 r, h = 2 r. Therefore, the height is twice the size of the radius. 1. Find the maximum value of f(x, y, z) = x + y + z on the sphere x 2 + y 2 + z 2 = 25; Equating gradients: f = λ F, 1, 1, 1 = λ 2 x, 2 y, 2 z, giving us three equations for four unknowns. Adding the constraint F = 0, we have four equations for four unknowns: 1 = 2 λ x, 1 = 2 λ y, 1 = 2 λ z, x 2 + y 2 + z 2 = 25. Simplifying by substituting into the constraint equation, we find: ( ) 1 2 ( ) 1 2 ( ) 1 2 + + = 25, 2 λ 2 λ 2 λ 3 4 = 25λ2, 3
or λ = ± 3/10. Choosing only the positive branch for the position (otherwise we actually find the minimum value of f), we find x = y = z = 5/ 3. Therefore, the maximum value of f on the sphere is f(5/ 3, 5/ 3, 5/ 3) = 5 3. 2. Let C be the curve of intersection of the surface y 2 z 2 = 1 and the plane x y = 1. Find the minimum value of f(x, y, z) = x 2 + y 2 + z 2 on C; Letting g 1 (x, y, z) = y 2 z 2 1 = 0 and g 2 (x, y, z) = x y 1 = 0, we equate gradients: f = λ g 1 + µ g 2, 2 x, 2 y, 2 z = λ 0, 2 y, 2 z + µ 1, 1, 0. These three equations with the two surfaces gives five equations for five unknowns: 2 x µ = 0, 2 y λ2 y + µ = 0, 2 z + λ2 z = 0, y 2 z 2 = 1, x y = 1. From the last and first equations x = 1 + y and therefore µ = 2(1 + y). Inserting this into the second equation and simplifying: 4 y λ2 y = 2, z + λz = 0, y 2 z 2 = 1. Therefore, from this middle equation, either z = 0 or λ = 1. If z = 0, then y = ±1 from the bottom equation and x = 1 ± 1 = 2, 0 from above. Therefore, f(x, y, z) = 0 2 + (±1) 2 + (1 ± 1) 2 = 3 ± 2. If λ = 1, then y = 1/3. However, if 1 < y < 1, then from the bottom equation z C and therefore the point is not on both curves. The minimum value is f(0, 1, 0) = 1. 3. What is the volume of the largest rectangular box (with edges parallel to the axes) which can be inscribed in the ellipsoid x2 36 + y2 9 + z2 16 = 1? Since x, y, and z are the coordinate lengths, the volumes of the rectangular boxes with edges parallel to the axes is V = 2 x2 y2 z = 8 x y z. Therefore, equating gradients: With the ellipsoidal constraint: V = λ E, x 8 y z, x z, x y = λ 18, 2 y 9, z. 8 8 y z λx 18 = 0, 8 x z 2λy 9 = 0, 8 x y λz 8 = 0, x 2 36 + y2 9 + z2 16 = 1. 4
From the first equation λ = 144 y z x. Therefore: Simplifying the top two equations: 8 x z 288 y2 z = 0, 9 x 144 y z2 8 x y = 0, 8 x x 2 36 + y2 9 + z2 16 = 1. x 2 4 y 2 = 0, 4 x 2 9 z 2 = 0, x 2 36 + y2 9 + z2 16 = 1. Solving the top two equations for y 2 and z 2 and inserting in the ellipsoidal equation, we have: y 2 = x2 4, z 2 = 4 x2 9, x 2 36 + x2 36 + x2 36 = 1. Therefore, x 2 = 12, or x = ±2 3, y = ± 3, and z = ±4/ 3. Taking only the positive points, the largest box has the volume V (2 3, 3, 4/ 3) = 64 3. 4. Find the point on the plane z = 4 x + 9 y which is closest to the point (1, 1, 2). We seek to minimize the distance (squared) from the point to the plane: minimize d 2 P = (x 1) 2 + (y 1) 2 + (z 2) 2 subject to S = 4 x + 9 y z = 0. Equating gradients, we find: With the planar constraint: d 2 P = λ S, 2 x 1, y 1, z 2 = λ 4, 9, 1. 2(x 1) 4λ = 0, 2(y 1) 9λ = 0, 2(z 1) + λ = 0, 4 x + 9 y z = 0. This system of four equations and four unknowns has the solution (check) x = 50 49, y = 5 49, z = 55 and λ = 12 49. 49, 5
This week, we will find the global minimum of the function: f (x, y) = esin(50 x) + sin(60 ey ) + sin(70 sin(x)) + sin(sin(80 y)) sin(10(x + y)) + x2 + y 2. 4 This is problem 4 in The SIAM 100-Digit Challenge [1]. For x and y large, f (x, y) is dominated by the 2 2 paraboloid x +y 4, since the values of the other terms lie in the intervals [1/e, e], [ 1, 1], [ 1, 1], [ sin 1, sin 1], and [ 1, 1], respectively. Therefore, we know the minimum will be reasonably near the origin. However, what is reasonable? We can break the problem down into three steps: 1. Find a bounded region that contains the minimum; 2. Identify the rough location of the lowest point in that region; 3. Zoom in closer to pinpoint the minimum to high precision. Part I We evaluate the function on the 2601 values of x and y from 0.25 to 0.25 in steps of 0.01. The function can be as small as 3.24. Outside the circle of radius 1, the function is at least e 1 1 1 sin 1 1 + 14 > 3.23. Therefore, the minimum must be inside the circle of radius 1. Part II Many animals and insects interact with eachother, whether this may be for the purposes of protection from predators, or for cooperation in hunting, finding shelter, or otherwise [2]. Bees, ants, birds, and fish have been studied in particular because they are all relatively easy to study. For example, bee hives host around 5,000-10,000 bees, which is few enough to be individually counted and monitored. Insects can communicate with one another by releasing pheromones into the environment. These pheromones can indicate the source and quality of food, or a threat. PSO seeks to use simple algorithmic rules from the insect interactions, apply them to agents with random motion, and hope to derive meaningful global information of the problem the agents are trying to solve. For bees and ants that are harvesting food, they may look like [2]: 1. Wander to find food; 6
2. When I find food, harvest it and lay a trail of pheromones back to hive/hill; 3. If I find a trail, follow it, harvest food, and reinforce the shortest trail with pheromones to hive/hill. Bees and ants have become the prototype species for PSO and Ant-Colony Optimization (ACO). While they are similar, the ACO is very similar to the simple rules above, while the PSO takes advantage of the ability of bees to fly. This results in the Particle Swarm Optimization algorithm [3]: 1. Initialization of agents i = 1,..., N, with random positions x i and speeds v i ; Loop over all agents 2. Evaluate the function f( x i ); 3. Compare the value of the function f( x i ) with the best value of the agent. Let this be the vector p. If the current value is the best, replace it; 4. Identify the agent with the best value p. Let this be the vector g representing the entire swarm s best value; 5. Update the agents positions and velocities as: v i ω v i + φ p U(0, 1) ( p i x i ) + φ g U(0, 1) ( p g x i ), x i x i + v i. (1) 6. Terminate when the optimal value (to an error tolerance) is obtained. End loop In (1), 0 < ω < 1 is an inertial term, 2 < φ p < 2, 2 < φ g < 2, denotes component-wise multiplication, and U(0, 1) denotes a uniformly distributed random variable on the interval [0, 1]. Part III To get really high precision result, we need something that converges very quickly. Remember the Newton- Raphson method? Suppose we want to find the solution to: Using the linear approximation to f (x i ), we have: Setting the linear approximation to 0, we solve: min f(x) = f (x) = 0. (2) L(x) = f (x i ) + (x x i )f (x i ). (3) 0 = f (x i ) + (x i+1 x i )f (x i ), (4) for x i+1 as: Suppose, now we have two variables: x i+1 = x i f (x i ) f (x i ). (5) min f(x, y) = f(x, y) = 0. (6) 7
But setting the gradient to 0 is actually a system of two equations: f x (x, y) = 0, (7) f y (x, y) = 0, (8) with two unknowns x and y. Fortunately, we can form the tangent plane approximation (the generalization of the linear approximation) to both equations: T fx (x, y) = f x (x i, y i ) + (x x i )f xx (x i, y i ) + (y y i )f xy (x i, y i ), (9) T fy (x, y) = f y (x i, y i ) + (x x i )f xy (x i, y i ) + (y y i )f yy (x i, y i ), (10) Setting both equations simultaneously to 0 at the new iterate (x i+1, y i+1 ), we have: [ ] [ ] [ ] f xx (x i, y i ) f xy (x i, y i ) x i+1 x i f x (x i, y i ) =. (11) f xy (x i, y i ) f yy (x i, y i ) y i+1 y i f y (x i, y i ) This is a familiar system of two equations for two unknowns. We can solve this! [ x i+1 y i+1 ] = [ x i y i ] [ f xx (x i, y i ) f xy (x i, y i ) f xy (x i, y i ) f yy (x i, y i ) ] 1 [ f x (x i, y i ) f y (x i, y i ) ]. (12) References [1] F. Bornemann et al. Think Globally, Act Locally in The SIAM 100-Digit Challenge, SIAM, 4:77 100, 2004. [2] M. Beekman et al. Biological Foundations of Swarm Intelligence in Swarm Intelligence, Springer-Verlag, 1:3 41, 2008. [3] J. Kennedy and R.C. Eberhart Particle swarm optimization, Proceedings of the IEEE international conference on neural networks IV, 1942 1948, 1995. 8