Optimization 
GoldenSection Search Method

Sri Harsha Garapati, Autar Kaw
University of South Florida
United States of America
kaw@eng.usf.edu

Introduction

This worksheet demonstrates the use of Mathematica to illustrate the Golden Section Search method of solving optimization problems.

Problem Statement

Mathematica worksheet to solve the the cross-sectional area of a gutter with equal base and edge length of 2 is given by, A=4*sin(theta)*(1+cos(theta)). Use an initial interval of (0,pi/2).Use an initial interval epsilon=0.2.

Input

The following are the inputs to this problem
      a) Function to9 be optimized, A
      b) lower limit of the range, a
      c) upper limit of the range, b
      d) Raqnge of the optimal value interval, epsilon

A[theta_,l_]=(6-2*l+l*Cos[theta])*l*Sin[theta]
initialL=3;
intialTheta=22/42.0;
epsilon=0.05;
Print["Length of the plate=",initialL];
Print["width of the plate=",intialTheta];
Print["Temperature on the left end of the plate=",epsilon];
B=A[theta,3]
R=B
R(Pi/2)

Golden-Section Method along length dimension

programming Gauss-Siedel method

xl-0;
xu=initialL;
iteration=0;
range=100*epsilon;
While[range>epsilon,
iteration=iteration+1;
d=(Sqrt[5]-1)/2*(xu-xl);
x1=xl+d;
x2=xu-d;
val1=A[x1];
val2=A[x2];
interval={{xl, xu}};
range=xu-xl;
optimizationpoint=(xu+xl)/2;
If[val1>val2,xl=x2;x2=x1;d=(Sqrt[5]-1)/2*(xu-xl);x1=xl+d];
If[val1<val2,xu=x1;x1=x2;d=(Sqrt[5]-1)/2*(xl-xu);x2=xu-d];

]
iteration
optimizationpoint