From: Bjørn Rustad Date: Sun, 2 Oct 2011 21:07:36 +0000 (+0200) Subject: Proving and stuffs X-Git-Url: http://git.rustad.me/?a=commitdiff_plain;h=dd05a8a9045bffc0ab93c40de344e6ac6e66662b;p=nummat1 Proving and stuffs --- diff --git a/Makefile b/Makefile index b2a7fb5..13d90dd 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ all: latex rapport.tex latex rapport.tex + dvips rapport.dvi + ps2pdf rapport.ps diff --git a/main.py b/main.py index 2477c2d..633d01f 100644 --- a/main.py +++ b/main.py @@ -44,60 +44,61 @@ def main(): f_newton = [] f_nwst = [] -# mlab.figure(figure="Surface", bgcolor=(1,1,1), fgcolor=(0,0,0)) -# -# plen = 15 -# for point in optimal_points[:plen]: -# z = function_g(point, H, b, c) -# f_optimal.append(z) -# p = mlab.points3d([point[0]], [point[1]], [z], scale_factor=0.03, color=(0.7,0.2,0.2)) -# -# for point in constant_points[:plen]: -# z = function_g(point, H, b, c) -# f_constant.append(z) -# p = mlab.points3d([point[0]], [point[1]], [z], scale_factor=0.02, color=(1,1,1)) -# -# for point in newton_points[:plen]: -# z = function_g(point, H, b, c) -# f_newton.append(z) -# -# for point in nwst_points[:plen]: -# z = function_g(point, H, b, c) -# f_nwst.append(z) -# -# last = optimal_points[len(optimal_points)-1] -# X, Y, Z = surf.surf(H, b, c, last[0]-1, last[0]+1, last[1]-1, last[1]+1, -10, 3) -# -# surface = mlab.mesh(X, Y, Z) -# axes = mlab.axes(color=(0,0,0)) -# mlab.outline() -# mlab.show() -# -# fig = plt.figure(1) -# plt.rc('mathtext', default='regular') -# fig.subplots_adjust(hspace=0.4) -# ax = plt.subplot(211) -# plt.title("Relative residual") -# plt.xlabel("Iteration") -# plt.ylabel("Relative residual") -# plt.plot(optimal_residuals[:plen]) -# plt.plot(constant_residuals[:plen]) -# plt.plot(newton_residuals[:plen]) -# plt.plot(nwst_residuals[:plen]) -# plt.legend([r'Optimal $\alpha$', r'$\alpha$ = %.2f' % alpha, r'Newtons method', r'Steepest first, then Newton']) -# ax.set_yscale('log') -# -# ax = plt.subplot(212) -# plt.title("Function value") -# plt.xlabel("Iteration") -# plt.ylabel("g(x)") -# plt.plot(f_optimal[:plen]) -# plt.plot(f_constant[:plen]) -# plt.plot(f_newton[:plen]) -# plt.plot(f_nwst[:plen]) -# -# plt.show() -# fig.savefig("steepest.eps", format="eps") + mlab.figure(figure="Surface", bgcolor=(1,1,1), fgcolor=(0,0,0)) + + plen = 15 + for point in optimal_points[:plen]: + z = function_g(point, H, b, c) + f_optimal.append(z) + p = mlab.points3d([point[0]], [point[1]], [z], scale_factor=0.03, color=(0.7,0.2,0.2)) + + for point in constant_points[:plen]: + z = function_g(point, H, b, c) + f_constant.append(z) + p = mlab.points3d([point[0]], [point[1]], [z], scale_factor=0.02, color=(1,1,1)) + + for point in newton_points[:plen]: + z = function_g(point, H, b, c) + f_newton.append(z) + + for point in nwst_points[:plen]: + z = function_g(point, H, b, c) + f_nwst.append(z) + + last = optimal_points[len(optimal_points)-1] + X, Y, Z = surf.surf(H, b, c, last[0]-1, last[0]+1, last[1]-1, last[1]+1, -10, 3) + + surface = mlab.mesh(X, Y, Z) + axes = mlab.axes(color=(0,0,0)) + mlab.outline() + mlab.show() + + fig = plt.figure(1) + plt.rc('mathtext', default='regular') + fig.subplots_adjust(hspace=0.4) + + ax = plt.subplot(211) + plt.title("Function value") + plt.xlabel("Iteration") + plt.ylabel("g(x)") + plt.plot(f_optimal[:plen]) + plt.plot(f_constant[:plen]) + plt.plot(f_newton[:plen]) + plt.plot(f_nwst[:plen]) + plt.legend([r'Optimal $\alpha$', r'$\alpha$ = %.2f' % alpha, r'Newtons method', r'Steepest first, then Newton']) + + ax = plt.subplot(212) + plt.title("Relative residual") + plt.xlabel("Iteration") + plt.ylabel("Relative residual") + plt.plot(optimal_residuals[:plen]) + plt.plot(constant_residuals[:plen]) + plt.plot(newton_residuals[:plen]) + plt.plot(nwst_residuals[:plen]) + ax.set_yscale('log') + + plt.show() + fig.savefig("steepest.eps", format="eps") if __name__ == "__main__": main() diff --git a/rapport.tex b/rapport.tex index 015b481..58a1bc2 100644 --- a/rapport.tex +++ b/rapport.tex @@ -93,14 +93,14 @@ The function analyzed in this project was \frac{1}{2}\mathbf{x}^{T}H\mathbf{x} + \frac{1}{12}\mathbf{x}^{T}C(\mathbf{x})\mathbf{x}. \end{equation} -From equation \ref{eq:func_g} we get +From equation \eqref{eq:func_g} we get \begin{eqnarray} \label{eq:grad_g} \nabla g(\mathbf{x}) &=& -\mathbf{b}+H\mathbf{x}+\frac{1}{3}C(\mathbf{x})\mathbf{x} \\ \label{eq:hess_g} \nabla^{2}g(\mathbf{x}) &=& H+C(\mathbf{x}). \end{eqnarray} -The three functions, \ref{eq:func_g}, \ref{eq:grad_g} and \ref{eq:hess_g}, are +The three functions, \eqref{eq:func_g}, \eqref{eq:grad_g} and \eqref{eq:hess_g}, are implemented in the Python code below. \lstinputlisting[language=Python]{bj_function.py} @@ -147,10 +147,12 @@ vector equation, we get the following iteration: \label{eq:forward_iter} \mathbf{r}^{(k+1)} = \mathbf{r}^{(k)} - \alpha \nabla g\left(\mathbf{r}^{(k)}\right) \end{equation} -where $t_{n+1} = t_n + \alpha$. Looking at this result, we see that it is equivalent to the steepest descent iteration with constant step size $\alpha$. +where $t_{n+1} = t_n + \alpha$. Looking at this result, we see that it is +equivalent to the steepest descent iteration with constant step size $\alpha$. To find the optimal step length, $\alpha^*$, we solve the equation \begin{eqnarray} + \label{eq:poly} \frac{\partial}{\partial \mathbf{\alpha}}g\left(\mathbf{x}+\alpha\mathbf{u}\right) &=& 0, \text{where } \mathbf{u} = -\nabla g(\mathbf{x} ) \nonumber \\ @@ -164,6 +166,20 @@ where $A$, $B$, C &=& \mathbf{u}^TH\mathbf{u}+\mathbf{u}^TC(\mathbf{x})\mathbf{u} \nonumber \\ D &=& \frac{1}{3}\mathbf{u}^TC(\mathbf{x})\mathbf{x}+\mathbf{u}^TH\mathbf{x}-\mathbf{b}^T\mathbf{u} \end{eqnarray} +Deriving the polynomial results in: +\begin{eqnarray} + \frac{\partial^2}{\partial \alpha^2}\left(g\left(\mathbf{x} + + \alpha\mathbf{u}\right)\right) &=& \mathbf{u}^T H \mathbf{u} + \mathbf{u}^T + \left[C\left(\alpha\mathbf{u}\right) + + C\left(\mathbf{x}\right)\right]\mathbf{u} + 2\mathbf{x}^T + C\left(\mathbf{u}\right) \mathbf{u}\alpha \nonumber \\ + &=& \mathbf{u}^T H \mathbf{u} + \mathbf{u}^T C\left(\mathbf{x} + + \alpha\mathbf{u}\right) \nonumber \\ + &=& \mathbf{u}^T\nabla^2 g\left(\mathbf{x} + \alpha\mathbf{u}\right)\mathbf{u}. +\end{eqnarray} +From this we see that the polynomial \eqref{eq:poly} is monotonically increasing +and therefore only has one real zero. This is the zero we want to use as our +optimal step length. \lstinputlisting[language=Python]{bj_optimal.py} diff --git a/steepest.eps b/steepest.eps index b441332..62abd42 100644 --- a/steepest.eps +++ b/steepest.eps @@ -1,9 +1,9 @@ %!PS-Adobe-3.0 EPSF-3.0 %%Title: steepest.eps %%Creator: matplotlib version 0.99.3, http://matplotlib.sourceforge.net/ -%%CreationDate: Fri Sep 30 16:50:42 2011 +%%CreationDate: Sun Oct 2 23:02:54 2011 %%Orientation: portrait -%%BoundingBox: 13 175 598 616 +%%BoundingBox: -74 103 686 688 %%EndComments %%BeginProlog /mpldict 8 dict def @@ -910,8 +910,8 @@ FontName currentdict end definefont pop end %%EndProlog mpldict begin -13.5 175.5 translate -585 441 0 0 clipbox +-74.25 103.95 translate +760.5 584.1 0 0 clipbox 1.000 setlinewidth 1 setlinejoin 2 setlinecap @@ -919,9 +919,9 @@ mpldict begin 1.000 setgray gsave 0 0 m -585 0 l -585 441 l -0 441 l +760.5 0 l +760.5 584.1 l +0 584.1 l 0 0 l gsave fill @@ -929,80 +929,80 @@ grestore stroke grestore gsave -73.125 249.9 m -526.5 249.9 l -526.5 396.9 l -73.125 396.9 l -73.125 249.9 l +95.0625 330.99 m +684.45 330.99 l +684.45 525.69 l +95.0625 525.69 l +95.0625 330.99 l fill grestore 0.000 0.000 1.000 setrgbcolor gsave -453.4 147 73.12 249.9 clipbox -73.125 396.9 m -105.509 359.277 l -137.893 352.765 l -170.277 346.914 l -202.661 342.517 l -235.045 339.975 l -267.429 336.152 l -299.812 335.025 l -332.196 331.456 l -364.58 331.085 l -396.964 327.655 l -429.348 327.74 l -461.732 324.394 l -494.116 324.773 l -526.5 321.484 l +589.4 194.7 95.06 331 clipbox +95.0625 517.035 m +137.162 359.459 l +179.261 358.965 l +221.36 358.845 l +263.459 358.806 l +305.558 358.788 l +347.657 358.779 l +389.756 358.774 l +431.855 358.771 l +473.954 358.769 l +516.054 358.767 l +558.153 358.766 l +600.252 358.766 l +642.351 358.765 l +684.45 358.765 l stroke grestore 0.000 0.500 0.000 setrgbcolor gsave -453.4 147 73.12 249.9 clipbox -73.125 396.9 m -105.509 373.953 l -137.893 371.882 l -170.277 370.06 l -202.661 368.401 l -235.045 366.856 l -267.429 365.392 l -299.812 363.988 l -332.196 362.628 l -364.58 361.304 l -396.964 360.005 l -429.348 358.728 l -461.732 357.466 l -494.116 356.219 l -526.5 354.982 l +589.4 194.7 95.06 331 clipbox +95.0625 517.035 m +137.162 366.325 l +179.261 363.992 l +221.36 362.491 l +263.459 361.476 l +305.558 360.766 l +347.657 360.258 l +389.756 359.889 l +431.855 359.617 l +473.954 359.414 l +516.054 359.262 l +558.153 359.148 l +600.252 359.062 l +642.351 358.996 l +684.45 358.946 l stroke grestore 1.000 0.000 0.000 setrgbcolor gsave -453.4 147 73.12 249.9 clipbox -73.125 396.9 m -105.509 385.62 l -137.893 373.761 l -170.277 362.731 l -202.661 351.898 l -235.045 341.522 l -267.429 332.187 l -299.812 324.037 l -332.196 316.36 l -364.58 296.503 l -396.964 258.899 l +589.4 194.7 95.06 331 clipbox +95.0625 517.035 m +137.162 386.584 l +179.261 363.764 l +221.36 359.817 l +263.459 359.007 l +305.558 358.83 l +347.657 358.785 l +389.756 358.768 l +431.855 358.764 l +473.954 358.764 l +516.054 358.764 l stroke grestore 0.000 0.750 0.750 setrgbcolor gsave -453.4 147 73.12 249.9 clipbox -73.125 396.9 m -105.509 359.277 l -137.893 352.765 l -170.277 340.712 l -202.661 328.85 l -235.045 314.75 l -267.429 293.014 l -299.812 252.018 l +589.4 194.7 95.06 331 clipbox +95.0625 517.035 m +137.162 359.459 l +179.261 358.965 l +221.36 358.8 l +263.459 358.769 l +305.558 358.764 l +347.657 358.764 l +389.756 358.764 l stroke grestore 0.500 setlinewidth @@ -1018,7 +1018,7 @@ translate stroke grestore } bind def -73.125 249.9 o +95.0625 330.99 o grestore gsave /o { @@ -1030,13 +1030,13 @@ translate stroke grestore } bind def -73.125 396.9 o +95.0625 525.69 o grestore /DejaVuSans findfont 12.000 scalefont setfont gsave -70.101562 236.821875 translate +92.039062 317.911875 translate 0.000000 rotate 0.000000 0.171875 m /zero glyphshow grestore @@ -1050,7 +1050,7 @@ translate stroke grestore } bind def -137.893 249.9 o +179.261 330.99 o grestore gsave /o { @@ -1062,10 +1062,10 @@ translate stroke grestore } bind def -137.893 396.9 o +179.261 525.69 o grestore gsave -135.111607 236.993750 translate +176.479464 318.083750 translate 0.000000 rotate 0.000000 0.000000 m /two glyphshow grestore @@ -1079,7 +1079,7 @@ translate stroke grestore } bind def -202.661 249.9 o +263.459 330.99 o grestore gsave /o { @@ -1091,10 +1091,10 @@ translate stroke grestore } bind def -202.661 396.9 o +263.459 525.69 o grestore gsave -199.473214 237.150000 translate +260.271429 318.240000 translate 0.000000 rotate 0.000000 0.000000 m /four glyphshow grestore @@ -1108,7 +1108,7 @@ translate stroke grestore } bind def -267.429 249.9 o +347.657 330.99 o grestore gsave /o { @@ -1120,10 +1120,10 @@ translate stroke grestore } bind def -267.429 396.9 o +347.657 525.69 o grestore gsave -264.412946 236.821875 translate +344.641518 317.911875 translate 0.000000 rotate 0.000000 0.171875 m /six glyphshow grestore @@ -1137,7 +1137,7 @@ translate stroke grestore } bind def -332.196 249.9 o +431.855 330.99 o grestore gsave /o { @@ -1149,10 +1149,10 @@ translate stroke grestore } bind def -332.196 396.9 o +431.855 525.69 o grestore gsave -329.196429 236.821875 translate +428.855357 317.911875 translate 0.000000 rotate 0.000000 0.171875 m /eight glyphshow grestore @@ -1166,7 +1166,7 @@ translate stroke grestore } bind def -396.964 249.9 o +516.054 330.99 o grestore gsave /o { @@ -1178,10 +1178,10 @@ translate stroke grestore } bind def -396.964 396.9 o +516.054 525.69 o grestore gsave -390.378348 236.821875 translate +509.467634 317.911875 translate 0.000000 rotate 0.000000 0.171875 m /one glyphshow 7.634766 0.171875 m /zero glyphshow @@ -1196,7 +1196,7 @@ translate stroke grestore } bind def -461.732 249.9 o +600.252 330.99 o grestore gsave /o { @@ -1208,10 +1208,10 @@ translate stroke grestore } bind def -461.732 396.9 o +600.252 525.69 o grestore gsave -455.349330 236.993750 translate +593.868973 318.083750 translate 0.000000 rotate 0.000000 0.000000 m /one glyphshow 7.634766 0.000000 m /two glyphshow @@ -1226,7 +1226,7 @@ translate stroke grestore } bind def -526.5 249.9 o +684.45 330.99 o grestore gsave /o { @@ -1238,15 +1238,15 @@ translate stroke grestore } bind def -526.5 396.9 o +684.45 525.69 o grestore gsave -519.851562 237.150000 translate +677.801563 318.240000 translate 0.000000 rotate 0.000000 0.000000 m /one glyphshow 7.634766 0.000000 m /four glyphshow grestore -275.445 222.525 m +365.389 303.615 m 0 0.172 rmoveto (Iteration) show gsave @@ -1259,7 +1259,7 @@ translate stroke grestore } bind def -73.125 249.9 o +95.0625 330.99 o grestore gsave /o { @@ -1271,30 +1271,14 @@ translate stroke grestore } bind def -526.5 249.9 o +684.45 330.99 o grestore gsave -44.125000 242.400000 translate +67.781250 326.450938 translate 0.000000 rotate -/DejaVuSans findfont -12.0 scalefont -setfont -0.000000 1.937500 moveto -/one glyphshow - -7.634766 1.937500 moveto -/zero glyphshow - -/DejaVuSans findfont -8.4 scalefont -setfont -15.269531 8.875000 moveto -/hyphen glyphshow - -18.300586 8.875000 moveto -/seven glyphshow - - +0.000000 0.171875 m /minus glyphshow +10.054688 0.171875 m /two glyphshow +17.689453 0.171875 m /zero glyphshow grestore gsave /o { @@ -1306,7 +1290,7 @@ translate stroke grestore } bind def -73.125 270.9 o +95.0625 358.804 o grestore gsave /o { @@ -1318,30 +1302,12 @@ translate stroke grestore } bind def -526.5 270.9 o +684.45 358.804 o grestore gsave -44.125000 263.400000 translate +85.015625 354.265223 translate 0.000000 rotate -/DejaVuSans findfont -12.0 scalefont -setfont -0.000000 1.828125 moveto -/one glyphshow - -7.634766 1.828125 moveto -/zero glyphshow - -/DejaVuSans findfont -8.4 scalefont -setfont -15.269531 8.765625 moveto -/hyphen glyphshow - -18.300586 8.765625 moveto -/six glyphshow - - +0.000000 0.171875 m /zero glyphshow grestore gsave /o { @@ -1353,7 +1319,7 @@ translate stroke grestore } bind def -73.125 291.9 o +95.0625 386.619 o grestore gsave /o { @@ -1365,30 +1331,13 @@ translate stroke grestore } bind def -526.5 291.9 o +684.45 386.619 o grestore gsave -44.125000 284.400000 translate +77.453125 382.079509 translate 0.000000 rotate -/DejaVuSans findfont -12.0 scalefont -setfont -0.000000 1.937500 moveto -/one glyphshow - -7.634766 1.937500 moveto -/zero glyphshow - -/DejaVuSans findfont -8.4 scalefont -setfont -15.269531 8.875000 moveto -/hyphen glyphshow - -18.300586 8.875000 moveto -/five glyphshow - - +0.000000 0.171875 m /two glyphshow +7.634766 0.171875 m /zero glyphshow grestore gsave /o { @@ -1400,7 +1349,7 @@ translate stroke grestore } bind def -73.125 312.9 o +95.0625 414.433 o grestore gsave /o { @@ -1412,30 +1361,13 @@ translate stroke grestore } bind def -526.5 312.9 o +684.45 414.433 o grestore gsave -44.125000 305.400000 translate +77.171875 409.893795 translate 0.000000 rotate -/DejaVuSans findfont -12.0 scalefont -setfont -0.000000 1.937500 moveto -/one glyphshow - -7.634766 1.937500 moveto -/zero glyphshow - -/DejaVuSans findfont -8.4 scalefont -setfont -15.269531 8.875000 moveto -/hyphen glyphshow - -18.300586 8.875000 moveto -/four glyphshow - - +0.000000 0.171875 m /four glyphshow +7.634766 0.171875 m /zero glyphshow grestore gsave /o { @@ -1447,7 +1379,7 @@ translate stroke grestore } bind def -73.125 333.9 o +95.0625 442.247 o grestore gsave /o { @@ -1459,30 +1391,13 @@ translate stroke grestore } bind def -526.5 333.9 o +684.45 442.247 o grestore gsave -44.125000 326.400000 translate +77.421875 437.708080 translate 0.000000 rotate -/DejaVuSans findfont -12.0 scalefont -setfont -0.000000 1.828125 moveto -/one glyphshow - -7.634766 1.828125 moveto -/zero glyphshow - -/DejaVuSans findfont -8.4 scalefont -setfont -15.269531 8.765625 moveto -/hyphen glyphshow - -18.300586 8.765625 moveto -/three glyphshow - - +0.000000 0.171875 m /six glyphshow +7.634766 0.171875 m /zero glyphshow grestore gsave /o { @@ -1494,7 +1409,7 @@ translate stroke grestore } bind def -73.125 354.9 o +95.0625 470.061 o grestore gsave /o { @@ -1506,30 +1421,13 @@ translate stroke grestore } bind def -526.5 354.9 o +684.45 470.061 o grestore gsave -44.125000 347.400000 translate +77.390625 465.522366 translate 0.000000 rotate -/DejaVuSans findfont -12.0 scalefont -setfont -0.000000 1.828125 moveto -/one glyphshow - -7.634766 1.828125 moveto -/zero glyphshow - -/DejaVuSans findfont -8.4 scalefont -setfont -15.269531 8.765625 moveto -/hyphen glyphshow - -18.300586 8.765625 moveto -/two glyphshow - - +0.000000 0.171875 m /eight glyphshow +7.634766 0.171875 m /zero glyphshow grestore gsave /o { @@ -1541,7 +1439,7 @@ translate stroke grestore } bind def -73.125 375.9 o +95.0625 497.876 o grestore gsave /o { @@ -1553,30 +1451,14 @@ translate stroke grestore } bind def -526.5 375.9 o +684.45 497.876 o grestore gsave -44.125000 368.400000 translate +70.250000 493.336652 translate 0.000000 rotate -/DejaVuSans findfont -12.0 scalefont -setfont -0.000000 1.937500 moveto -/one glyphshow - -7.634766 1.937500 moveto -/zero glyphshow - -/DejaVuSans findfont -8.4 scalefont -setfont -15.269531 8.875000 moveto -/hyphen glyphshow - -18.300586 8.875000 moveto -/one glyphshow - - +0.000000 0.171875 m /one glyphshow +7.634766 0.171875 m /zero glyphshow +15.269531 0.171875 m /zero glyphshow grestore gsave /o { @@ -1588,7 +1470,7 @@ translate stroke grestore } bind def -73.125 396.9 o +95.0625 525.69 o grestore gsave /o { @@ -1600,135 +1482,255 @@ translate stroke grestore } bind def -526.5 396.9 o +684.45 525.69 o grestore gsave -47.125000 389.400000 translate +70.250000 521.150938 translate 0.000000 rotate -/DejaVuSans findfont -12.0 scalefont -setfont -0.000000 1.828125 moveto -/one glyphshow - -7.634766 1.828125 moveto -/zero glyphshow - -/DejaVuSans findfont -8.4 scalefont -setfont -15.269531 8.765625 moveto -/zero glyphshow - - +0.000000 0.171875 m /one glyphshow +7.634766 0.171875 m /two glyphshow +15.269531 0.171875 m /zero glyphshow grestore +62.781 417.129 m gsave -/o { +90 rotate +0 2.5 rmoveto +(g\(x\)) show +grestore +1.000 setlinewidth +2 setlinecap gsave -newpath -translate -0 0 m -2 0 l +95.0625 525.69 m +684.45 525.69 l stroke grestore -} bind def -73.125 256.222 o +gsave +684.45 330.99 m +684.45 525.69 l +stroke grestore gsave -/o { +95.0625 330.99 m +684.45 330.99 l +stroke +grestore gsave -newpath -translate -0 0 m --2 0 l +95.0625 330.99 m +95.0625 525.69 l stroke grestore -} bind def -526.5 256.222 o +/DejaVuSans findfont +14.400 scalefont +setfont +337.616 530.69 m +0 0.203 rmoveto +(Function value) show +gsave +429.066 430.37 m +677.25 430.37 l +677.25 518.49 l +429.066 518.49 l +429.066 430.37 l +cl +gsave +1.000 setgray +fill grestore +stroke +grestore +0.000 0.000 1.000 setrgbcolor gsave -/o { +439.146 506.77 m +459.306 506.77 l +stroke +grestore +0.000 setgray +gsave +475.146250 498.730000 translate +0.000000 rotate +/DejaVuSans findfont +14.4 scalefont +setfont +0.000000 3.359375 moveto +/O glyphshow + +11.326996 3.359375 moveto +/p glyphshow + +20.461670 3.359375 moveto +/t glyphshow + +26.104080 3.359375 moveto +/i glyphshow + +30.102249 3.359375 moveto +/m glyphshow + +44.120453 3.359375 moveto +/a glyphshow + +52.938919 3.359375 moveto +/l glyphshow + +56.937088 3.359375 moveto +/space glyphshow + +61.511444 3.359375 moveto +/alpha glyphshow + + +grestore +0.000 0.500 0.000 setrgbcolor +gsave +439.146 485.57 m +459.306 485.57 l +stroke +grestore +0.000 setgray +gsave +475.146250 479.530000 translate +0.000000 rotate +/DejaVuSans findfont +14.4 scalefont +setfont +0.000000 1.609375 moveto +/alpha glyphshow + +9.486008 1.609375 moveto +/space glyphshow + +14.060364 1.609375 moveto +/equal glyphshow + +26.118134 1.609375 moveto +/space glyphshow + +30.692490 1.609375 moveto +/zero glyphshow + +39.848236 1.609375 moveto +/period glyphshow + +44.422592 1.609375 moveto +/zero glyphshow + +53.578339 1.609375 moveto +/five glyphshow + + +grestore +1.000 0.000 0.000 setrgbcolor gsave -newpath -translate -0 0 m -2 0 l +439.146 464.823 m +459.306 464.823 l stroke grestore -} bind def -73.125 262.543 o -grestore -gsave -/o { +0.000 setgray +475.146 459.58 m +0 0.203 rmoveto +(Newtons method) show +0.000 0.750 0.750 setrgbcolor gsave -newpath -translate -0 0 m --2 0 l +439.146 444.076 m +459.306 444.076 l stroke grestore -} bind def -526.5 262.543 o -grestore +0.000 setgray +475.146 436.13 m +0 2.906 rmoveto +(Steepest first, then Newton) show gsave -/o { +95.0625 58.41 m +684.45 58.41 l +684.45 253.11 l +95.0625 253.11 l +95.0625 58.41 l +1.000 setgray +fill +grestore +0.000 0.000 1.000 setrgbcolor gsave -newpath -translate -0 0 m -2 0 l +589.4 194.7 95.06 58.41 clipbox +95.0625 253.11 m +137.162 203.279 l +179.261 194.654 l +221.36 186.904 l +263.459 181.081 l +305.558 177.713 l +347.657 172.65 l +389.756 171.157 l +431.855 166.43 l +473.954 165.939 l +516.054 161.396 l +558.153 161.508 l +600.252 157.077 l +642.351 157.579 l +684.45 153.222 l stroke grestore -} bind def -73.125 266.241 o -grestore -gsave -/o { +0.000 0.500 0.000 setrgbcolor gsave -newpath -translate -0 0 m --2 0 l +589.4 194.7 95.06 58.41 clipbox +95.0625 253.11 m +137.162 222.717 l +179.261 219.974 l +221.36 217.561 l +263.459 215.364 l +305.558 213.317 l +347.657 211.377 l +389.756 209.518 l +431.855 207.718 l +473.954 205.963 l +516.054 204.243 l +558.153 202.551 l +600.252 200.881 l +642.351 199.228 l +684.45 197.59 l stroke grestore -} bind def -526.5 266.241 o -grestore -gsave -/o { +1.000 0.000 0.000 setrgbcolor gsave -newpath -translate -0 0 m -2 0 l +589.4 194.7 95.06 58.41 clipbox +95.0625 253.11 m +137.162 238.17 l +179.261 222.462 l +221.36 207.853 l +263.459 193.505 l +305.558 179.763 l +347.657 167.399 l +389.756 156.604 l +431.855 146.436 l +473.954 120.135 l +516.054 70.3295 l stroke grestore -} bind def -73.125 268.865 o -grestore -gsave -/o { +0.000 0.750 0.750 setrgbcolor gsave -newpath -translate -0 0 m --2 0 l +589.4 194.7 95.06 58.41 clipbox +95.0625 253.11 m +137.162 203.279 l +179.261 194.654 l +221.36 178.69 l +263.459 162.978 l +305.558 144.303 l +347.657 115.514 l +389.756 61.2154 l stroke grestore -} bind def -526.5 268.865 o -grestore +0.500 setlinewidth +0 setlinecap +0.000 setgray gsave /o { gsave newpath translate 0 0 m -2 0 l +0 4 l stroke grestore } bind def -73.125 277.222 o +95.0625 58.41 o grestore gsave /o { @@ -1736,23 +1738,19 @@ gsave newpath translate 0 0 m --2 0 l +0 -4 l stroke grestore } bind def -526.5 277.222 o +95.0625 253.11 o grestore +/DejaVuSans findfont +12.000 scalefont +setfont gsave -/o { -gsave -newpath -translate -0 0 m -2 0 l -stroke -grestore -} bind def -73.125 283.543 o +92.039062 45.331875 translate +0.000000 rotate +0.000000 0.171875 m /zero glyphshow grestore gsave /o { @@ -1760,11 +1758,11 @@ gsave newpath translate 0 0 m --2 0 l +0 4 l stroke grestore } bind def -526.5 283.543 o +179.261 58.41 o grestore gsave /o { @@ -1772,23 +1770,16 @@ gsave newpath translate 0 0 m -2 0 l +0 -4 l stroke grestore } bind def -73.125 287.241 o +179.261 253.11 o grestore gsave -/o { -gsave -newpath -translate -0 0 m --2 0 l -stroke -grestore -} bind def -526.5 287.241 o +176.479464 45.503750 translate +0.000000 rotate +0.000000 0.000000 m /two glyphshow grestore gsave /o { @@ -1796,11 +1787,11 @@ gsave newpath translate 0 0 m -2 0 l +0 4 l stroke grestore } bind def -73.125 289.865 o +263.459 58.41 o grestore gsave /o { @@ -1808,23 +1799,16 @@ gsave newpath translate 0 0 m --2 0 l +0 -4 l stroke grestore } bind def -526.5 289.865 o +263.459 253.11 o grestore gsave -/o { -gsave -newpath -translate -0 0 m -2 0 l -stroke -grestore -} bind def -73.125 298.222 o +260.271429 45.660000 translate +0.000000 rotate +0.000000 0.000000 m /four glyphshow grestore gsave /o { @@ -1832,11 +1816,11 @@ gsave newpath translate 0 0 m --2 0 l +0 4 l stroke grestore } bind def -526.5 298.222 o +347.657 58.41 o grestore gsave /o { @@ -1844,23 +1828,16 @@ gsave newpath translate 0 0 m -2 0 l +0 -4 l stroke grestore } bind def -73.125 304.543 o +347.657 253.11 o grestore gsave -/o { -gsave -newpath -translate -0 0 m --2 0 l -stroke -grestore -} bind def -526.5 304.543 o +344.641518 45.331875 translate +0.000000 rotate +0.000000 0.171875 m /six glyphshow grestore gsave /o { @@ -1868,11 +1845,11 @@ gsave newpath translate 0 0 m -2 0 l +0 4 l stroke grestore } bind def -73.125 308.241 o +431.855 58.41 o grestore gsave /o { @@ -1880,23 +1857,16 @@ gsave newpath translate 0 0 m --2 0 l +0 -4 l stroke grestore } bind def -526.5 308.241 o +431.855 253.11 o grestore gsave -/o { -gsave -newpath -translate -0 0 m -2 0 l -stroke -grestore -} bind def -73.125 310.865 o +428.855357 45.331875 translate +0.000000 rotate +0.000000 0.171875 m /eight glyphshow grestore gsave /o { @@ -1904,11 +1874,11 @@ gsave newpath translate 0 0 m --2 0 l +0 4 l stroke grestore } bind def -526.5 310.865 o +516.054 58.41 o grestore gsave /o { @@ -1916,23 +1886,17 @@ gsave newpath translate 0 0 m -2 0 l +0 -4 l stroke grestore } bind def -73.125 319.222 o +516.054 253.11 o grestore gsave -/o { -gsave -newpath -translate -0 0 m --2 0 l -stroke -grestore -} bind def -526.5 319.222 o +509.467634 45.331875 translate +0.000000 rotate +0.000000 0.171875 m /one glyphshow +7.634766 0.171875 m /zero glyphshow grestore gsave /o { @@ -1940,11 +1904,11 @@ gsave newpath translate 0 0 m -2 0 l +0 4 l stroke grestore } bind def -73.125 325.543 o +600.252 58.41 o grestore gsave /o { @@ -1952,11 +1916,17 @@ gsave newpath translate 0 0 m --2 0 l +0 -4 l stroke grestore } bind def -526.5 325.543 o +600.252 253.11 o +grestore +gsave +593.868973 45.503750 translate +0.000000 rotate +0.000000 0.000000 m /one glyphshow +7.634766 0.000000 m /two glyphshow grestore gsave /o { @@ -1964,11 +1934,11 @@ gsave newpath translate 0 0 m -2 0 l +0 4 l stroke grestore } bind def -73.125 329.241 o +684.45 58.41 o grestore gsave /o { @@ -1976,23 +1946,32 @@ gsave newpath translate 0 0 m --2 0 l +0 -4 l stroke grestore } bind def -526.5 329.241 o +684.45 253.11 o +grestore +gsave +677.801563 45.660000 translate +0.000000 rotate +0.000000 0.000000 m /one glyphshow +7.634766 0.000000 m /four glyphshow grestore +365.389 31.035 m +0 0.172 rmoveto +(Iteration) show gsave /o { gsave newpath translate 0 0 m -2 0 l +4 0 l stroke grestore } bind def -73.125 331.865 o +95.0625 58.41 o grestore gsave /o { @@ -2000,11 +1979,34 @@ gsave newpath translate 0 0 m --2 0 l +-4 0 l stroke grestore } bind def -526.5 331.865 o +684.45 58.41 o +grestore +gsave +66.062500 50.910000 translate +0.000000 rotate +/DejaVuSans findfont +12.0 scalefont +setfont +0.000000 1.937500 moveto +/one glyphshow + +7.634766 1.937500 moveto +/zero glyphshow + +/DejaVuSans findfont +8.4 scalefont +setfont +15.269531 8.875000 moveto +/hyphen glyphshow + +18.300586 8.875000 moveto +/seven glyphshow + + grestore gsave /o { @@ -2012,11 +2014,11 @@ gsave newpath translate 0 0 m -2 0 l +4 0 l stroke grestore } bind def -73.125 340.222 o +95.0625 86.2243 o grestore gsave /o { @@ -2024,11 +2026,34 @@ gsave newpath translate 0 0 m --2 0 l +-4 0 l stroke grestore } bind def -526.5 340.222 o +684.45 86.2243 o +grestore +gsave +66.062500 78.724286 translate +0.000000 rotate +/DejaVuSans findfont +12.0 scalefont +setfont +0.000000 1.828125 moveto +/one glyphshow + +7.634766 1.828125 moveto +/zero glyphshow + +/DejaVuSans findfont +8.4 scalefont +setfont +15.269531 8.765625 moveto +/hyphen glyphshow + +18.300586 8.765625 moveto +/six glyphshow + + grestore gsave /o { @@ -2036,11 +2061,11 @@ gsave newpath translate 0 0 m -2 0 l +4 0 l stroke grestore } bind def -73.125 346.543 o +95.0625 114.039 o grestore gsave /o { @@ -2048,11 +2073,34 @@ gsave newpath translate 0 0 m --2 0 l +-4 0 l stroke grestore } bind def -526.5 346.543 o +684.45 114.039 o +grestore +gsave +66.062500 106.538571 translate +0.000000 rotate +/DejaVuSans findfont +12.0 scalefont +setfont +0.000000 1.937500 moveto +/one glyphshow + +7.634766 1.937500 moveto +/zero glyphshow + +/DejaVuSans findfont +8.4 scalefont +setfont +15.269531 8.875000 moveto +/hyphen glyphshow + +18.300586 8.875000 moveto +/five glyphshow + + grestore gsave /o { @@ -2060,11 +2108,11 @@ gsave newpath translate 0 0 m -2 0 l +4 0 l stroke grestore } bind def -73.125 350.241 o +95.0625 141.853 o grestore gsave /o { @@ -2072,11 +2120,34 @@ gsave newpath translate 0 0 m --2 0 l +-4 0 l stroke grestore } bind def -526.5 350.241 o +684.45 141.853 o +grestore +gsave +66.062500 134.352857 translate +0.000000 rotate +/DejaVuSans findfont +12.0 scalefont +setfont +0.000000 1.937500 moveto +/one glyphshow + +7.634766 1.937500 moveto +/zero glyphshow + +/DejaVuSans findfont +8.4 scalefont +setfont +15.269531 8.875000 moveto +/hyphen glyphshow + +18.300586 8.875000 moveto +/four glyphshow + + grestore gsave /o { @@ -2084,11 +2155,11 @@ gsave newpath translate 0 0 m -2 0 l +4 0 l stroke grestore } bind def -73.125 352.865 o +95.0625 169.667 o grestore gsave /o { @@ -2096,11 +2167,34 @@ gsave newpath translate 0 0 m --2 0 l +-4 0 l stroke grestore } bind def -526.5 352.865 o +684.45 169.667 o +grestore +gsave +66.062500 162.167143 translate +0.000000 rotate +/DejaVuSans findfont +12.0 scalefont +setfont +0.000000 1.828125 moveto +/one glyphshow + +7.634766 1.828125 moveto +/zero glyphshow + +/DejaVuSans findfont +8.4 scalefont +setfont +15.269531 8.765625 moveto +/hyphen glyphshow + +18.300586 8.765625 moveto +/three glyphshow + + grestore gsave /o { @@ -2108,11 +2202,11 @@ gsave newpath translate 0 0 m -2 0 l +4 0 l stroke grestore } bind def -73.125 361.222 o +95.0625 197.481 o grestore gsave /o { @@ -2120,11 +2214,34 @@ gsave newpath translate 0 0 m --2 0 l +-4 0 l stroke grestore } bind def -526.5 361.222 o +684.45 197.481 o +grestore +gsave +66.062500 189.981429 translate +0.000000 rotate +/DejaVuSans findfont +12.0 scalefont +setfont +0.000000 1.828125 moveto +/one glyphshow + +7.634766 1.828125 moveto +/zero glyphshow + +/DejaVuSans findfont +8.4 scalefont +setfont +15.269531 8.765625 moveto +/hyphen glyphshow + +18.300586 8.765625 moveto +/two glyphshow + + grestore gsave /o { @@ -2132,11 +2249,11 @@ gsave newpath translate 0 0 m -2 0 l +4 0 l stroke grestore } bind def -73.125 367.543 o +95.0625 225.296 o grestore gsave /o { @@ -2144,11 +2261,34 @@ gsave newpath translate 0 0 m --2 0 l +-4 0 l stroke grestore } bind def -526.5 367.543 o +684.45 225.296 o +grestore +gsave +66.062500 217.795714 translate +0.000000 rotate +/DejaVuSans findfont +12.0 scalefont +setfont +0.000000 1.937500 moveto +/one glyphshow + +7.634766 1.937500 moveto +/zero glyphshow + +/DejaVuSans findfont +8.4 scalefont +setfont +15.269531 8.875000 moveto +/hyphen glyphshow + +18.300586 8.875000 moveto +/one glyphshow + + grestore gsave /o { @@ -2156,11 +2296,11 @@ gsave newpath translate 0 0 m -2 0 l +4 0 l stroke grestore } bind def -73.125 371.241 o +95.0625 253.11 o grestore gsave /o { @@ -2168,11 +2308,31 @@ gsave newpath translate 0 0 m --2 0 l +-4 0 l stroke grestore } bind def -526.5 371.241 o +684.45 253.11 o +grestore +gsave +69.062500 245.610000 translate +0.000000 rotate +/DejaVuSans findfont +12.0 scalefont +setfont +0.000000 1.828125 moveto +/one glyphshow + +7.634766 1.828125 moveto +/zero glyphshow + +/DejaVuSans findfont +8.4 scalefont +setfont +15.269531 8.765625 moveto +/zero glyphshow + + grestore gsave /o { @@ -2184,7 +2344,7 @@ translate stroke grestore } bind def -73.125 373.865 o +95.0625 66.7829 o grestore gsave /o { @@ -2196,7 +2356,7 @@ translate stroke grestore } bind def -526.5 373.865 o +684.45 66.7829 o grestore gsave /o { @@ -2208,7 +2368,7 @@ translate stroke grestore } bind def -73.125 382.222 o +95.0625 75.1559 o grestore gsave /o { @@ -2220,7 +2380,7 @@ translate stroke grestore } bind def -526.5 382.222 o +684.45 75.1559 o grestore gsave /o { @@ -2232,7 +2392,7 @@ translate stroke grestore } bind def -73.125 388.543 o +95.0625 80.0537 o grestore gsave /o { @@ -2244,7 +2404,7 @@ translate stroke grestore } bind def -526.5 388.543 o +684.45 80.0537 o grestore gsave /o { @@ -2256,7 +2416,7 @@ translate stroke grestore } bind def -73.125 392.241 o +95.0625 83.5288 o grestore gsave /o { @@ -2268,7 +2428,7 @@ translate stroke grestore } bind def -526.5 392.241 o +684.45 83.5288 o grestore gsave /o { @@ -2280,7 +2440,7 @@ translate stroke grestore } bind def -73.125 394.865 o +95.0625 94.5972 o grestore gsave /o { @@ -2292,248 +2452,43 @@ translate stroke grestore } bind def -526.5 394.865 o -grestore -39.125 274.041 m -gsave -90 rotate -0 0.172 rmoveto -(Relative residual) show -grestore -1.000 setlinewidth -2 setlinecap -gsave -73.125 396.9 m -526.5 396.9 l -stroke -grestore -gsave -526.5 249.9 m -526.5 396.9 l -stroke -grestore -gsave -73.125 249.9 m -526.5 249.9 l -stroke -grestore -gsave -73.125 249.9 m -73.125 396.9 l -stroke -grestore -/DejaVuSans findfont -14.400 scalefont -setfont -240.742 401.9 m -0 0.203 rmoveto -(Relative residual) show -gsave -271.116 301.58 m -519.3 301.58 l -519.3 389.7 l -271.116 389.7 l -271.116 301.58 l -cl -gsave -1.000 setgray -fill -grestore -stroke -grestore -0.000 0.000 1.000 setrgbcolor -gsave -281.196 377.98 m -301.356 377.98 l -stroke -grestore -0.000 setgray -gsave -317.196250 369.940000 translate -0.000000 rotate -/DejaVuSans findfont -14.4 scalefont -setfont -0.000000 3.359375 moveto -/O glyphshow - -11.326996 3.359375 moveto -/p glyphshow - -20.461670 3.359375 moveto -/t glyphshow - -26.104080 3.359375 moveto -/i glyphshow - -30.102249 3.359375 moveto -/m glyphshow - -44.120453 3.359375 moveto -/a glyphshow - -52.938919 3.359375 moveto -/l glyphshow - -56.937088 3.359375 moveto -/space glyphshow - -61.511444 3.359375 moveto -/alpha glyphshow - - -grestore -0.000 0.500 0.000 setrgbcolor -gsave -281.196 356.78 m -301.356 356.78 l -stroke -grestore -0.000 setgray -gsave -317.196250 350.740000 translate -0.000000 rotate -/DejaVuSans findfont -14.4 scalefont -setfont -0.000000 1.609375 moveto -/alpha glyphshow - -9.486008 1.609375 moveto -/space glyphshow - -14.060364 1.609375 moveto -/equal glyphshow - -26.118134 1.609375 moveto -/space glyphshow - -30.692490 1.609375 moveto -/zero glyphshow - -39.848236 1.609375 moveto -/period glyphshow - -44.422592 1.609375 moveto -/zero glyphshow - -53.578339 1.609375 moveto -/five glyphshow - - -grestore -1.000 0.000 0.000 setrgbcolor -gsave -281.196 336.033 m -301.356 336.033 l -stroke -grestore -0.000 setgray -317.196 330.79 m -0 0.203 rmoveto -(Newtons method) show -0.000 0.750 0.750 setrgbcolor -gsave -281.196 315.286 m -301.356 315.286 l -stroke -grestore -0.000 setgray -317.196 307.34 m -0 2.906 rmoveto -(Steepest first, then Newton) show -gsave -73.125 44.1 m -526.5 44.1 l -526.5 191.1 l -73.125 191.1 l -73.125 44.1 l -1.000 setgray -fill +684.45 94.5972 o grestore -0.000 0.000 1.000 setrgbcolor gsave -453.4 147 73.12 44.1 clipbox -73.125 184.565 m -105.509 65.5942 l -137.893 65.2214 l -170.277 65.1308 l -202.661 65.101 l -235.045 65.0875 l -267.429 65.0808 l -299.812 65.0769 l -332.196 65.0745 l -364.58 65.073 l -396.964 65.072 l -429.348 65.0714 l -461.732 65.0709 l -494.116 65.0705 l -526.5 65.0703 l -stroke -grestore -0.000 0.500 0.000 setrgbcolor +/o { gsave -453.4 147 73.12 44.1 clipbox -73.125 184.565 m -105.509 70.7783 l -137.893 69.017 l -170.277 67.8839 l -202.661 67.1174 l -235.045 66.5815 l -267.429 66.1979 l -299.812 65.9189 l -332.196 65.7132 l -364.58 65.5603 l -396.964 65.4458 l -429.348 65.3596 l -461.732 65.2944 l -494.116 65.2449 l -526.5 65.2072 l +newpath +translate +0 0 m +2 0 l stroke grestore -1.000 0.000 0.000 setrgbcolor -gsave -453.4 147 73.12 44.1 clipbox -73.125 184.565 m -105.509 86.0742 l -137.893 68.8444 l -170.277 65.8645 l -202.661 65.2528 l -235.045 65.1195 l -267.429 65.0854 l -299.812 65.0728 l -332.196 65.0699 l -364.58 65.0695 l -396.964 65.0695 l -stroke +} bind def +95.0625 102.97 o grestore -0.000 0.750 0.750 setrgbcolor gsave -453.4 147 73.12 44.1 clipbox -73.125 184.565 m -105.509 65.5942 l -137.893 65.2214 l -170.277 65.0967 l -202.661 65.0733 l -235.045 65.0697 l -267.429 65.0695 l -299.812 65.0695 l +/o { +gsave +newpath +translate +0 0 m +-2 0 l stroke grestore -0.500 setlinewidth -0 setlinecap -0.000 setgray +} bind def +684.45 102.97 o +grestore gsave /o { gsave newpath translate 0 0 m -0 4 l +2 0 l stroke grestore } bind def -73.125 44.1 o +95.0625 107.868 o grestore gsave /o { @@ -2541,19 +2496,11 @@ gsave newpath translate 0 0 m -0 -4 l +-2 0 l stroke grestore } bind def -73.125 191.1 o -grestore -/DejaVuSans findfont -12.000 scalefont -setfont -gsave -70.101562 31.021875 translate -0.000000 rotate -0.000000 0.171875 m /zero glyphshow +684.45 107.868 o grestore gsave /o { @@ -2561,11 +2508,11 @@ gsave newpath translate 0 0 m -0 4 l +2 0 l stroke grestore } bind def -137.893 44.1 o +95.0625 111.343 o grestore gsave /o { @@ -2573,16 +2520,11 @@ gsave newpath translate 0 0 m -0 -4 l +-2 0 l stroke grestore } bind def -137.893 191.1 o -grestore -gsave -135.111607 31.193750 translate -0.000000 rotate -0.000000 0.000000 m /two glyphshow +684.45 111.343 o grestore gsave /o { @@ -2590,11 +2532,11 @@ gsave newpath translate 0 0 m -0 4 l +2 0 l stroke grestore } bind def -202.661 44.1 o +95.0625 122.412 o grestore gsave /o { @@ -2602,16 +2544,11 @@ gsave newpath translate 0 0 m -0 -4 l +-2 0 l stroke grestore } bind def -202.661 191.1 o -grestore -gsave -199.473214 31.350000 translate -0.000000 rotate -0.000000 0.000000 m /four glyphshow +684.45 122.412 o grestore gsave /o { @@ -2619,11 +2556,11 @@ gsave newpath translate 0 0 m -0 4 l +2 0 l stroke grestore } bind def -267.429 44.1 o +95.0625 130.784 o grestore gsave /o { @@ -2631,16 +2568,11 @@ gsave newpath translate 0 0 m -0 -4 l +-2 0 l stroke grestore } bind def -267.429 191.1 o -grestore -gsave -264.412946 31.021875 translate -0.000000 rotate -0.000000 0.171875 m /six glyphshow +684.45 130.784 o grestore gsave /o { @@ -2648,11 +2580,11 @@ gsave newpath translate 0 0 m -0 4 l +2 0 l stroke grestore } bind def -332.196 44.1 o +95.0625 135.682 o grestore gsave /o { @@ -2660,16 +2592,23 @@ gsave newpath translate 0 0 m -0 -4 l +-2 0 l stroke grestore } bind def -332.196 191.1 o +684.45 135.682 o grestore gsave -329.196429 31.021875 translate -0.000000 rotate -0.000000 0.171875 m /eight glyphshow +/o { +gsave +newpath +translate +0 0 m +2 0 l +stroke +grestore +} bind def +95.0625 139.157 o grestore gsave /o { @@ -2677,11 +2616,11 @@ gsave newpath translate 0 0 m -0 4 l +-2 0 l stroke grestore } bind def -396.964 44.1 o +684.45 139.157 o grestore gsave /o { @@ -2689,17 +2628,23 @@ gsave newpath translate 0 0 m -0 -4 l +2 0 l stroke grestore } bind def -396.964 191.1 o +95.0625 150.226 o grestore gsave -390.378348 31.021875 translate -0.000000 rotate -0.000000 0.171875 m /one glyphshow -7.634766 0.171875 m /zero glyphshow +/o { +gsave +newpath +translate +0 0 m +-2 0 l +stroke +grestore +} bind def +684.45 150.226 o grestore gsave /o { @@ -2707,11 +2652,11 @@ gsave newpath translate 0 0 m -0 4 l +2 0 l stroke grestore } bind def -461.732 44.1 o +95.0625 158.599 o grestore gsave /o { @@ -2719,17 +2664,23 @@ gsave newpath translate 0 0 m -0 -4 l +-2 0 l stroke grestore } bind def -461.732 191.1 o +684.45 158.599 o grestore gsave -455.349330 31.193750 translate -0.000000 rotate -0.000000 0.000000 m /one glyphshow -7.634766 0.000000 m /two glyphshow +/o { +gsave +newpath +translate +0 0 m +2 0 l +stroke +grestore +} bind def +95.0625 163.497 o grestore gsave /o { @@ -2737,11 +2688,11 @@ gsave newpath translate 0 0 m -0 4 l +-2 0 l stroke grestore } bind def -526.5 44.1 o +684.45 163.497 o grestore gsave /o { @@ -2749,32 +2700,35 @@ gsave newpath translate 0 0 m -0 -4 l +2 0 l stroke grestore } bind def -526.5 191.1 o +95.0625 166.972 o grestore gsave -519.851562 31.350000 translate -0.000000 rotate -0.000000 0.000000 m /one glyphshow -7.634766 0.000000 m /four glyphshow +/o { +gsave +newpath +translate +0 0 m +-2 0 l +stroke +grestore +} bind def +684.45 166.972 o grestore -275.445 16.725 m -0 0.172 rmoveto -(Iteration) show gsave /o { gsave newpath translate 0 0 m -4 0 l +2 0 l stroke grestore } bind def -73.125 44.1 o +95.0625 178.04 o grestore gsave /o { @@ -2782,18 +2736,23 @@ gsave newpath translate 0 0 m --4 0 l +-2 0 l stroke grestore } bind def -526.5 44.1 o +684.45 178.04 o grestore gsave -45.843750 39.560937 translate -0.000000 rotate -0.000000 0.171875 m /minus glyphshow -10.054688 0.171875 m /two glyphshow -17.689453 0.171875 m /zero glyphshow +/o { +gsave +newpath +translate +0 0 m +2 0 l +stroke +grestore +} bind def +95.0625 186.413 o grestore gsave /o { @@ -2801,11 +2760,11 @@ gsave newpath translate 0 0 m -4 0 l +-2 0 l stroke grestore } bind def -73.125 65.1 o +684.45 186.413 o grestore gsave /o { @@ -2813,16 +2772,23 @@ gsave newpath translate 0 0 m --4 0 l +2 0 l stroke grestore } bind def -526.5 65.1 o +95.0625 191.311 o grestore gsave -63.078125 60.560937 translate -0.000000 rotate -0.000000 0.171875 m /zero glyphshow +/o { +gsave +newpath +translate +0 0 m +-2 0 l +stroke +grestore +} bind def +684.45 191.311 o grestore gsave /o { @@ -2830,11 +2796,11 @@ gsave newpath translate 0 0 m -4 0 l +2 0 l stroke grestore } bind def -73.125 86.1 o +95.0625 194.786 o grestore gsave /o { @@ -2842,17 +2808,23 @@ gsave newpath translate 0 0 m --4 0 l +-2 0 l stroke grestore } bind def -526.5 86.1 o +684.45 194.786 o grestore gsave -55.515625 81.560937 translate -0.000000 rotate -0.000000 0.171875 m /two glyphshow -7.634766 0.171875 m /zero glyphshow +/o { +gsave +newpath +translate +0 0 m +2 0 l +stroke +grestore +} bind def +95.0625 205.854 o grestore gsave /o { @@ -2860,11 +2832,11 @@ gsave newpath translate 0 0 m -4 0 l +-2 0 l stroke grestore } bind def -73.125 107.1 o +684.45 205.854 o grestore gsave /o { @@ -2872,17 +2844,23 @@ gsave newpath translate 0 0 m --4 0 l +2 0 l stroke grestore } bind def -526.5 107.1 o +95.0625 214.227 o grestore gsave -55.234375 102.560937 translate -0.000000 rotate -0.000000 0.171875 m /four glyphshow -7.634766 0.171875 m /zero glyphshow +/o { +gsave +newpath +translate +0 0 m +-2 0 l +stroke +grestore +} bind def +684.45 214.227 o grestore gsave /o { @@ -2890,11 +2868,11 @@ gsave newpath translate 0 0 m -4 0 l +2 0 l stroke grestore } bind def -73.125 128.1 o +95.0625 219.125 o grestore gsave /o { @@ -2902,17 +2880,23 @@ gsave newpath translate 0 0 m --4 0 l +-2 0 l stroke grestore } bind def -526.5 128.1 o +684.45 219.125 o grestore gsave -55.484375 123.560937 translate -0.000000 rotate -0.000000 0.171875 m /six glyphshow -7.634766 0.171875 m /zero glyphshow +/o { +gsave +newpath +translate +0 0 m +2 0 l +stroke +grestore +} bind def +95.0625 222.6 o grestore gsave /o { @@ -2920,11 +2904,11 @@ gsave newpath translate 0 0 m -4 0 l +-2 0 l stroke grestore } bind def -73.125 149.1 o +684.45 222.6 o grestore gsave /o { @@ -2932,17 +2916,23 @@ gsave newpath translate 0 0 m --4 0 l +2 0 l stroke grestore } bind def -526.5 149.1 o +95.0625 233.669 o grestore gsave -55.453125 144.560937 translate -0.000000 rotate -0.000000 0.171875 m /eight glyphshow -7.634766 0.171875 m /zero glyphshow +/o { +gsave +newpath +translate +0 0 m +-2 0 l +stroke +grestore +} bind def +684.45 233.669 o grestore gsave /o { @@ -2950,11 +2940,11 @@ gsave newpath translate 0 0 m -4 0 l +2 0 l stroke grestore } bind def -73.125 170.1 o +95.0625 242.042 o grestore gsave /o { @@ -2962,18 +2952,23 @@ gsave newpath translate 0 0 m --4 0 l +-2 0 l stroke grestore } bind def -526.5 170.1 o +684.45 242.042 o grestore gsave -48.312500 165.560937 translate -0.000000 rotate -0.000000 0.171875 m /one glyphshow -7.634766 0.171875 m /zero glyphshow -15.269531 0.171875 m /zero glyphshow +/o { +gsave +newpath +translate +0 0 m +2 0 l +stroke +grestore +} bind def +95.0625 246.939 o grestore gsave /o { @@ -2981,11 +2976,11 @@ gsave newpath translate 0 0 m -4 0 l +-2 0 l stroke grestore } bind def -73.125 191.1 o +684.45 246.939 o grestore gsave /o { @@ -2993,53 +2988,58 @@ gsave newpath translate 0 0 m --4 0 l +2 0 l stroke grestore } bind def -526.5 191.1 o +95.0625 250.415 o grestore gsave -48.312500 186.560937 translate -0.000000 rotate -0.000000 0.171875 m /one glyphshow -7.634766 0.171875 m /two glyphshow -15.269531 0.171875 m /zero glyphshow +/o { +gsave +newpath +translate +0 0 m +-2 0 l +stroke grestore -40.844 106.389 m +} bind def +684.45 250.415 o +grestore +61.062 106.401 m gsave 90 rotate -0 2.5 rmoveto -(g\(x\)) show +0 0.172 rmoveto +(Relative residual) show grestore 1.000 setlinewidth 2 setlinecap gsave -73.125 191.1 m -526.5 191.1 l +95.0625 253.11 m +684.45 253.11 l stroke grestore gsave -526.5 44.1 m -526.5 191.1 l +684.45 58.41 m +684.45 253.11 l stroke grestore gsave -73.125 44.1 m -526.5 44.1 l +95.0625 58.41 m +684.45 58.41 l stroke grestore gsave -73.125 44.1 m -73.125 191.1 l +95.0625 58.41 m +95.0625 253.11 l stroke grestore /DejaVuSans findfont 14.400 scalefont setfont -247.672 196.1 m +330.686 258.11 m 0 0.203 rmoveto -(Function value) show +(Relative residual) show end showpage diff --git a/steepest.py b/steepest.py index 976388c..581627c 100644 --- a/steepest.py +++ b/steepest.py @@ -58,7 +58,7 @@ def steepest(x, H, b, c, tolerance, maxiter, step, x0_norm=0): relative_residuals.append(relative_residual) points.append(xk) - xk = steepest_iter(xk, alpha, gradient_g(xk)) + xk = steepest_iter(xk, alpha, gradient_g(xk, H, b, c)) return (points, relative_residuals) diff --git a/steepestnewton.py b/steepestnewton.py index 2498575..ee9cfd7 100644 --- a/steepestnewton.py +++ b/steepestnewton.py @@ -16,7 +16,7 @@ def steepestnewton(x0, H, b, c, steep_tol, newt_tol): r.extend(residuals) # Newton starts in the same point as steepest ends in - points, residuals = newton.newton(x[len(x)-1], H, b, c, newt_tol, 100, x0_norm) + points, residuals = newton(x[len(x)-1], H, b, c, newt_tol, 100, x0_norm) x.extend(points[1:]) r.extend(residuals[1:])