]> git.rustad.me Git - nummat1/commitdiff
Everything seems to work ok
authorBjørn Rustad <rustadbjornen@gmail.com>
Fri, 30 Sep 2011 09:40:19 +0000 (11:40 +0200)
committerBjørn Rustad <rustadbjornen@gmail.com>
Fri, 30 Sep 2011 09:40:19 +0000 (11:40 +0200)
main.py
newton.py
rapport.tex
steepest.eps
steepest.py

diff --git a/main.py b/main.py
index db9d52244ace8e26872ae3721be9bdfd305ae60f..96e8a16d5edde1610210b051c77027d2e479b281 100644 (file)
--- a/main.py
+++ b/main.py
@@ -4,22 +4,28 @@ import numpy as np
 import matplotlib.pyplot as plt
 from steepest import steepest
 from function import function_g
+from newton import newton
+from newtsteep import newtsteep
 
 def main():
     H = np.array([ ( 1.8580682, -1.01197101), (-1.01197101, 0.63456543)] )
     b = np.array([-0.3119187,  0.14508516])
     c = np.array([ 0.47736331, 1.48834978])
 
-    x0 = np.array([-0.1, 0.8])
+    x0 = np.array([ 3.1, 3.8])
     
     function_values = []
     
-    alpha = 0.3
-    optimal_points, optimal_residuals = steepest(x0, H, b, c, 0.01, 100, 0)
-    constant_points, constant_residuals = steepest(x0, H, b, c, 0.01, 100, alpha)
+    alpha = 0.1
+    optimal_points, optimal_residuals = steepest(x0, H, b, c, 0.001, 100, 0)
+    constant_points, constant_residuals = steepest(x0, H, b, c, 0.001, 30, alpha)
+    newton_points, newton_residuals = newton(x0, H, b, c, 0.001, 100)
+    nwst_points, nwst_residuals = newtsteep(x0, H, b, c, 0.1, 0.001)
 
     f_optimal = []
     f_constant = []
+    f_newton = []
+    f_nwst = []
 
     mlab.figure(figure="Surface", bgcolor=(1,1,1), fgcolor=(0,0,0))
 
@@ -32,7 +38,15 @@ def main():
         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:
+        z = function_g(point, H, b, c)
+        f_newton.append(z)
+
+    for point in nwst_points:
+        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)
 
@@ -50,7 +64,9 @@ def main():
     plt.ylabel("Relative residual")
     plt.plot(optimal_residuals)
     plt.plot(constant_residuals)
-    plt.legend([r'$\alpha$ = %.1f' % alpha, r'Optimal $\alpha$'])
+    plt.plot(newton_residuals)
+    plt.plot(nwst_residuals)
+    plt.legend([r'Optimal $\alpha$', r'$\alpha$ = %.1f' % alpha, r'Newtons method', r'Steepest first, then Newton'])
     ax.set_yscale('log')
     
     ax = plt.subplot(212)
@@ -59,6 +75,8 @@ def main():
     plt.ylabel("g(x)")
     plt.plot(f_optimal)
     plt.plot(f_constant)
+    plt.plot(f_newton)
+    plt.plot(f_nwst)
     
     plt.show()
     fig.savefig("steepest.eps", format="eps")
index 13c8f746500ed3d37877aa77cc0d4631e7ef2e2a..0be139a65ef87e73257866bfc7c78262f6714f16 100644 (file)
--- a/newton.py
+++ b/newton.py
@@ -9,8 +9,9 @@ from numpy.linalg import norm, inv
 def newton_iter(x, grad_g, hess_g):
     return x - inv(hess_g).dot(grad_g)
 
-def newton(xk, H, b, c, tolerance, maxiter):
-    x0_norm = norm(gradient_g(xk, H, b, c))
+def newton(xk, H, b, c, tolerance, maxiter, x0_norm=0):
+    if x0_norm == 0:
+        x0_norm = norm(gradient_g(xk, H, b, c))
     
     relative_residual = norm(gradient_g(xk, H, b, c)) / x0_norm
     relative_residuals = []
index 6d514af77ee87b457d1a9acae8fc70e45de989a3..29a90b1b21a28db486890ad544c9154f52cb2284 100644 (file)
@@ -133,7 +133,14 @@ Hence $\mathbf{v}^{T}(H+C(\mathbf{x}))\mathbf{v} > 0$, and we see by definition
 \label{fig:surface}\r
 \end{figure}\r
 \r
-% HER KOMMER EN UTLEDNING AV ALPHA OG SÅNT\r
+To find the optimal step length, $\alpha^*$, we solve the equation\r
+\begin{eqnarray}\r
+\frac{\partial}{\partial \mathbf{\alpha}}g\left(\mathbf{x}^{(k)}+\alpha\mathbf{u}^{(k)}\right) &=& 0, \text{where  } \mathbf{u}^{(k)} = -\nabla g(\mathbf{x}^{(k)} )  \nonumber \\\r
+&\Updownarrow& \nonumber\\\r
+%HER ER DET FEIL! \r
+\frac{1}{3}(\mathbf{u}^{(k)})^TC(\mathbf{u}^{(k)})\mathbf{u}^{(k)}\alpha^3+ (\mathbf{x}^{(k)})^TC(\mathbf{u}^{(k)}) \mathbf{u}^{(k)}\alpha^2+(\mathbf{u}^{(k)})^TH\mathbf{u}^{(k)}+(\mathbf{u}^{(k)})^TC(\mathbf{x}^{(k)})\mathbf{u}^{(k)})\alpha + \frac{1}{3}(\mathbf{u}^{(k)})^TC(\mathbf{x}^{(k)})\mathbf{x}^{(k)}+(\mathbf{u}^{(k)})^TH\mathbf{x}^{(k)}-\mathbf{b}^T\mathbf{u}^{(k)} = 0\r
+\end{eqnarray}\r
+\r
 % VI MÅ OGSÅ ha utledning av alt det andre, forklaring \r
 % av figurer, og en slags tabell med sammenlikning av metodene\r
 \r
index 1b5770299ae42d9b6edd35333cb842c308fb6d30..7c543e697a367cae3f46e090cdf3840f4a64644d 100644 (file)
@@ -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: Thu Sep 29 16:33:35 2011
+%%CreationDate: Fri Sep 30 11:39:59 2011
 %%Orientation: portrait
-%%BoundingBox: 13 175 598 616
+%%BoundingBox: -307 103 919 688
 %%EndComments
 %%BeginProlog
 /mpldict 8 dict def
@@ -54,7 +54,7 @@ newpath
 /UnderlinePosition -130 def
 /UnderlineThickness 90 def
 end readonly def
-/CharStrings 38 dict dup begin
+/CharStrings 41 dict dup begin
 /space{318 0 0 0 0 0 _sc
 }_d
 /parenleft{390 0 86 -131 310 759 _sc
@@ -83,6 +83,15 @@ _cl}_d
 209 389 198 463 177 536 _c
 155 609 123 683 80 759 _c
 _cl}_d
