find maximum value with steepest ascent method
of
f(x,y)=5+2xy+2y-x^2-2y^2 by:
a)program code(any but matlab is preferred)
b)without program code
Do 3times of iteration with initial guess is (x,y)=(0.25,0.25)
Hi,
Here is the required code:-
% function definition
func=@(x,y) 5+2.*x.*y +2.*y -x.^2 -2.*y.^2;
% Initial guess of x0 and y0
x0=0.25;
y0=0.25;
dx=0.001;
dy=0.001;
% initial alpha
alpha = 0.5;
%tolerance
tol =1e-6;
g = [inf;inf];
while norm(g) > tol
% compute gradient
f1=func(x0-dx/2,y0);
f2=func(x0+dx/2,y0);
gx=(f2-f1)/dx;
f1=func(x0,y0-dy/2);
f2=func(x0,y0+dy/2);
gy=(f2-f1)/dy;
g=[gx;gy];
% updating the x0 and y0 values with alpha
x0=x0+alpha*gx;
y0=y0+alpha*gy;
end
% displaying the value
[x0,y0]
output:-
b) Theoritical calculation:-
find maximum value with steepest ascent method of f(x,y)=5+2xy+2y-x^2-2y^2 by: a)program code(any but matlab is preferred)...
To translate the steepest ascent into matlab code: f(x,y)=-8*x + 12*y + x^2 - 2*x^4 - 2*x*y + 4*y^2 dx=-8+2x-8x^3-2y dy=12-2x+8y subs in x0=0, y0=0 into dx and dy dx=-8 dy=12 subs dx and dy into x1=x0 + dx*0.001 and y1=y0 + dy*0.001 then subs x1 and y1 back to x0 and x0; repeat the step until the answer has reach optimisation.
6. Find the absolute maximum and minimum values of fon D, where f(x,y)=x² – 2xy +2y and D={(x,y)|0SX 33,05ys2.
6. Find the absolute maximum and minimum values of fon D, where f(x,y)=x² – 2xy +2y and D={(x,y)|0SX 33,0 sys2).
Please use matlab for the following problem I. For the function. /(x) -X-4X+2XY+2Y+2Y+14 a. Plot the surface function for X over [5 6]. and Y over [-4, -2]. ecolour plot for X over [O 101 and Yover [43] and values for the contours of V [1 1.25 1.5 22.5 3] c. Write an m-file to find the minimum of the function using the gradient descent method Use a starting value of [4, -4]. I. For the function. /(x) -X-4X+2XY+2Y+2Y+14 a....
2. Steepest descent for unconstrained quadratic function minimization The steepest descent method for minimize f(x) is the gradient descent method using exact line search, that is, the step size of the kth iteration is chosen as Ok = argmin f(x“ – av f(x)). a20 (a) (3 points) Consider the objective function f(x):= *xAx- Ax - c^x + d. where A e RrXnCER”, d E R are given. Assume that A is symmetric positive definite and, at xk, f(x) = 0....
2. Steepest descent for unconstrained quadratic function minimization The steepest descent method for minimize f(x) is the gradient descent method using exact line search, that is, the step size of the kth iteration is chosen as Ok = argmin f(x“ – av f(x)). a20 (a) (3 points) Consider the objective function f(x):= *xAx- Ax - c^x + d. where A e RrXnCER”, d E R are given. Assume that A is symmetric positive definite and, at xk, f(x) = 0....
2. Steepest descent for unconstrained quadratic function minimization The steepest descent method for minimize f(x) is the gradient descent method using exact line search, that is, the step size of the kth iteration is chosen as Ok = argmin f(x“ – av f(x)). a20 (a) (3 points) Consider the objective function f(x):= *xAx- Ax - c^x + d. where A e RrXnCER”, d E R are given. Assume that A is symmetric positive definite and, at xk, f(x) = 0....
1). For the function, f(x) X-4X+2XY+2Y2+2Y+14 a. Plot the surface function for X over [5 61, and Y over [-4,-2]," b. Draw the contour plot for X over [0 10], and Y over [-4,-2] and values for the contours 1.25 1.5 2 25 3 of V c. Write an m-file to find the minimum of the function using the gradient descent method. Use a starting value of [4,-4]. 1). For the function, f(x) X-4X+2XY+2Y2+2Y+14 a. Plot the surface function for...
5 Use the Divergence theorem to find the outward flux. a. F(a, y,z)-(6x2+ + 2xy, 2y + xz, 4x2y); G: The solid cut from the first octant by the cylinder x2+y - 4 and the plane 3. (In(x2+Уг),-2z arctan(y/x), z (x2 +y2); G:The solid between the b. F(r, y, z) Vx + y*); G: The solid between the cylinders x2 + y.2 1 and x2+ y2 2, -1szs4. c Fxy)-(2xy', 2x'y, -): G: The solid bounded by the cylinder x?1...
Use Matlab 2. Write a matlab code for fixed point iteration to find appr Use this method to solve ar323: Hint: f() (3023)l 2. Write a matlab code for fixed point iteration to find appr Use this method to solve ar323: Hint: f() (3023)l