COMPUTER PROBLEMS 13.1

\(\def\ds{\displaystyle} \def\l{\lambda} \) 1 (a) The plot shows that the interval \([0,1]\) contains a relative minimum. According to Theorem 13.2, the number \(k\) of Golden Section Search steps needed satisfies \[\frac{g^k(1-0)}{2}< 0.5\times 10^{-5},\] where \(g=(\sqrt{5}-1)/2\). The inequality holds for \(k\geq 24\). Program 13.1 is an implementation of Golden Section Search that can be used to find the minimum. The commands
def f(x): return  2*x**4+3*x**2-4*x+5   
x = gss(f, 0, 1, 24)
results in convergence to the minimum \(x=1/2\).


1 (b) From the plot below, there are two relative minima. The intervals \([-2.5, -1.5]\) and \([0.5,1.5]\) each contain a minimum. The number of steps needed for each interval is 24, as in (a). The minima \(x=-2\) and \(x=1\) are found by gss.


1 (c) Similar to (a). The interval \([0,1]\) contains a relative minimum. Applying 24 steps of gss gives the approximation \(x=0.47033\).


1 (d) Similar to (a). The interval \([1,2]\) contains a relative minimum. Applying 24 steps of gss provides the approximation \(x=1.43791\).



3 (a) The squared distance from the point \((x,1/x)\) to \((2,3)\) is \(D(x)=(x-2)^2+(1/x-3)^2\). The derivative is \[D'(x)=2x-4-\frac{2}{x^3}+\frac{6}{x^2}.\] Newton's Method applied to find a root of \(D'(x)\) converges to \(r=0.358555\), corresponding to a squared distance of \(2.738874\).

3 (b) Applying Golden Section Search on the interval \([0,1]\)

def f(x): return (x-2)**2+(1/x-3)**2
x=gss(f, 0, 1, 30)
produces \(x=0.358555\) as in part (a). The nearest point is therefore \((0.358555, 2.788972).\)
5 Program 13.3 can be applied as
def f(x): return np.exp(-x[0]**2*x[1]**2)+(x[0]-1)**2+(x[1]-1)**2
x = neldermead(f, [1,1], 1, 60)
to converge to \((1.20881759,1.20881759)\) within \(8\) decimal places.
7 Program 13.3 can be applied as
def f(x): return 100*(x[1]-x[0]**2)**2+(x[0]-1)**2
x = neldermead(f, [0,0], 1, 100)
to converge to \((1,1)\).