+/comma{318 0 77 -115 220 124 _sc
+117 124 _m
+220 124 _l
+220 40 _l
+140 -115 _l
+77 -115 _l
+117 40 _l
+117 124 _l
+_cl}_d
 /hyphen{361 0 49 234 312 314 _sc
 49 314 _m
 312 314 _l
@@ -230,82 +239,6 @@ _cl}_d
 162 384 135 375 108 363 _c
 108 729 _l
 _cl}_e}_d
-/six{{636 0 70 -13 573 742 _sc
-330 404 _m
-286 404 251 388 225 358 _c
-199 328 186 286 186 234 _c
-186 181 199 139 225 109 _c
-251 79 286 64 330 64 _c
-374 64 409 79 435 109 _c
-461 139 474 181 474 234 _c
-474 286 461 328 435 358 _c
-409 388 374 404 330 404 _c
-526 713 _m
-526 623 _l
-501 635 476 644 451 650 _c
-425 656 400 659 376 659 _c
-310 659 260 637 226 593 _c
-192 549 172 482 168 394 _c
-187 422 211 444 240 459 _c
-269 474 301 482 336 482 _c
-409 482 467 459 509 415 _c
-551 371 573 310 573 234 _c
-573 159 550 99 506 54 _c
-462 9 403 -13 330 -13 _c
-246 -13 181 19 137 83 _c
-92 147 70 241 70 364 _c
-70 479 97 571 152 639 _c
-206 707 280 742 372 742 _c
-}_e{396 742 421 739 447 735 _c
-472 730 498 723 526 713 _c
-_cl}_e}_d
-/seven{636 0 82 0 551 729 _sc
-82 729 _m
-551 729 _l
-551 687 _l
-286 0 _l
-183 0 _l
-432 646 _l
-82 646 _l
-82 729 _l
-_cl}_d
-/eight{{636 0 68 -13 568 742 _sc
-318 346 _m
-271 346 234 333 207 308 _c
-180 283 167 249 167 205 _c
-167 161 180 126 207 101 _c
-234 76 271 64 318 64 _c
-364 64 401 76 428 102 _c
-455 127 469 161 469 205 _c
-469 249 455 283 429 308 _c
-402 333 365 346 318 346 _c
-219 388 _m
-177 398 144 418 120 447 _c
-96 476 85 511 85 553 _c
-85 611 105 657 147 691 _c
-188 725 245 742 318 742 _c
-390 742 447 725 489 691 _c
-530 657 551 611 551 553 _c
-551 511 539 476 515 447 _c
-491 418 459 398 417 388 _c
-464 377 501 355 528 323 _c
-554 291 568 251 568 205 _c
-568 134 546 80 503 43 _c
-459 5 398 -13 318 -13 _c
-237 -13 175 5 132 43 _c
-89 80 68 134 68 205 _c
-68 251 81 291 108 323 _c
-134 355 171 377 219 388 _c
-}_e{183 544 _m
-183 506 194 476 218 455 _c
-242 434 275 424 318 424 _c
-360 424 393 434 417 455 _c
-441 476 453 506 453 544 _c
-453 582 441 611 417 632 _c
-393 653 360 664 318 664 _c
-275 664 242 653 218 632 _c
-194 611 183 582 183 544 _c
-_cl}_e}_d
 /equal{838 0 106 172 732 454 _sc
 106 454 _m
 732 454 _l
@@ -338,6 +271,19 @@ _cl}_d
 98 0 _l
 98 729 _l
 _cl}_d
+/N{748 0 98 0 650 729 _sc
+98 729 _m
+231 729 _l
+554 119 _l
+554 729 _l
+650 729 _l
+650 0 _l
+517 0 _l
+194 610 _l
+194 0 _l
+98 0 _l
+98 729 _l
+_cl}_d
 /O{787 0 56 -13 731 742 _sc
 394 662 _m
 322 662 265 635 223 582 _c
@@ -385,6 +331,37 @@ _cl}_d
 404 637 368 648 321 648 _c
 197 648 _l
 _cl}_e}_d
+/S{{635 0 66 -13 579 742 _sc
+535 705 _m
+535 609 _l
+497 627 462 640 429 649 _c
+395 657 363 662 333 662 _c
+279 662 237 651 208 631 _c
+179 610 165 580 165 542 _c
+165 510 174 485 194 469 _c
+213 452 250 439 304 429 _c
+364 417 _l
+437 403 491 378 526 343 _c
+561 307 579 260 579 201 _c
+579 130 555 77 508 41 _c
+460 5 391 -13 300 -13 _c
+265 -13 228 -9 189 -2 _c
+150 5 110 16 69 32 _c
+69 134 _l
+109 111 148 94 186 83 _c
+224 71 262 66 300 66 _c
+356 66 399 77 430 99 _c
+460 121 476 152 476 194 _c
+476 230 465 258 443 278 _c
+421 298 385 313 335 323 _c
+275 335 _l
+201 349 148 372 115 404 _c
+82 435 66 478 66 534 _c
+66 598 88 649 134 686 _c
+179 723 242 742 322 742 _c
+}_e{356 742 390 739 426 733 _c
+461 727 497 717 535 705 _c
+_cl}_e}_d
 /a{{613 0 60 -13 522 560 _sc
 343 275 _m
 270 275 220 266 192 250 _c
@@ -487,6 +464,27 @@ _cl}_e}_d
 174 413 156 373 152 322 _c
 472 322 _l
 _cl}_e}_d
+/f{352 0 23 0 371 760 _sc
+371 760 _m
+371 685 _l
+285 685 _l
+253 685 230 678 218 665 _c
+205 652 199 629 199 595 _c
+199 547 _l
+347 547 _l
+347 477 _l
+199 477 _l
+199 0 _l
+109 0 _l
+109 477 _l
+23 477 _l
+23 547 _l
+109 547 _l
+109 585 _l
+109 645 123 690 151 718 _c
+179 746 224 760 286 760 _c
+371 760 _l
+_cl}_d
 /g{{635 0 55 -207 544 560 _sc
 454 280 _m
 454 344 440 395 414 431 _c
@@ -520,6 +518,25 @@ _cl}_e}_d
 544 547 _l
 544 68 _l
 _cl}_e}_d
+/h{634 0 91 0 549 760 _sc
+549 330 _m
+549 0 _l
+459 0 _l
+459 327 _l
+459 379 448 417 428 443 _c
+408 469 378 482 338 482 _c
+289 482 251 466 223 435 _c
+195 404 181 362 181 309 _c
+181 0 _l
+91 0 _l
+91 760 _l
+181 760 _l
+181 462 _l
+202 494 227 519 257 535 _c
+286 551 320 560 358 560 _c
+420 560 468 540 500 501 _c
+532 462 549 405 549 330 _c
+_cl}_d
 /i{278 0 94 0 184 760 _sc
 94 547 _m
 184 547 _l
@@ -731,6 +748,22 @@ _cl}_d
 235 0 _l
 30 547 _l
 _cl}_d
