Você está na página 1de 2

MATH 604 – Derivative free Optimization

Assignment 1 by Deepak Kumar

Q.1.6 ->

Matlab code:
% to compute the ny vec
function[ny] = nystrain(n0,lambda,beta,st)
bt = (beta-1)/2;
lt = (1+ (((lambda)^2)*(st.^2)));
ny = n0*(lt.^bt);
end

% to compute the value of g


function [g] = compute_g(ny,ni)
g = 0;
for i=1:length(ny)
g = g + abs(ny(i)-ni(i));
end
end

% to plot the difference


function [] = plot_diff(ny,ni)
diffvec = abs(ny-ni);
plot(diffvec)
end

ans a) g(5205.2,141.4,.3838) = 496.8742

ans b)
Q2.7 ->

Ans a) contour plot

x = -5:.001:5;
y = -5:.001:5;
[X,Y] = meshgrid(x,y);
f1 = X + (Y.^2);
f2 = (X.^2) + Y;
Z = max(f1,f2);
figure, contour(X,Y,Z)

Ans b) Since, descent direction is perpendicular to the contour lines and the contour line at (2,0) is
smooth, hence the descent direction at (2,0) should be perpendicular to the contour line containing
(2,0).

Ans c) Since, the point (1,1) is a corner point and is non smooth, hence, descent direction at (1,1) will be
a set of vectors.

Ans d)

Você também pode gostar