]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
3 | <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> | |
4 | <title>The Effect of a Poor Initial Guess</title> | |
5 | <link rel="stylesheet" href="../../math.css" type="text/css"> | |
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> | |
7 | <link rel="home" href="../../index.html" title="Math Toolkit 2.5.1"> | |
8 | <link rel="up" href="../roots.html" title="Root finding"> | |
9 | <link rel="prev" href="root_finding_examples/elliptic_eg.html" title="A More complex example - Inverting the Elliptic Integrals"> | |
10 | <link rel="next" href="bad_roots.html" title="Examples Where Root Finding Goes Wrong"> | |
11 | </head> | |
12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> | |
13 | <table cellpadding="2" width="100%"><tr> | |
14 | <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> | |
15 | <td align="center"><a href="../../../../../../index.html">Home</a></td> | |
16 | <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> | |
17 | <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> | |
18 | <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> | |
19 | <td align="center"><a href="../../../../../../more/index.htm">More</a></td> | |
20 | </tr></table> | |
21 | <hr> | |
22 | <div class="spirit-nav"> | |
23 | <a accesskey="p" href="root_finding_examples/elliptic_eg.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="bad_roots.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> | |
24 | </div> | |
25 | <div class="section"> | |
26 | <div class="titlepage"><div><div><h3 class="title"> | |
27 | <a name="math_toolkit.roots.bad_guess"></a><a class="link" href="bad_guess.html" title="The Effect of a Poor Initial Guess">The Effect of a Poor Initial | |
28 | Guess</a> | |
29 | </h3></div></div></div> | |
30 | <p> | |
31 | It's instructive to take our "toy" example algorithms, and use | |
32 | deliberately bad initial guesses to see how the various root finding algorithms | |
33 | fair. We'll start with the cubed root, and using the cube root of 500 as | |
34 | the test case: | |
35 | </p> | |
36 | <div class="informaltable"><table class="table"> | |
37 | <colgroup> | |
38 | <col> | |
39 | <col> | |
40 | <col> | |
41 | <col> | |
42 | <col> | |
43 | <col> | |
44 | <col> | |
45 | <col> | |
46 | <col> | |
47 | <col> | |
48 | <col> | |
49 | <col> | |
50 | <col> | |
51 | </colgroup> | |
52 | <thead><tr> | |
53 | <th> | |
54 | <p> | |
55 | Initial Guess= | |
56 | </p> | |
57 | </th> | |
58 | <th> | |
59 | <p> | |
60 | -500% (≈1.323) | |
61 | </p> | |
62 | </th> | |
63 | <th> | |
64 | <p> | |
65 | -100% (≈3.97) | |
66 | </p> | |
67 | </th> | |
68 | <th> | |
69 | <p> | |
70 | -50% (≈3.96) | |
71 | </p> | |
72 | </th> | |
73 | <th> | |
74 | <p> | |
75 | -20% (≈6.35) | |
76 | </p> | |
77 | </th> | |
78 | <th> | |
79 | <p> | |
80 | -10% (≈7.14) | |
81 | </p> | |
82 | </th> | |
83 | <th> | |
84 | <p> | |
85 | -5% (≈7.54) | |
86 | </p> | |
87 | </th> | |
88 | <th> | |
89 | <p> | |
90 | 5% (≈8.33) | |
91 | </p> | |
92 | </th> | |
93 | <th> | |
94 | <p> | |
95 | 10% (≈8.73) | |
96 | </p> | |
97 | </th> | |
98 | <th> | |
99 | <p> | |
100 | 20% (≈9.52) | |
101 | </p> | |
102 | </th> | |
103 | <th> | |
104 | <p> | |
105 | 50% (≈11.91) | |
106 | </p> | |
107 | </th> | |
108 | <th> | |
109 | <p> | |
110 | 100% (≈15.87) | |
111 | </p> | |
112 | </th> | |
113 | <th> | |
114 | <p> | |
115 | 500 (≈47.6) | |
116 | </p> | |
117 | </th> | |
118 | </tr></thead> | |
119 | <tbody> | |
120 | <tr> | |
121 | <td> | |
122 | <p> | |
123 | bracket_and_solve_root | |
124 | </p> | |
125 | </td> | |
126 | <td> | |
127 | <p> | |
128 | 12 | |
129 | </p> | |
130 | </td> | |
131 | <td> | |
132 | <p> | |
133 | 8 | |
134 | </p> | |
135 | </td> | |
136 | <td> | |
137 | <p> | |
138 | 8 | |
139 | </p> | |
140 | </td> | |
141 | <td> | |
142 | <p> | |
143 | 10 | |
144 | </p> | |
145 | </td> | |
146 | <td> | |
147 | <p> | |
148 | 11 | |
149 | </p> | |
150 | </td> | |
151 | <td> | |
152 | <p> | |
153 | 11 | |
154 | </p> | |
155 | </td> | |
156 | <td> | |
157 | <p> | |
158 | 11 | |
159 | </p> | |
160 | </td> | |
161 | <td> | |
162 | <p> | |
163 | 11 | |
164 | </p> | |
165 | </td> | |
166 | <td> | |
167 | <p> | |
168 | 11 | |
169 | </p> | |
170 | </td> | |
171 | <td> | |
172 | <p> | |
173 | 11 | |
174 | </p> | |
175 | </td> | |
176 | <td> | |
177 | <p> | |
178 | 7 | |
179 | </p> | |
180 | </td> | |
181 | <td> | |
182 | <p> | |
183 | 13 | |
184 | </p> | |
185 | </td> | |
186 | </tr> | |
187 | <tr> | |
188 | <td> | |
189 | <p> | |
190 | newton_iterate | |
191 | </p> | |
192 | </td> | |
193 | <td> | |
194 | <p> | |
195 | 12 | |
196 | </p> | |
197 | </td> | |
198 | <td> | |
199 | <p> | |
200 | 7 | |
201 | </p> | |
202 | </td> | |
203 | <td> | |
204 | <p> | |
205 | 7 | |
206 | </p> | |
207 | </td> | |
208 | <td> | |
209 | <p> | |
210 | 5 | |
211 | </p> | |
212 | </td> | |
213 | <td> | |
214 | <p> | |
215 | 5 | |
216 | </p> | |
217 | </td> | |
218 | <td> | |
219 | <p> | |
220 | 4 | |
221 | </p> | |
222 | </td> | |
223 | <td> | |
224 | <p> | |
225 | 4 | |
226 | </p> | |
227 | </td> | |
228 | <td> | |
229 | <p> | |
230 | 5 | |
231 | </p> | |
232 | </td> | |
233 | <td> | |
234 | <p> | |
235 | 5 | |
236 | </p> | |
237 | </td> | |
238 | <td> | |
239 | <p> | |
240 | 6 | |
241 | </p> | |
242 | </td> | |
243 | <td> | |
244 | <p> | |
245 | 7 | |
246 | </p> | |
247 | </td> | |
248 | <td> | |
249 | <p> | |
250 | 9 | |
251 | </p> | |
252 | </td> | |
253 | </tr> | |
254 | <tr> | |
255 | <td> | |
256 | <p> | |
257 | halley_iterate | |
258 | </p> | |
259 | </td> | |
260 | <td> | |
261 | <p> | |
262 | 7 | |
263 | </p> | |
264 | </td> | |
265 | <td> | |
266 | <p> | |
267 | 4 | |
268 | </p> | |
269 | </td> | |
270 | <td> | |
271 | <p> | |
272 | 4 | |
273 | </p> | |
274 | </td> | |
275 | <td> | |
276 | <p> | |
277 | 3 | |
278 | </p> | |
279 | </td> | |
280 | <td> | |
281 | <p> | |
282 | 3 | |
283 | </p> | |
284 | </td> | |
285 | <td> | |
286 | <p> | |
287 | 3 | |
288 | </p> | |
289 | </td> | |
290 | <td> | |
291 | <p> | |
292 | 3 | |
293 | </p> | |
294 | </td> | |
295 | <td> | |
296 | <p> | |
297 | 3 | |
298 | </p> | |
299 | </td> | |
300 | <td> | |
301 | <p> | |
302 | 3 | |
303 | </p> | |
304 | </td> | |
305 | <td> | |
306 | <p> | |
307 | 4 | |
308 | </p> | |
309 | </td> | |
310 | <td> | |
311 | <p> | |
312 | 4 | |
313 | </p> | |
314 | </td> | |
315 | <td> | |
316 | <p> | |
317 | 6 | |
318 | </p> | |
319 | </td> | |
320 | </tr> | |
321 | <tr> | |
322 | <td> | |
323 | <p> | |
324 | schroder_iterate | |
325 | </p> | |
326 | </td> | |
327 | <td> | |
328 | <p> | |
329 | 11 | |
330 | </p> | |
331 | </td> | |
332 | <td> | |
333 | <p> | |
334 | 6 | |
335 | </p> | |
336 | </td> | |
337 | <td> | |
338 | <p> | |
339 | 6 | |
340 | </p> | |
341 | </td> | |
342 | <td> | |
343 | <p> | |
344 | 4 | |
345 | </p> | |
346 | </td> | |
347 | <td> | |
348 | <p> | |
349 | 3 | |
350 | </p> | |
351 | </td> | |
352 | <td> | |
353 | <p> | |
354 | 3 | |
355 | </p> | |
356 | </td> | |
357 | <td> | |
358 | <p> | |
359 | 3 | |
360 | </p> | |
361 | </td> | |
362 | <td> | |
363 | <p> | |
364 | 3 | |
365 | </p> | |
366 | </td> | |
367 | <td> | |
368 | <p> | |
369 | 4 | |
370 | </p> | |
371 | </td> | |
372 | <td> | |
373 | <p> | |
374 | 5 | |
375 | </p> | |
376 | </td> | |
377 | <td> | |
378 | <p> | |
379 | 5 | |
380 | </p> | |
381 | </td> | |
382 | <td> | |
383 | <p> | |
384 | 8 | |
385 | </p> | |
386 | </td> | |
387 | </tr> | |
388 | </tbody> | |
389 | </table></div> | |
390 | <p> | |
391 | As you can see <code class="computeroutput"><span class="identifier">bracket_and_solve_root</span></code> | |
392 | is relatively insensitive to starting location - as long as you don't start | |
393 | many orders of magnitude away from the root it will take roughly the same | |
394 | number of steps to bracket the root and solve it. On the other hand the derivative-based | |
395 | methods are slow to start, but once they have some digits correct they increase | |
396 | precision exceptionally fast: they are therefore quite sensitive to the initial | |
397 | starting location. | |
398 | </p> | |
399 | <p> | |
400 | The next table shows the number of iterations required to find the second | |
401 | radius of an ellipse with first radius 50 and arc-length 500: | |
402 | </p> | |
403 | <div class="informaltable"><table class="table"> | |
404 | <colgroup> | |
405 | <col> | |
406 | <col> | |
407 | <col> | |
408 | <col> | |
409 | <col> | |
410 | <col> | |
411 | <col> | |
412 | <col> | |
413 | <col> | |
414 | <col> | |
415 | <col> | |
416 | <col> | |
417 | <col> | |
418 | </colgroup> | |
419 | <thead><tr> | |
420 | <th> | |
421 | <p> | |
422 | Initial Guess= | |
423 | </p> | |
424 | </th> | |
425 | <th> | |
426 | <p> | |
427 | -500% (≈20.6) | |
428 | </p> | |
429 | </th> | |
430 | <th> | |
431 | <p> | |
432 | -100% (≈61.81) | |
433 | </p> | |
434 | </th> | |
435 | <th> | |
436 | <p> | |
437 | -50% (≈61.81) | |
438 | </p> | |
439 | </th> | |
440 | <th> | |
441 | <p> | |
442 | -20% (≈98.9) | |
443 | </p> | |
444 | </th> | |
445 | <th> | |
446 | <p> | |
447 | -10% (≈111.3) | |
448 | </p> | |
449 | </th> | |
450 | <th> | |
451 | <p> | |
452 | -5% (≈117.4) | |
453 | </p> | |
454 | </th> | |
455 | <th> | |
456 | <p> | |
457 | 5% (≈129.8) | |
458 | </p> | |
459 | </th> | |
460 | <th> | |
461 | <p> | |
462 | 10% (≈136) | |
463 | </p> | |
464 | </th> | |
465 | <th> | |
466 | <p> | |
467 | 20% (≈148.3) | |
468 | </p> | |
469 | </th> | |
470 | <th> | |
471 | <p> | |
472 | 50% (≈185.4) | |
473 | </p> | |
474 | </th> | |
475 | <th> | |
476 | <p> | |
477 | 100% (≈247.2) | |
478 | </p> | |
479 | </th> | |
480 | <th> | |
481 | <p> | |
482 | 500 (≈741.7) | |
483 | </p> | |
484 | </th> | |
485 | </tr></thead> | |
486 | <tbody> | |
487 | <tr> | |
488 | <td> | |
489 | <p> | |
490 | bracket_and_solve_root | |
491 | </p> | |
492 | </td> | |
493 | <td> | |
494 | <p> | |
495 | 11 | |
496 | </p> | |
497 | </td> | |
498 | <td> | |
499 | <p> | |
500 | 5 | |
501 | </p> | |
502 | </td> | |
503 | <td> | |
504 | <p> | |
505 | 5 | |
506 | </p> | |
507 | </td> | |
508 | <td> | |
509 | <p> | |
510 | 8 | |
511 | </p> | |
512 | </td> | |
513 | <td> | |
514 | <p> | |
515 | 8 | |
516 | </p> | |
517 | </td> | |
518 | <td> | |
519 | <p> | |
520 | 7 | |
521 | </p> | |
522 | </td> | |
523 | <td> | |
524 | <p> | |
525 | 7 | |
526 | </p> | |
527 | </td> | |
528 | <td> | |
529 | <p> | |
530 | 8 | |
531 | </p> | |
532 | </td> | |
533 | <td> | |
534 | <p> | |
535 | 9 | |
536 | </p> | |
537 | </td> | |
538 | <td> | |
539 | <p> | |
540 | 8 | |
541 | </p> | |
542 | </td> | |
543 | <td> | |
544 | <p> | |
545 | 6 | |
546 | </p> | |
547 | </td> | |
548 | <td> | |
549 | <p> | |
550 | 10 | |
551 | </p> | |
552 | </td> | |
553 | </tr> | |
554 | <tr> | |
555 | <td> | |
556 | <p> | |
557 | newton_iterate | |
558 | </p> | |
559 | </td> | |
560 | <td> | |
561 | <p> | |
562 | 4 | |
563 | </p> | |
564 | </td> | |
565 | <td> | |
566 | <p> | |
567 | 4 | |
568 | </p> | |
569 | </td> | |
570 | <td> | |
571 | <p> | |
572 | 4 | |
573 | </p> | |
574 | </td> | |
575 | <td> | |
576 | <p> | |
577 | 3 | |
578 | </p> | |
579 | </td> | |
580 | <td> | |
581 | <p> | |
582 | 3 | |
583 | </p> | |
584 | </td> | |
585 | <td> | |
586 | <p> | |
587 | 3 | |
588 | </p> | |
589 | </td> | |
590 | <td> | |
591 | <p> | |
592 | 3 | |
593 | </p> | |
594 | </td> | |
595 | <td> | |
596 | <p> | |
597 | 3 | |
598 | </p> | |
599 | </td> | |
600 | <td> | |
601 | <p> | |
602 | 3 | |
603 | </p> | |
604 | </td> | |
605 | <td> | |
606 | <p> | |
607 | 4 | |
608 | </p> | |
609 | </td> | |
610 | <td> | |
611 | <p> | |
612 | 4 | |
613 | </p> | |
614 | </td> | |
615 | <td> | |
616 | <p> | |
617 | 4 | |
618 | </p> | |
619 | </td> | |
620 | </tr> | |
621 | <tr> | |
622 | <td> | |
623 | <p> | |
624 | halley_iterate | |
625 | </p> | |
626 | </td> | |
627 | <td> | |
628 | <p> | |
629 | 4 | |
630 | </p> | |
631 | </td> | |
632 | <td> | |
633 | <p> | |
634 | 3 | |
635 | </p> | |
636 | </td> | |
637 | <td> | |
638 | <p> | |
639 | 3 | |
640 | </p> | |
641 | </td> | |
642 | <td> | |
643 | <p> | |
644 | 3 | |
645 | </p> | |
646 | </td> | |
647 | <td> | |
648 | <p> | |
649 | 3 | |
650 | </p> | |
651 | </td> | |
652 | <td> | |
653 | <p> | |
654 | 2 | |
655 | </p> | |
656 | </td> | |
657 | <td> | |
658 | <p> | |
659 | 2 | |
660 | </p> | |
661 | </td> | |
662 | <td> | |
663 | <p> | |
664 | 3 | |
665 | </p> | |
666 | </td> | |
667 | <td> | |
668 | <p> | |
669 | 3 | |
670 | </p> | |
671 | </td> | |
672 | <td> | |
673 | <p> | |
674 | 3 | |
675 | </p> | |
676 | </td> | |
677 | <td> | |
678 | <p> | |
679 | 3 | |
680 | </p> | |
681 | </td> | |
682 | <td> | |
683 | <p> | |
684 | 3 | |
685 | </p> | |
686 | </td> | |
687 | </tr> | |
688 | <tr> | |
689 | <td> | |
690 | <p> | |
691 | schroder_iterate | |
692 | </p> | |
693 | </td> | |
694 | <td> | |
695 | <p> | |
696 | 4 | |
697 | </p> | |
698 | </td> | |
699 | <td> | |
700 | <p> | |
701 | 3 | |
702 | </p> | |
703 | </td> | |
704 | <td> | |
705 | <p> | |
706 | 3 | |
707 | </p> | |
708 | </td> | |
709 | <td> | |
710 | <p> | |
711 | 3 | |
712 | </p> | |
713 | </td> | |
714 | <td> | |
715 | <p> | |
716 | 3 | |
717 | </p> | |
718 | </td> | |
719 | <td> | |
720 | <p> | |
721 | 2 | |
722 | </p> | |
723 | </td> | |
724 | <td> | |
725 | <p> | |
726 | 2 | |
727 | </p> | |
728 | </td> | |
729 | <td> | |
730 | <p> | |
731 | 3 | |
732 | </p> | |
733 | </td> | |
734 | <td> | |
735 | <p> | |
736 | 3 | |
737 | </p> | |
738 | </td> | |
739 | <td> | |
740 | <p> | |
741 | 3 | |
742 | </p> | |
743 | </td> | |
744 | <td> | |
745 | <p> | |
746 | 3 | |
747 | </p> | |
748 | </td> | |
749 | <td> | |
750 | <p> | |
751 | 3 | |
752 | </p> | |
753 | </td> | |
754 | </tr> | |
755 | </tbody> | |
756 | </table></div> | |
757 | <p> | |
758 | Interestingly this function is much more resistant to a poor initial guess | |
759 | when using derivatives. | |
760 | </p> | |
761 | </div> | |
762 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> | |
763 | <td align="left"></td> | |
764 | <td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal, | |
765 | Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert | |
766 | Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani, | |
767 | Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p> | |
768 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
769 | file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) | |
770 | </p> | |
771 | </div></td> | |
772 | </tr></table> | |
773 | <hr> | |
774 | <div class="spirit-nav"> | |
775 | <a accesskey="p" href="root_finding_examples/elliptic_eg.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../roots.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="bad_roots.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> | |
776 | </div> | |
777 | </body> | |
778 | </html> |