+/w{818 0 42 0 776 547 _sc
+42 547 _m
+132 547 _l
+244 120 _l
+356 547 _l
+462 547 _l
+574 120 _l
+686 547 _l
+776 547 _l
+633 0 _l
+527 0 _l
+409 448 _l
+291 0 _l
+185 0 _l
+42 547 _l
+_cl}_d
 /x{592 0 29 0 559 547 _sc
 549 547 _m
 351 281 _l
@@ -801,8 +834,8 @@ FontName currentdict end definefont pop
 end
 %%EndProlog
 mpldict begin
-13.5 175.5 translate
-585 441 0 0 clipbox
+-307.8 103.95 translate
+1227.6 584.1 0 0 clipbox
 1.000 setlinewidth
 1 setlinejoin
 2 setlinecap
@@ -810,9 +843,9 @@ mpldict begin
 1.000 setgray
 gsave
 0 0 m
-585 0 l
-585 441 l
-0 441 l
+1227.6 0 l
+1227.6 584.1 l
+0 584.1 l
 0 0 l
 gsave
 fill
@@ -820,116 +853,85 @@ 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
+153.45 330.99 m
+1104.84 330.99 l
+1104.84 525.69 l
+153.45 525.69 l
+153.45 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
-78.7922 353.363 l
-84.4594 360.247 l
-90.1266 332.11 l
-95.7938 348.769 l
-101.461 322.605 l
-107.128 341.473 l
-112.795 315.765 l
-118.463 334.597 l
-124.13 308.812 l
-129.797 326.837 l
-135.464 300.795 l
-141.131 317.915 l
-146.798 291.609 l
+951.4 194.7 153.5 331 clipbox
+153.45 525.69 m
+185.163 493.557 l
+216.876 461.083 l
+248.589 448.62 l
+280.302 423.009 l
+312.015 426.295 l
+343.728 398.538 l
+375.441 413.384 l
+407.154 384.564 l
+438.867 404.651 l
+470.58 375.46 l
 stroke
 grestore
 0.000 0.500 0.000 setrgbcolor
 gsave
-453.4 147 73.12 249.9 clipbox
-73.125 396.9 m
-78.7922 366.217 l
-84.4594 352.868 l
-90.1266 349.37 l
-95.7938 347.256 l
-101.461 345.393 l
-107.128 343.684 l
-112.795 342.107 l
-118.463 340.644 l
-124.13 339.283 l
-129.797 338.013 l
-135.464 336.824 l
-141.131 335.709 l
-146.798 334.659 l
-152.466 333.668 l
-158.133 332.732 l
-163.8 331.844 l
-169.467 331.002 l
-175.134 330.2 l
-180.802 329.435 l
-186.469 328.705 l
-192.136 328.005 l
-197.803 327.335 l
-203.47 326.69 l
-209.138 326.069 l
-214.805 325.471 l
-220.472 324.892 l
-226.139 324.331 l
-231.806 323.787 l
-237.473 323.259 l
-243.141 322.743 l
-248.808 322.241 l
-254.475 321.749 l
-260.142 321.268 l
-265.809 320.795 l
-271.477 320.33 l
-277.144 319.872 l
-282.811 319.42 l
-288.478 318.974 l
-294.145 318.532 l
-299.812 318.093 l
-305.48 317.657 l
-311.147 317.224 l
-316.814 316.792 l
-322.481 316.361 l
-328.148 315.931 l
-333.816 315.501 l
-339.483 315.07 l
-345.15 314.637 l
-350.817 314.204 l
-356.484 313.769 l
-362.152 313.331 l
-367.819 312.89 l
-373.486 312.447 l
-379.153 312 l
-384.82 311.55 l
-390.488 311.096 l
-396.155 310.637 l
-401.822 310.175 l
-407.489 309.708 l
-413.156 309.236 l
-418.823 308.759 l
-424.491 308.276 l
-430.158 307.789 l
-435.825 307.296 l
-441.492 306.798 l
-447.159 306.294 l
-452.827 305.785 l
-458.494 305.27 l
-464.161 304.749 l
-469.828 304.222 l
-475.495 303.689 l
-481.163 303.15 l
-486.83 302.606 l
-492.497 302.055 l
-498.164 301.499 l
-503.831 300.936 l
-509.498 300.368 l
-515.166 299.794 l
-520.833 299.214 l
-526.5 298.629 l
+951.4 194.7 153.5 331 clipbox
+153.45 525.69 m
+185.163 493.348 l
+216.876 481.565 l
+248.589 473.433 l
+280.302 467.353 l
+312.015 462.503 l
+343.728 458.42 l
+375.441 454.855 l
+407.154 451.664 l
+438.867 448.764 l
+470.58 446.101 l
+502.293 443.636 l
+534.006 441.343 l
+565.719 439.201 l
+597.432 437.191 l
+629.145 435.301 l
+660.858 433.519 l
+692.571 431.833 l
+724.284 430.236 l
+755.997 428.72 l
+787.71 427.278 l
+819.423 425.904 l
+851.136 424.592 l
+882.849 423.339 l
+914.562 422.14 l
+946.275 420.99 l
+977.988 419.887 l
+1009.7 418.828 l
+1041.41 417.809 l
+1073.13 416.828 l
+stroke
+grestore
+1.000 0.000 0.000 setrgbcolor
+gsave
+951.4 194.7 153.5 331 clipbox
+153.45 525.69 m
+185.163 500.121 l
+216.876 474.956 l
+248.589 450.505 l
+280.302 426.607 l
+312.015 404.076 l
+343.728 384.897 l
+stroke
+grestore
+0.000 0.750 0.750 setrgbcolor
+gsave
+951.4 194.7 153.5 331 clipbox
+153.45 525.69 m
+185.163 493.557 l
+216.876 461.083 l
+248.589 437.307 l
+280.302 414.139 l
+312.015 393.303 l
 stroke
 grestore
 0.500 setlinewidth
@@ -945,7 +947,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 249.9 o
+153.45 330.99 o
 grestore
 gsave
 /o {
@@ -957,13 +959,13 @@ translate
 stroke
 grestore
 } bind def
-73.125 396.9 o
+153.45 525.69 o
 grestore
 /DejaVuSans findfont
 12.000 scalefont
 setfont
 gsave
-70.101562 236.821875 translate
+150.426563 317.911875 translate
 0.000000 rotate
 0.000000 0.171875 m /zero glyphshow
 grestore
@@ -977,37 +979,7 @@ translate
 stroke
 grestore
 } bind def
-129.797 249.9 o
-grestore
-gsave
-/o {
-gsave
-newpath
-translate
-0 0 m
-0 -4 l
-stroke
-grestore
-} bind def
-129.797 396.9 o
-grestore
-gsave
-123.210938 236.821875 translate
-0.000000 rotate
-0.000000 0.171875 m /one glyphshow
-7.634766 0.171875 m /zero glyphshow
-grestore
-gsave
-/o {
-gsave
-newpath
-translate
-0 0 m
-0 4 l
-stroke
-grestore
-} bind def
-186.469 249.9 o
+312.015 330.99 o
 grestore
 gsave
 /o {
@@ -1019,13 +991,12 @@ translate
 stroke
 grestore
 } bind def
