Use MATLAB to compute. Numerical optimization An important problem in numerical
ID: 3848718 • Letter: U
Question
Use MATLAB to compute.
Numerical optimization An important problem in numerical computing is finding the minimum z of a function f(z). This is very much related to the root-finding problem. Indeed, if f is differentiable, then a minimum z" of f(r) is a zero of the derivative f'(z) Unfortunately, an approach based on applying the bisection method to f'(z) may not work, since the derivative values may not be available in practice. Fortunately, there is an algorithm similar to the bisection method can be used to find the minimum z using values of f(z) only Recall that the bisection method produces pairs of numbers [an, bol. For finding minima, we will instead produce a sequence of triples lan, ton, cn] that have the following bracketing property f(an) f(ton) and f(bon) f(cn) (0.1) Hence minimum r. the algorithm proceeds in the following way: 1. Choose a new point r using the formula: bn +r(cn-bn) if (cn bn) (bn an) bn +r(an -bn) if (cn -bn) (bn an) 2. Update the triple using the formula: lan, z bn] if zExplanation / Answer
a0= [ -1] ; b0=[1/2]; c0=[1]; gamma= (3- sqrt(5)) /2
an = a0 ; bn =b0 ; cn = c0; N=1;
k=2;
while ( N <=100)
if (cn - bn)> (bn -an), x= gamma* (cn - bn)+ bn
elseif (cn - bn)<(bn -an), x= gamma* (an - bn) + (bn )
end;
fx = -cos(x^k) ; fbn = -cos(bn^k) ;
if ( x< bn) && (fx < fbn), cn= bn ; bn=x; an=an;
elseif ( x> bn) && (fx < fbn),an= bn; bn=x; cn=cn;
elseif ( x< bn) && (fx > fbn),an=x;
elseif ( x > bn) && (fx > fbn), cn=x;
end; N=N+1 ;
end;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.