hw1: done up to 3.2
This commit is contained in:
parent
98b7349508
commit
85bb62cced
4 changed files with 14206 additions and 3 deletions
|
@ -1,9 +1,12 @@
|
||||||
|
% Sources:
|
||||||
|
% https://www.youtube.com/watch?v=91RZYO1cv_o
|
||||||
|
|
||||||
%% Exercise 3.1
|
%% Exercise 3.1
|
||||||
|
|
||||||
% f(x1, x2) = x1^2 + u * x2^2;
|
% f(x1, x2) = x1^2 + u * x2^2;
|
||||||
|
|
||||||
% [x1 x2] [1 0] [x1] + [0][x1]
|
% 1/2 * [x1 x2] [2 0] [x1] + [0][x1]
|
||||||
% [0 u] [x2] + [0][x2]
|
% [0 2u] [x2] + [0][x2]
|
||||||
|
|
||||||
% A = [1 0; 0 u]; b = [0; 0]
|
% A = [1 0; 0 u]; b = [0; 0]
|
||||||
|
|
||||||
|
@ -40,4 +43,6 @@ for u = 1:10
|
||||||
subplot(4, 5, con);
|
subplot(4, 5, con);
|
||||||
contour(xs, ys, Z, 20);
|
contour(xs, ys, Z, 20);
|
||||||
title(sprintf("Contour for u=%d", u));
|
title(sprintf("Contour for u=%d", u));
|
||||||
|
|
||||||
end
|
end
|
||||||
|
matlab2tikz('showInfo', false, './ex32.tex')
|
||||||
|
|
14172
hw1/ex32.tex
Normal file
14172
hw1/ex32.tex
Normal file
File diff suppressed because one or more lines are too long
BIN
hw1/main.pdf
BIN
hw1/main.pdf
Binary file not shown.
26
hw1/main.tex
26
hw1/main.tex
|
@ -1,6 +1,11 @@
|
||||||
\documentclass{scrartcl}
|
\documentclass{scrartcl}
|
||||||
\usepackage[utf8]{inputenc}
|
\usepackage[utf8]{inputenc}
|
||||||
\usepackage{amsmath}
|
\usepackage{amsmath}
|
||||||
|
\usepackage{pgfplots}
|
||||||
|
\pgfplotsset{compat=1.17}
|
||||||
|
\usepackage{mathrsfs}
|
||||||
|
\usepackage{hyperref}
|
||||||
|
\usetikzlibrary{arrows}
|
||||||
|
|
||||||
\setlength{\parindent}{0cm}
|
\setlength{\parindent}{0cm}
|
||||||
\setlength{\parskip}{0.5\baselineskip}
|
\setlength{\parskip}{0.5\baselineskip}
|
||||||
|
@ -67,4 +72,25 @@ Not in general. If for example we consider A and b to be only zeros, then $J(x)
|
||||||
|
|
||||||
However, for if $A$ would be guaranteed to have full rank, the minimizer would be unique because the first order necessary condition would hold only for one value $x^*$. This is because the linear system $Ax^* = b$ would have one and only one solution (due to $A$ being full rank).
|
However, for if $A$ would be guaranteed to have full rank, the minimizer would be unique because the first order necessary condition would hold only for one value $x^*$. This is because the linear system $Ax^* = b$ would have one and only one solution (due to $A$ being full rank).
|
||||||
|
|
||||||
|
\section{Exercise 3}
|
||||||
|
|
||||||
|
\subsection{Quadratic form}
|
||||||
|
|
||||||
|
$f(x,y)$ can be written in quadratic form in the following way:
|
||||||
|
|
||||||
|
\[f(v) = \frac12 \langle\begin{bmatrix}2 & 0\\0 & 2\mu\end{bmatrix}v, v\rangle + \langle\begin{bmatrix}0\\0\end{bmatrix}, x\rangle\]
|
||||||
|
|
||||||
|
where:
|
||||||
|
|
||||||
|
\[v = \begin{bmatrix}x\\y\end{bmatrix}\]
|
||||||
|
|
||||||
|
\subsection{Matlab implementation with \texttt{surf} and \texttt{contour}}
|
||||||
|
|
||||||
|
The graphs generated by MATLAB are shown below:
|
||||||
|
|
||||||
|
\resizebox{\textwidth}{!}{\input{ex32.tex}}
|
||||||
|
|
||||||
|
Isolines get stretched along the y axis as $\mu$ increases. For a large $\mu$, points well far away from the axes could be a
|
||||||
|
problem since picking search directions and steps using a naive gradient based method iterations will zig-zag to the minimizer reaching it slowly.
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|
Reference in a new issue