-186.469 396.9 o
+312.015 525.69 o
 grestore
 gsave
-179.664062 236.821875 translate
+309.179063 318.068125 translate
 0.000000 rotate
-0.000000 0.171875 m /two glyphshow
-7.634766 0.171875 m /zero glyphshow
+0.000000 0.171875 m /five glyphshow
 grestore
 gsave
 /o {
@@ -1037,7 +1008,7 @@ translate
 stroke
 grestore
 } bind def
-243.141 249.9 o
+470.58 330.99 o
 grestore
 gsave
 /o {
@@ -1049,12 +1020,12 @@ translate
 stroke
 grestore
 } bind def
-243.141 396.9 o
+470.58 525.69 o
 grestore
 gsave
-236.359375 236.821875 translate
+463.994063 317.911875 translate
 0.000000 rotate
-0.000000 0.171875 m /three glyphshow
+0.000000 0.171875 m /one glyphshow
 7.634766 0.171875 m /zero glyphshow
 grestore
 gsave
@@ -1067,7 +1038,7 @@ translate
 stroke
 grestore
 } bind def
-299.812 249.9 o
+629.145 330.99 o
 grestore
 gsave
 /o {
@@ -1079,13 +1050,13 @@ translate
 stroke
 grestore
 } bind def
-299.812 396.9 o
+629.145 525.69 o
 grestore
 gsave
-292.867188 236.821875 translate
+622.684063 318.068125 translate
 0.000000 rotate
-0.000000 0.171875 m /four glyphshow
-7.634766 0.171875 m /zero glyphshow
+0.000000 0.171875 m /one glyphshow
+7.634766 0.171875 m /five glyphshow
 grestore
 gsave
 /o {
@@ -1097,7 +1068,7 @@ translate
 stroke
 grestore
 } bind def
-356.484 249.9 o
+787.71 330.99 o
 grestore
 gsave
 /o {
@@ -1109,12 +1080,12 @@ translate
 stroke
 grestore
 } bind def
-356.484 396.9 o
+787.71 525.69 o
 grestore
 gsave
-349.703125 236.821875 translate
+780.905313 317.911875 translate
 0.000000 rotate
-0.000000 0.171875 m /five glyphshow
+0.000000 0.171875 m /two glyphshow
 7.634766 0.171875 m /zero glyphshow
 grestore
 gsave
@@ -1127,7 +1098,7 @@ translate
 stroke
 grestore
 } bind def
-413.156 249.9 o
+946.275 330.99 o
 grestore
 gsave
 /o {
@@ -1139,13 +1110,13 @@ translate
 stroke
 grestore
 } bind def
-413.156 396.9 o
+946.275 525.69 o
 grestore
 gsave
-406.335938 236.821875 translate
+939.595313 317.911875 translate
 0.000000 rotate
-0.000000 0.171875 m /six glyphshow
-7.634766 0.171875 m /zero glyphshow
+0.000000 0.171875 m /two glyphshow
+7.634766 0.171875 m /five glyphshow
 grestore
 gsave
 /o {
@@ -1157,7 +1128,7 @@ translate
 stroke
 grestore
 } bind def
-469.828 249.9 o
+1104.84 330.99 o
 grestore
 gsave
 /o {
@@ -1169,25 +1140,28 @@ translate
 stroke
 grestore
 } bind def
-469.828 396.9 o
+1104.84 525.69 o
 grestore
 gsave
-463.078125 236.821875 translate
+1098.058750 317.911875 translate
 0.000000 rotate
-0.000000 0.171875 m /seven glyphshow
+0.000000 0.171875 m /three glyphshow
 7.634766 0.171875 m /zero glyphshow
 grestore
+604.778 303.615 m
+0 0.172 rmoveto
+(Iteration) show
 gsave
 /o {
 gsave
 newpath
 translate
 0 0 m
-0 4 l
+4 0 l
 stroke
 grestore
 } bind def
-526.5 249.9 o
+153.45 330.99 o
 grestore
 gsave
 /o {
@@ -1195,21 +1169,35 @@ gsave
 newpath
 translate
 0 0 m
-0 -4 l
+-4 0 l
 stroke
 grestore
 } bind def
-526.5 396.9 o
+1104.84 330.99 o
 grestore
 gsave
-519.664062 236.821875 translate
+124.450000 323.490000 translate
 0.000000 rotate
