{"id":26647,"date":"2016-01-16T16:01:45","date_gmt":"2016-01-16T21:01:45","guid":{"rendered":"http:\/\/blogs.ams.org\/mathgradblog\/?p=26647"},"modified":"2016-01-31T22:52:10","modified_gmt":"2016-02-01T03:52:10","slug":"visualizing-newtons-method","status":"publish","type":"post","link":"https:\/\/blogs.ams.org\/mathgradblog\/2016\/01\/16\/visualizing-newtons-method\/","title":{"rendered":"Visualizing Newton&#8217;s Method"},"content":{"rendered":"<p>Well for most of us winter break is coming to an end, or for the unlucky, might have already ended, which means its time to start thinking about teaching again. One of the topics commonly covered in a first or second semester of calculus is the use of Newton\u2019s method to approximate roots of functions. Recall the basic approach of Newton\u2019s method is that given a real valued differentiable function <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=f&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"f\" class=\"latex\" \/> and an initial condition <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=x_0&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"x_0\" class=\"latex\" \/> we let<\/p>\n<p>$$x_n=x_{n-1}-\\frac{f(x_{n-1})}{f\u2019(x_{n-1})},$$<\/p>\n<p>and then, under certain assumptions, <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=x_n&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"x_n\" class=\"latex\" \/> should converge to a root of <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=f&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"f\" class=\"latex\" \/>.<\/p>\n<p>When I\u2019ve taught Newton\u2019s method, I tried to stress that this method is not guaranteed to always work and can be fairly sensitive to the initial condition <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=x_0&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"x_0\" class=\"latex\" \/>. Going into the precise details of when the method will in fact work is well beyond my first semester calculus students. That said, I am not sure they\u2019ve ever really appreciated these points. In fact, to be completely honest, I am not sure I completely appreciated some of the aspects of these things before I started teaching.<\/p>\n<p>That said, one way to visualize some of these complexities is via a cool program called FractalStream. For example, using <a href=\"http:\/\/www.math.cornell.edu\/~noonan\/fstream.html\">FractalStream<\/a>, we can run the following script:<\/p>\n<blockquote><p>iterate z &#8211; (z^3 &#8211; 1)\/(3*z^2) until z stops.<\/p><\/blockquote>\n<p>and then turn on autocoloring \u2013 under the color settings \u2013 and we get the following interesting picture of the complex plane colored red, blue, and green:<\/p>\n<div id=\"attachment_26648\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-2.37.03-PM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-26648\" class=\"size-medium wp-image-26648\" src=\"http:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-2.37.03-PM-300x218.png\" alt=\"Newton's method plot for z^3-1.\" width=\"300\" height=\"218\" srcset=\"https:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-2.37.03-PM-300x218.png 300w, https:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-2.37.03-PM-1024x744.png 1024w, https:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-2.37.03-PM.png 1480w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-26648\" class=\"wp-caption-text\">Newton&#8217;s method plot for z^3-1.<\/p><\/div>\n<p><!--more-->Given the above\u00a0script, FractalStream takes each point in the complex plane and iterates it under the given map until the sequence seems to stops. It then colors that initial\u00a0point depending on where the sequence of iterates ended. That is to say, since we chose to iterate the function:<\/p>\n<p>$$N(z)=z-\\frac{z^3-1}{3z^2}$$<\/p>\n<p>the above script actually performs Newton\u2019s method using the polynomial <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=z%5E3-1&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"z^3-1\" class=\"latex\" \/> for each initial value <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=x_0&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"x_0\" class=\"latex\" \/> and labels each value by which root we end at (assuming we end at a root).<\/p>\n<p>In the above example, we see there are three colors since <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=z%5E3-1&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"z^3-1\" class=\"latex\" \/> has three roots. Specifically green corresponds to the root 1, blue to <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=%28-1%29%5E%7B2%2F3%7D&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"(-1)^{2\/3}\" class=\"latex\" \/>, and finally red to the root <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=-%5Csqrt%5B3%5D%7B-1%7D&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"-&#92;sqrt[3]{-1}\" class=\"latex\" \/>. Notice that while there is a large area round each root in which Newton\u2019s method converges quickly to that root the areas sort of between each root show more complex behavior. In particular, in this region we see just how sensitive to the initial condition Newton\u2019s method becomes. Additionally, using the orbit tool in FractalStream we get a sense that points in this region take longer to converge:<\/p>\n<div id=\"attachment_26649\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-1.45.29-PM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-26649\" class=\"size-medium wp-image-26649\" src=\"http:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-1.45.29-PM-300x239.png\" alt=\"Forward iterates of a point converge to a root of z^3-1 under Newton's method.\" width=\"300\" height=\"239\" srcset=\"https:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-1.45.29-PM-300x239.png 300w, https:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-1.45.29-PM-1024x816.png 1024w, https:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-1.45.29-PM.png 1486w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-26649\" class=\"wp-caption-text\">Forward iterates of a point converge to a root of z^3-1 under Newton&#8217;s method.<\/p><\/div>\n<p>In this picture the white dot marks each forward iterate under the map <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=N%28z%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"N(z)\" class=\"latex\" \/> of the point chosen.<\/p>\n<p>We can create similar plots for other polynomials as well. For example, the plot for <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=z%5E3-3z&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"z^3-3z\" class=\"latex\" \/> looks quite a bit different than the one for <img decoding=\"async\" src=\"https:\/\/s0.wp.com\/latex.php?latex=z%5E3-1&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"z^3-1\" class=\"latex\" \/> &#8212; in part because all the roots are real.<\/p>\n<div id=\"attachment_26650\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-1.48.46-PM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-26650\" class=\"size-medium wp-image-26650\" src=\"http:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-1.48.46-PM-300x238.png\" alt=\"Newton's method plot for z^3-2z.\" width=\"300\" height=\"238\" srcset=\"https:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-1.48.46-PM-300x238.png 300w, https:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-1.48.46-PM-1024x811.png 1024w, https:\/\/blogs.ams.org\/mathgradblog\/files\/2016\/01\/Screen-Shot-2016-01-16-at-1.48.46-PM.png 1490w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-26650\" class=\"wp-caption-text\">Newton&#8217;s method plot for z^3-3z.<\/p><\/div>\n<p>It&#8217;s pretty fun just playing around with what plots various polynomials produce!<\/p>\n<p>Why these pictures look the way they do has to do with complex dynamics, which is a really awesome subject. If you want to learn more about these pictures and what is going on you might want to check out either <em>Dynamics in One Complex<\/em> <em>Variable<\/em> by Milnor or <em>Complex Dynamics<\/em> by Carleson and Gamelin. However, even for those not interested in complex dynamics these pictures might be something fun to show your students next time you teach Newton\u2019s method!<\/p>\n<div style=\"margin-top: 0px; margin-bottom: 0px;\" class=\"sharethis-inline-share-buttons\" ><\/div>","protected":false},"excerpt":{"rendered":"<p>Well for most of us winter break is coming to an end, or for the unlucky, might have already ended, which means its time to start thinking about teaching again. One of the topics commonly covered in a first or &hellip; <a href=\"https:\/\/blogs.ams.org\/mathgradblog\/2016\/01\/16\/visualizing-newtons-method\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n<div style=\"margin-top: 0px; margin-bottom: 0px;\" class=\"sharethis-inline-share-buttons\" data-url=https:\/\/blogs.ams.org\/mathgradblog\/2016\/01\/16\/visualizing-newtons-method\/><\/div>\n","protected":false},"author":96,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[12,158,157,20,1],"tags":[159,161,126,160],"class_list":["post-26647","post","type-post","status-publish","format-standard","hentry","category-math","category-math-education","category-math-teaching","category-teaching","category-uncategorized","tag-fractal","tag-pictures","tag-teaching","tag-visualization"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3gbww-6VN","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/posts\/26647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/users\/96"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/comments?post=26647"}],"version-history":[{"count":11,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/posts\/26647\/revisions"}],"predecessor-version":[{"id":26758,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/posts\/26647\/revisions\/26758"}],"wp:attachment":[{"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/media?parent=26647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/categories?post=26647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.ams.org\/mathgradblog\/wp-json\/wp\/v2\/tags?post=26647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}