-0.000000 0.171875 m /eight glyphshow
-7.634766 0.171875 m /zero glyphshow
+/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
-275.445 222.525 m
-0 0.172 rmoveto
-(Iteration) show
 gsave
 /o {
 gsave
@@ -1220,7 +1208,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 249.9 o
+153.45 379.665 o
 grestore
 gsave
 /o {
@@ -1232,10 +1220,10 @@ translate
 stroke
 grestore
 } bind def
-526.5 249.9 o
+1104.84 379.665 o
 grestore
 gsave
-44.125000 242.400000 translate
+124.450000 372.165000 translate
 0.000000 rotate
 /DejaVuSans findfont
 12.0 scalefont
@@ -1267,7 +1255,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 298.9 o
+153.45 428.34 o
 grestore
 gsave
 /o {
@@ -1279,10 +1267,10 @@ translate
 stroke
 grestore
 } bind def
-526.5 298.9 o
+1104.84 428.34 o
 grestore
 gsave
-44.125000 291.400000 translate
+124.450000 420.840000 translate
 0.000000 rotate
 /DejaVuSans findfont
 12.0 scalefont
@@ -1314,7 +1302,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 347.9 o
+153.45 477.015 o
 grestore
 gsave
 /o {
@@ -1326,10 +1314,10 @@ translate
 stroke
 grestore
 } bind def
-526.5 347.9 o
+1104.84 477.015 o
 grestore
 gsave
-44.125000 340.400000 translate
+124.450000 469.515000 translate
 0.000000 rotate
 /DejaVuSans findfont
 12.0 scalefont
@@ -1361,7 +1349,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 396.9 o
+153.45 525.69 o
 grestore
 gsave
 /o {
@@ -1373,10 +1361,10 @@ translate
 stroke
 grestore
 } bind def
-526.5 396.9 o
+1104.84 525.69 o
 grestore
 gsave
-47.125000 389.400000 translate
+127.450000 518.190000 translate
 0.000000 rotate
 /DejaVuSans findfont
 12.0 scalefont
@@ -1405,7 +1393,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 264.65 o
+153.45 345.643 o
 grestore
 gsave
 /o {
@@ -1417,7 +1405,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 264.65 o
+1104.84 345.643 o
 grestore
 gsave
 /o {
@@ -1429,7 +1417,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 273.279 o
+153.45 354.214 o
 grestore
 gsave
 /o {
@@ -1441,7 +1429,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 273.279 o
+1104.84 354.214 o
 grestore
 gsave
 /o {
@@ -1453,7 +1441,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 279.401 o
+153.45 360.295 o
 grestore
 gsave
 /o {
@@ -1465,7 +1453,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 279.401 o
+1104.84 360.295 o
 grestore
 gsave
 /o {
@@ -1477,7 +1465,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 284.15 o
+153.45 365.012 o
 grestore
 gsave
 /o {
@@ -1489,7 +1477,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 284.15 o
+1104.84 365.012 o
 grestore
 gsave
 /o {
@@ -1501,7 +1489,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 288.029 o
+153.45 368.867 o
 grestore
 gsave
 /o {
@@ -1513,7 +1501,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 288.029 o
+1104.84 368.867 o
 grestore
 gsave
 /o {
@@ -1525,7 +1513,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 291.31 o
+153.45 372.125 o
 grestore
 gsave
 /o {
@@ -1537,7 +1525,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 291.31 o
+1104.84 372.125 o
 grestore
 gsave
 /o {
@@ -1549,7 +1537,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 294.151 o
+153.45 374.948 o
 grestore
 gsave
 /o {
@@ -1561,7 +1549,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 294.151 o
+1104.84 374.948 o
 grestore
 gsave
 /o {
@@ -1573,7 +1561,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 296.658 o
+153.45 377.438 o
 grestore
 gsave
 /o {
@@ -1585,7 +1573,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 296.658 o
+1104.84 377.438 o
 grestore
 gsave
 /o {
@@ -1597,7 +1585,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 313.65 o
+153.45 394.318 o
 grestore
 gsave
 /o {
@@ -1609,7 +1597,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 313.65 o
+1104.84 394.318 o
 grestore
 gsave
 /o {
@@ -1621,7 +1609,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 322.279 o
+153.45 402.889 o
 grestore
 gsave
 /o {
@@ -1633,7 +1621,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 322.279 o
+1104.84 402.889 o
 grestore
 gsave
 /o {
@@ -1645,7 +1633,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 328.401 o
+153.45 408.97 o
 grestore
 gsave
 /o {
@@ -1657,7 +1645,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 328.401 o
+1104.84 408.97 o
 grestore
 gsave
 /o {
@@ -1669,7 +1657,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 333.15 o
+153.45 413.687 o
 grestore
 gsave
 /o {
@@ -1681,7 +1669,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 333.15 o
+1104.84 413.687 o
 grestore
 gsave
 /o {
@@ -1693,7 +1681,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 337.029 o
+153.45 417.542 o
 grestore
 gsave
 /o {
@@ -1705,7 +1693,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 337.029 o
+1104.84 417.542 o
 grestore
 gsave
 /o {
@@ -1717,7 +1705,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 340.31 o
+153.45 420.8 o
 grestore
 gsave
 /o {
@@ -1729,7 +1717,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 340.31 o
+1104.84 420.8 o
 grestore
 gsave
 /o {
@@ -1741,7 +1729,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 343.151 o
+153.45 423.623 o
 grestore
 gsave
 /o {
@@ -1753,7 +1741,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 343.151 o
+1104.84 423.623 o
 grestore
 gsave
 /o {
@@ -1765,7 +1753,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 345.658 o
+153.45 426.113 o
 grestore
 gsave
 /o {
@@ -1777,7 +1765,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 345.658 o
+1104.84 426.113 o
 grestore
 gsave
 /o {
@@ -1789,7 +1777,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 362.65 o
+153.45 442.993 o
 grestore
 gsave
 /o {
@@ -1801,7 +1789,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 362.65 o
+1104.84 442.993 o
 grestore
 gsave
 /o {
@@ -1813,7 +1801,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 371.279 o
+153.45 451.564 o
 grestore
 gsave
 /o {
@@ -1825,7 +1813,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 371.279 o
+1104.84 451.564 o
 grestore
 gsave
 /o {
@@ -1837,7 +1825,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 377.401 o
+153.45 457.645 o
 grestore
 gsave
 /o {
@@ -1849,7 +1837,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 377.401 o
+1104.84 457.645 o
 grestore
 gsave
 /o {
@@ -1861,7 +1849,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 382.15 o
+153.45 462.362 o
 grestore
 gsave
 /o {
@@ -1873,7 +1861,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 382.15 o
+1104.84 462.362 o
 grestore
 gsave
 /o {
@@ -1885,7 +1873,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 386.029 o
+153.45 466.217 o
 grestore
 gsave
 /o {
@@ -1897,7 +1885,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 386.029 o
+1104.84 466.217 o
 grestore
 gsave
 /o {
@@ -1909,7 +1897,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 389.31 o
+153.45 469.475 o
 grestore
 gsave
 /o {
@@ -1921,7 +1909,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 389.31 o
+1104.84 469.475 o
 grestore
 gsave
 /o {
@@ -1933,7 +1921,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 392.151 o
+153.45 472.298 o
 grestore
 gsave
 /o {
@@ -1945,7 +1933,7 @@ translate
 stroke
 grestore
 } bind def
-526.5 392.151 o
+1104.84 472.298 o
 grestore
 gsave
 /o {
@@ -1957,7 +1945,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 394.658 o
+153.45 474.788 o
 grestore
 gsave
 /o {
@@ -1969,9 +1957,201 @@ translate
 stroke
 grestore
 } bind def
-526.5 394.658 o
+1104.84 474.788 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+2 0 l
+stroke
+grestore
+} bind def
+153.45 491.668 o
 grestore
-39.125 274.041 m
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-2 0 l
+stroke
+grestore
+} bind def
+1104.84 491.668 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+2 0 l
+stroke
+grestore
+} bind def
+153.45 500.239 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-2 0 l
+stroke
+grestore
+} bind def
+1104.84 500.239 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+2 0 l
+stroke
+grestore
+} bind def
+153.45 506.32 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-2 0 l
+stroke
+grestore
+} bind def
+1104.84 506.32 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+2 0 l
+stroke
+grestore
+} bind def
+153.45 511.037 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-2 0 l
+stroke
+grestore
+} bind def
+1104.84 511.037 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+2 0 l
+stroke
+grestore
+} bind def
+153.45 514.892 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-2 0 l
+stroke
+grestore
+} bind def
+1104.84 514.892 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+2 0 l
+stroke
+grestore
+} bind def
+153.45 518.15 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-2 0 l
+stroke
+grestore
+} bind def
+1104.84 518.15 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+2 0 l
+stroke
+grestore
+} bind def
+153.45 520.973 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-2 0 l
+stroke
+grestore
+} bind def
+1104.84 520.973 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+2 0 l
+stroke
+grestore
+} bind def
+153.45 523.463 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-2 0 l
+stroke
+grestore
+} bind def
+1104.84 523.463 o
+grestore
+119.45 378.981 m
 gsave
 90 rotate
 0 0.172 rmoveto
@@ -1980,37 +2160,37 @@ grestore
 1.000 setlinewidth
 2 setlinecap
 gsave
-73.125 396.9 m
-526.5 396.9 l
+153.45 525.69 m
+1104.84 525.69 l
 stroke
 grestore
 gsave
-526.5 249.9 m
-526.5 396.9 l
+1104.84 330.99 m
+1104.84 525.69 l
 stroke
 grestore
 gsave
-73.125 249.9 m
-526.5 249.9 l
+153.45 330.99 m
+1104.84 330.99 l
 stroke
 grestore
 gsave
-73.125 249.9 m
-73.125 396.9 l
+153.45 330.99 m
+153.45 525.69 l
 stroke
 grestore
 /DejaVuSans findfont
 14.400 scalefont
 setfont
-240.742 401.9 m
+570.075 530.69 m
 0 0.203 rmoveto
 (Relative residual) show
 gsave
-396.46 343.074 m
-519.3 343.074 l
-519.3 389.7 l
-396.46 389.7 l
-396.46 343.074 l
+849.456 430.37 m
+1097.64 430.37 l
+1097.64 518.49 l
+849.456 518.49 l
+849.456 430.37 l
 cl
 gsave
 1.000 setgray
@@ -2020,49 +2200,13 @@ stroke
 grestore
 0.000 0.000 1.000 setrgbcolor
 gsave
-406.54 377.98 m
-426.7 377.98 l
+859.536 506.77 m
+879.696 506.77 l
 stroke
 grestore
 0.000 setgray
 gsave
-442.540000 371.940000 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
-/three glyphshow
-
-
-grestore
-0.000 0.500 0.000 setrgbcolor
-gsave
-406.54 356.874 m
-426.7 356.874 l
-stroke
-grestore
-0.000 setgray
-gsave
-442.540000 348.833750 translate
+895.536250 498.730000 translate
 0.000000 rotate
 /DejaVuSans findfont
 14.4 scalefont
@@ -2096,118 +2240,143 @@ setfont
 
 
 grestore
+0.000 0.500 0.000 setrgbcolor
+gsave
+859.536 485.57 m
+879.696 485.57 l
+stroke
+grestore
+0.000 setgray
+gsave
+895.536250 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
+/one glyphshow
+
+
+grestore
+1.000 0.000 0.000 setrgbcolor
+gsave
+859.536 464.823 m
+879.696 464.823 l
+stroke
+grestore
+0.000 setgray
+895.536 459.58 m
+0 0.203 rmoveto
+(Newtons method) show
+0.000 0.750 0.750 setrgbcolor
 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
+859.536 444.076 m
+879.696 444.076 l
+stroke
+grestore
+0.000 setgray
+895.536 436.13 m
+0 2.906 rmoveto
+(Steepest first, then Newton) show
+gsave
+153.45 58.41 m
+1104.84 58.41 l
+1104.84 253.11 l
+153.45 253.11 l
+153.45 58.41 l
 1.000 setgray
 fill
 grestore
 0.000 0.000 1.000 setrgbcolor
 gsave
-453.4 147 73.12 44.1 clipbox
-73.125 189.251 m
-78.7922 79.1064 l
-84.4594 67.3836 l
-90.1266 63.3527 l
-95.7938 61.1342 l
-101.461 59.7356 l
-107.128 58.7543 l
-112.795 58.0478 l
-118.463 57.534 l
-124.13 57.1649 l
-129.797 56.9062 l
-135.464 56.729 l
-141.131 56.6115 l
-146.798 56.5352 l
+951.4 194.7 153.5 58.41 clipbox
+153.45 236.267 m
+185.163 107.313 l
+216.876 85.3725 l
+248.589 83.4367 l
+280.302 82.9228 l
+312.015 82.7593 l
+343.728 82.6943 l
+375.441 82.6609 l
+407.154 82.6417 l
+438.867 82.6291 l
+470.58 82.6207 l
 stroke
 grestore
 0.000 0.500 0.000 setrgbcolor
 gsave
-453.4 147 73.12 44.1 clipbox
-73.125 189.251 m
-78.7922 84.6671 l
-84.4594 77.7124 l
-90.1266 75.198 l
-95.7938 73.3055 l
-101.461 71.7435 l
-107.128 70.4276 l
-112.795 69.3036 l
-118.463 68.3319 l
-124.13 67.483 l
-129.797 66.7344 l
-135.464 66.0688 l
-141.131 65.4725 l
-146.798 64.9348 l
-152.466 64.447 l
-158.133 64.0019 l
-163.8 63.5939 l
-169.467 63.2181 l
-175.134 62.8706 l
-180.802 62.548 l
-186.469 62.2476 l
-192.136 61.9669 l
-197.803 61.7039 l
-203.47 61.4568 l
-209.138 61.2241 l
-214.805 61.0044 l
-220.472 60.7967 l
-226.139 60.5999 l
-231.806 60.4131 l
-237.473 60.2356 l
-243.141 60.0666 l
-248.808 59.9056 l
-254.475 59.7519 l
-260.142 59.6052 l
-265.809 59.4649 l
-271.477 59.3307 l
-277.144 59.2022 l
-282.811 59.0791 l
-288.478 58.9611 l
-294.145 58.848 l
-299.812 58.7394 l
-305.48 58.6352 l
-311.147 58.5352 l
-316.814 58.4392 l
-322.481 58.347 l
-328.148 58.2584 l
-333.816 58.1734 l
-339.483 58.0917 l
-345.15 58.0133 l
-350.817 57.938 l
-356.484 57.8657 l
-362.152 57.7963 l
-367.819 57.7297 l
-373.486 57.6658 l
-379.153 57.6046 l
-384.82 57.5458 l
-390.488 57.4895 l
-396.155 57.4355 l
-401.822 57.3839 l
-407.489 57.3344 l
-413.156 57.2871 l
-418.823 57.2418 l
-424.491 57.1985 l
-430.158 57.1571 l
-435.825 57.1176 l
-441.492 57.0799 l
-447.159 57.0439 l
-452.827 57.0096 l
-458.494 56.9769 l
-464.161 56.9458 l
-469.828 56.9161 l
-475.495 56.8879 l
-481.163 56.861 l
-486.83 56.8355 l
-492.497 56.8113 l
-498.164 56.7883 l
-503.831 56.7664 l
-509.498 56.7457 l
-515.166 56.7261 l
-520.833 56.7075 l
-526.5 56.6899 l
+951.4 194.7 153.5 58.41 clipbox
+153.45 236.267 m
+185.163 107.57 l
+216.876 94.4353 l
+248.589 89.8064 l
+280.302 87.566 l
+312.015 86.2702 l
+343.728 85.4367 l
+375.441 84.8634 l
+407.154 84.4508 l
+438.867 84.1436 l
+470.58 83.9089 l
+502.293 83.7256 l
+534.006 83.5799 l
+565.719 83.4621 l
+597.432 83.3657 l
+629.145 83.2858 l
+660.858 83.2188 l
+692.571 83.162 l
+724.284 83.1135 l
+755.997 83.0718 l
+787.71 83.0355 l
+819.423 83.0039 l
+851.136 82.976 l
+882.849 82.9514 l
+914.562 82.9295 l
+946.275 82.9099 l
+977.988 82.8923 l
+1009.7 82.8765 l
+1041.41 82.8621 l
+1073.13 82.8491 l
+stroke
+grestore
+1.000 0.000 0.000 setrgbcolor
+gsave
+951.4 194.7 153.5 58.41 clipbox
+153.45 236.267 m
+185.163 113.575 l
+216.876 88.888 l
+248.589 83.9725 l
+280.302 82.9548 l
+312.015 82.7133 l
+343.728 82.6365 l
+stroke
+grestore
+0.000 0.750 0.750 setrgbcolor
+gsave
+951.4 194.7 153.5 58.41 clipbox
+153.45 236.267 m
+185.163 107.313 l
+216.876 85.3725 l
+248.589 83.2462 l
+280.302 82.7874 l
+312.015 82.6638 l
 stroke
 grestore
 0.500 setlinewidth
@@ -2223,7 +2392,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 44.1 o
+153.45 58.41 o
 grestore
 gsave
 /o {
@@ -2235,13 +2404,13 @@ translate
 stroke
 grestore
 } bind def
-73.125 191.1 o
+153.45 253.11 o
 grestore
 /DejaVuSans findfont
 12.000 scalefont
 setfont
 gsave
-70.101562 31.021875 translate
+150.426563 45.331875 translate
 0.000000 rotate
 0.000000 0.171875 m /zero glyphshow
 grestore
@@ -2255,7 +2424,7 @@ translate
 stroke
 grestore
 } bind def
-129.797 44.1 o
+312.015 58.41 o
 grestore
 gsave
 /o {
@@ -2267,13 +2436,12 @@ translate
 stroke
 grestore
 } bind def
-129.797 191.1 o
+312.015 253.11 o
 grestore
 gsave
-123.210938 31.021875 translate
+309.179063 45.488125 translate
 0.000000 rotate
-0.000000 0.171875 m /one glyphshow
-7.634766 0.171875 m /zero glyphshow
+0.000000 0.171875 m /five glyphshow
 grestore
 gsave
 /o {
@@ -2285,7 +2453,7 @@ translate
 stroke
 grestore
 } bind def
-186.469 44.1 o
+470.58 58.41 o
 grestore
 gsave
 /o {
@@ -2297,12 +2465,12 @@ translate
 stroke
 grestore
 } bind def
-186.469 191.1 o
+470.58 253.11 o
 grestore
 gsave
-179.664062 31.021875 translate
+463.994063 45.331875 translate
 0.000000 rotate
-0.000000 0.171875 m /two glyphshow
+0.000000 0.171875 m /one glyphshow
 7.634766 0.171875 m /zero glyphshow
 grestore
 gsave
@@ -2315,7 +2483,7 @@ translate
 stroke
 grestore
 } bind def
-243.141 44.1 o
+629.145 58.41 o
 grestore
 gsave
 /o {
@@ -2327,13 +2495,13 @@ translate
 stroke
 grestore
 } bind def
-243.141 191.1 o
+629.145 253.11 o
 grestore
 gsave
-236.359375 31.021875 translate
+622.684063 45.488125 translate
 0.000000 rotate
-0.000000 0.171875 m /three glyphshow
-7.634766 0.171875 m /zero glyphshow
+0.000000 0.171875 m /one glyphshow
+7.634766 0.171875 m /five glyphshow
 grestore
 gsave
 /o {
@@ -2345,7 +2513,7 @@ translate
 stroke
 grestore
 } bind def
-299.812 44.1 o
+787.71 58.41 o
 grestore
 gsave
 /o {
@@ -2357,12 +2525,12 @@ translate
 stroke
 grestore
 } bind def
-299.812 191.1 o
+787.71 253.11 o
 grestore
 gsave
-292.867188 31.021875 translate
+780.905313 45.331875 translate
 0.000000 rotate
-0.000000 0.171875 m /four glyphshow
+0.000000 0.171875 m /two glyphshow
 7.634766 0.171875 m /zero glyphshow
 grestore
 gsave
@@ -2375,7 +2543,7 @@ translate
 stroke
 grestore
 } bind def
-356.484 44.1 o
+946.275 58.41 o
 grestore
 gsave
 /o {
@@ -2387,13 +2555,13 @@ translate
 stroke
 grestore
 } bind def
-356.484 191.1 o
+946.275 253.11 o
 grestore
 gsave
-349.703125 31.021875 translate
+939.595313 45.331875 translate
 0.000000 rotate
-0.000000 0.171875 m /five glyphshow
-7.634766 0.171875 m /zero glyphshow
+0.000000 0.171875 m /two glyphshow
+7.634766 0.171875 m /five glyphshow
 grestore
 gsave
 /o {
@@ -2405,7 +2573,7 @@ translate
 stroke
 grestore
 } bind def
-413.156 44.1 o
+1104.84 58.41 o
 grestore
 gsave
 /o {
@@ -2417,25 +2585,28 @@ translate
 stroke
 grestore
 } bind def
-413.156 191.1 o
+1104.84 253.11 o
 grestore
 gsave
-406.335938 31.021875 translate
+1098.058750 45.331875 translate
 0.000000 rotate
-0.000000 0.171875 m /six glyphshow
+0.000000 0.171875 m /three glyphshow
 7.634766 0.171875 m /zero glyphshow
 grestore
+604.778 31.035 m
+0 0.172 rmoveto
+(Iteration) show
 gsave
 /o {
 gsave
 newpath
 translate
 0 0 m
-0 4 l
+4 0 l
 stroke
 grestore
 } bind def
-469.828 44.1 o
+153.45 58.41 o
 grestore
 gsave
 /o {
@@ -2443,17 +2614,17 @@ gsave
 newpath
 translate
 0 0 m
-0 -4 l
+-4 0 l
 stroke
 grestore
 } bind def
-469.828 191.1 o
+1104.84 58.41 o
 grestore
 gsave
-463.078125 31.021875 translate
+134.059375 53.949062 translate
 0.000000 rotate
-0.000000 0.171875 m /seven glyphshow
-7.634766 0.171875 m /zero glyphshow
+0.000000 0.171875 m /minus glyphshow
+10.054688 0.171875 m /five glyphshow
 grestore
 gsave
 /o {
@@ -2461,11 +2632,11 @@ gsave
 newpath
 translate
 0 0 m
-0 4 l
+4 0 l
 stroke
 grestore
 } bind def
-526.5 44.1 o
+153.45 82.7475 o
 grestore
 gsave
 /o {
@@ -2473,21 +2644,17 @@ gsave
 newpath
 translate
 0 0 m
-0 -4 l
+-4 0 l
 stroke
 grestore
 } bind def
-526.5 191.1 o
+1104.84 82.7475 o
 grestore
 gsave
-519.664062 31.021875 translate
+143.403125 78.208437 translate
 0.000000 rotate
-0.000000 0.171875 m /eight glyphshow
-7.634766 0.171875 m /zero glyphshow
+0.000000 0.171875 m /zero glyphshow
 grestore
-275.445 16.725 m
-0 0.172 rmoveto
-(Iteration) show
 gsave
 /o {
 gsave
@@ -2498,7 +2665,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 44.1 o
+153.45 107.085 o
 grestore
 gsave
 /o {
@@ -2510,16 +2677,12 @@ translate
 stroke
 grestore
 } bind def
-526.5 44.1 o
+1104.84 107.085 o
 grestore
 gsave
-34.640625 39.560937 translate
+143.778125 102.624062 translate
 0.000000 rotate
-0.000000 0.171875 m /minus glyphshow
-10.054688 0.171875 m /zero glyphshow
-17.689453 0.171875 m /period glyphshow
-21.503906 0.171875 m /zero glyphshow
-29.138672 0.171875 m /five glyphshow
+0.000000 0.171875 m /five glyphshow
 grestore
 gsave
 /o {
@@ -2531,7 +2694,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 73.5 o
+153.45 131.422 o
 grestore
 gsave
 /o {
@@ -2543,15 +2706,13 @@ translate
 stroke
 grestore
 } bind def
-526.5 73.5 o
+1104.84 131.422 o
 grestore
 gsave
-43.984375 68.960937 translate
+136.278125 126.883437 translate
 0.000000 rotate
-0.000000 0.171875 m /zero glyphshow
-7.634766 0.171875 m /period glyphshow
-11.449219 0.171875 m /zero glyphshow
-19.083984 0.171875 m /zero glyphshow
+0.000000 0.171875 m /one glyphshow
+7.634766 0.171875 m /zero glyphshow
 grestore
 gsave
 /o {
@@ -2563,7 +2724,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 102.9 o
+153.45 155.76 o
 grestore
 gsave
 /o {
@@ -2575,15 +2736,13 @@ translate
 stroke
 grestore
 } bind def
-526.5 102.9 o
+1104.84 155.76 o
 grestore
 gsave
-44.234375 98.360937 translate
+136.528125 151.299062 translate
 0.000000 rotate
-0.000000 0.171875 m /zero glyphshow
-7.634766 0.171875 m /period glyphshow
-11.449219 0.171875 m /zero glyphshow
-19.083984 0.171875 m /five glyphshow
+0.000000 0.171875 m /one glyphshow
+7.634766 0.171875 m /five glyphshow
 grestore
 gsave
 /o {
@@ -2595,7 +2754,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 132.3 o
+153.45 180.097 o
 grestore
 gsave
 /o {
@@ -2607,15 +2766,13 @@ translate
 stroke
 grestore
 } bind def
-526.5 132.3 o
+1104.84 180.097 o
 grestore
 gsave
-43.984375 127.760938 translate
+135.840625 175.558437 translate
 0.000000 rotate
-0.000000 0.171875 m /zero glyphshow
-7.634766 0.171875 m /period glyphshow
-11.449219 0.171875 m /one glyphshow
-19.083984 0.171875 m /zero glyphshow
+0.000000 0.171875 m /two glyphshow
+7.634766 0.171875 m /zero glyphshow
 grestore
 gsave
 /o {
@@ -2627,7 +2784,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 161.7 o
+153.45 204.435 o
 grestore
 gsave
 /o {
@@ -2639,15 +2796,13 @@ translate
 stroke
 grestore
 } bind def
-526.5 161.7 o
+1104.84 204.435 o
 grestore
 gsave
-44.234375 157.160937 translate
+136.090625 199.895938 translate
 0.000000 rotate
-0.000000 0.171875 m /zero glyphshow
-7.634766 0.171875 m /period glyphshow
-11.449219 0.171875 m /one glyphshow
-19.083984 0.171875 m /five glyphshow
+0.000000 0.171875 m /two glyphshow
+7.634766 0.171875 m /five glyphshow
 grestore
 gsave
 /o {
@@ -2659,7 +2814,7 @@ translate
 stroke
 grestore
 } bind def
-73.125 191.1 o
+153.45 228.772 o
 grestore
 gsave
 /o {
@@ -2671,17 +2826,45 @@ translate
 stroke
 grestore
 } bind def
-526.5 191.1 o
+1104.84 228.772 o
 grestore
 gsave
-43.984375 186.560937 translate
+135.887500 224.233437 translate
 0.000000 rotate
-0.000000 0.171875 m /zero glyphshow
-7.634766 0.171875 m /period glyphshow
-11.449219 0.171875 m /two glyphshow
-19.083984 0.171875 m /zero glyphshow
+0.000000 0.171875 m /three glyphshow
+7.634766 0.171875 m /zero glyphshow
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+4 0 l
+stroke
+grestore
+} bind def
+153.45 253.11 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-4 0 l
+stroke
+grestore
+} bind def
+1104.84 253.11 o
+grestore
+gsave
+136.137500 248.570938 translate
+0.000000 rotate
+0.000000 0.171875 m /three glyphshow
+7.634766 0.171875 m /five glyphshow
 grestore
-29.641 106.389 m
+129.059 144.549 m
 gsave
 90 rotate
 0 2.5 rmoveto
@@ -2690,29 +2873,29 @@ grestore
 1.000 setlinewidth
 2 setlinecap
 gsave
-73.125 191.1 m
-526.5 191.1 l
+153.45 253.11 m
+1104.84 253.11 l
 stroke
 grestore
 gsave
-526.5 44.1 m
-526.5 191.1 l
+1104.84 58.41 m
+1104.84 253.11 l
 stroke
 grestore
 gsave
-73.125 44.1 m
-526.5 44.1 l
+153.45 58.41 m
+1104.84 58.41 l
 stroke
 grestore
 gsave
-73.125 44.1 m
-73.125 191.1 l
+153.45 58.41 m
+153.45 253.11 l
 stroke
 grestore
 /DejaVuSans findfont
 14.400 scalefont
 setfont
-247.672 196.1 m
+577.004 258.11 m
 0 0.203 rmoveto
 (Function value) show
 
index ecbf182d1ca864bc6d7dc3739dc85c1e8ffa7b8f..49147c48615ef9fa1d02e1b5913a0a21f7448640 100644 (file)
@@ -30,9 +30,10 @@ def optimal_step(x, H, b, c, grad_f):
 
     return 0.1
 
-def steepest(x, H, b, c, tolerance, maxiter, step):
+def steepest(x, H, b, c, tolerance, maxiter, step, x0_norm=0):
     xk = np.array(x)
-    x0_norm = norm(gradient_g(xk, H, b, c))
+    if x0_norm == 0:
+        x0_norm = norm(gradient_g(xk, H, b, c))
     
     relative_residual = norm(gradient_g(xk, H, b, c)) / x0_norm
     relative_residuals = []