{"id":878,"date":"2003-07-01T22:33:25","date_gmt":"2003-07-01T22:33:25","guid":{"rendered":"http:\/\/lewisdartnell.com\/en-gb\/?p=878"},"modified":"2003-07-01T22:33:25","modified_gmt":"2003-07-01T22:33:25","slug":"runge-kutta-and-the-lorenz-attractor","status":"publish","type":"post","link":"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/","title":{"rendered":"Runge-Kutta and the Lorenz Attractor"},"content":{"rendered":"<p><a href=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_eq.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-883\" alt=\"Lorenz_eq\" src=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_eq.jpg\" width=\"111\" height=\"107\" \/><\/a>The Lorenz equations are a set of three coupled non-linear ordinary differential equations (ODE). They make up a simplified system describing the two-dimensional flow of a fluid. As can be seen, the derivative of all three variables is given with respect to\u00a0<i>t<\/i>, and as a function involving one or both of the other variables (thus they are said to be coupled). The usual values taken by the parameters are as follows:<\/p>\n<p style=\"text-align: center;\">sigma = 10, r = 28, and b = 8\/3.<\/p>\n<p>As time is incremented then, the calculated values of x, y, z change as shown in the timeseries plot below. x = red, y = green, z = blue.<\/p>\n<p><a href=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/xyz_timeseries.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-890\" alt=\"xyz_timeseries\" src=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/xyz_timeseries.jpg\" width=\"600\" height=\"371\" srcset=\"http:\/\/lewisdartnell.com\/en-gb\/wp-content\/uploads\/2013\/11\/xyz_timeseries.jpg 600w, http:\/\/lewisdartnell.com\/en-gb\/wp-content\/uploads\/2013\/11\/xyz_timeseries-300x185.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_timeseries.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-887\" alt=\"Lorenz_timeseries\" src=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_timeseries.gif\" width=\"267\" height=\"252\" \/><\/a>The fluctuations are seemingly utterly random. More structure can be seen, however, if the same timeseries is plotted as a sequence of co-ordinates describing a trajectory through 3-space. As shown to the right, the surface resembles a twisted bow-tie. It is known as the Lorenz strange attractor, and no equilibrium (dynamic or static) is ever reached &#8211; it does not form limit cycles or achieve a steady state. Thus, no trajectory ever coincides with any other. Instead, it is an example of deterministic chaos, one of the first realised by mathematicians.<\/p>\n<p>One of the properties of a chaotic system is that it is sensitive to initial conditions. This means that no matter how close two different initial states are (i.e. even down to the 20th decimal place) their trajectories will soon diverge. This is popularly referred to as the &#8220;Butterfly Effect&#8221;, whereby small changes in the initial state can lead to rapid and dramatic differences in the outcome. The metaphor is that a butterfly flapping its wings in Brazil could result in a tornado in Texas.<\/p>\n<p><a href=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_big.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-882\" alt=\"Lorenz_big\" src=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_big.jpg\" width=\"562\" height=\"504\" srcset=\"http:\/\/lewisdartnell.com\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_big.jpg 562w, http:\/\/lewisdartnell.com\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_big-300x269.jpg 300w\" sizes=\"auto, (max-width: 562px) 100vw, 562px\" \/><\/a><\/p>\n<p>The Lorenz equations cannot be solved analytically by integration. Instead, a numerical approximation technique must be used. The 4<sup>th<\/sup>\u00a0order Runge-Kutta (RK) method employed here takes a weighted average of four estimates of the derivative at a point in order to calculate the new position after a time increment. The lower-order error terms cancel out, making RK very robust despite its simplicity.<\/p>\n<p><a href=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Runge-Kutta1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-888\" alt=\"Runge-Kutta1\" src=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Runge-Kutta1.jpg\" width=\"117\" height=\"155\" \/><\/a>To generate all of these images and animations, a\u00a0<i>Mathematica<\/i>\u00a0programme was written to perform the RK numerical analysis of the Lorenz equations. For the initial state, an arbitrary point in 3-space,\u00a0<i>u<sub>t<\/sub><\/i>\u00a0, is chosen, and then four derivatives calculated (A, B, C and D) using a time increment of\u00a0<i>h<\/i>. In each case, F is the three-dimensional vector function composed of the Lorenz differential equations given above. These derivatives are weighted and combined to give the approximation for the next point,\u00a0<i>u<sub>t+h<\/sub><\/i>\u00a0.<\/p>\n<p><a href=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Runge-Kutta2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-889\" alt=\"Runge-Kutta2\" src=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Runge-Kutta2.jpg\" width=\"212\" height=\"33\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>The three components of this point are appended to a storage list, and then the whole calculation reiterated a large number of times. For the high resolution image above, 100,000 co-ordinates were calculated and plotted, expending almost an hour of computer runtime. For the animation below, only 10,000 points were used.<\/p>\n<p><a href=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_anim.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-881\" alt=\"Lorenz_anim\" src=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_anim.gif\" width=\"300\" height=\"300\" \/><\/a>Once calculated, all of the points in this data list are plotted in order to visualise the Lorenz attractor. This draw command was placed in a programme loop, with the\u00a0<i>x<\/i>,\u00a0<i>y<\/i>, and\u00a0<i>z<\/i>\u00a0co-ordiantes of the viewing-point for the projection incremented each time to generate a string of images. These were then converted into an animated .gif to create the rotating attractor shown to the left.<\/p>\n<p>The animation of the trajectory through time (shown at the top) was created by calculating just 1,000 co-ordinates, starting with a point known to be near the transition region between the two lobes. Only a subset of these points were plotted each time in the draw loop, beginning with the first 5, then the first 10, first 15, 20, 25, and so on.<\/p>\n<div style=\"padding-bottom:20px; padding-top:10px;\" class=\"hupso-share-buttons\"><!-- Hupso Share Buttons - https:\/\/www.hupso.com\/share\/ --><a class=\"hupso_toolbar\" href=\"https:\/\/www.hupso.com\/share\/\"><img decoding=\"async\" src=\"http:\/\/static.hupso.com\/share\/buttons\/share-medium.png\" style=\"border:0px; padding-top: 5px; float:left;\" alt=\"Share Button\"\/><\/a><script type=\"text\/javascript\">var hupso_services_t=new Array(\"Twitter\",\"Facebook\",\"Google Plus\",\"StumbleUpon\");var hupso_background_t=\"#EAF4FF\";var hupso_border_t=\"#66CCFF\";var hupso_toolbar_size_t=\"medium\";var hupso_image_folder_url = \"\";var hupso_twitter_via=\"Lewis_Dartnell\";var hupso_url_t=\"\";var hupso_title_t=\"Runge-Kutta%20and%20the%20Lorenz%20Attractor\";<\/script><script type=\"text\/javascript\" src=\"http:\/\/static.hupso.com\/share\/js\/share_toolbar.js\"><\/script><!-- Hupso Share Buttons --><\/div>","protected":false},"excerpt":{"rendered":"<p>The Lorenz equations are a set of three coupled non-linear ordinary differential equations (ODE). They make up a simplified system describing the two-dimensional flow of a fluid. As can be seen, the derivative of all three variables is given with respect to\u00a0t, and as a function involving one or both of the other variables (thus [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[2,10],"tags":[],"class_list":["post-878","post","type-post","status-publish","format-standard","hentry","category-academic-work","category-postgraduate"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Runge-Kutta and the Lorenz Attractor - Lewis Dartnell<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Runge-Kutta and the Lorenz Attractor - Lewis Dartnell\" \/>\n<meta property=\"og:description\" content=\"The Lorenz equations are a set of three coupled non-linear ordinary differential equations (ODE). They make up a simplified system describing the two-dimensional flow of a fluid. As can be seen, the derivative of all three variables is given with respect to\u00a0t, and as a function involving one or both of the other variables (thus [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/\" \/>\n<meta property=\"og:site_name\" content=\"Lewis Dartnell\" \/>\n<meta property=\"article:published_time\" content=\"2003-07-01T22:33:25+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_eq.jpg\" \/>\n<meta name=\"author\" content=\"lewis\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"lewis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/\",\"url\":\"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/\",\"name\":\"Runge-Kutta and the Lorenz Attractor - Lewis Dartnell\",\"isPartOf\":{\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_eq.jpg\",\"datePublished\":\"2003-07-01T22:33:25+00:00\",\"author\":{\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/#\/schema\/person\/f6217bd00be700085b5554a26f8b3732\"},\"breadcrumb\":{\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/#primaryimage\",\"url\":\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_eq.jpg\",\"contentUrl\":\"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_eq.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/lewisdartnell.com\/en-gb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Runge-Kutta and the Lorenz Attractor\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/#website\",\"url\":\"http:\/\/lewisdartnell.com\/en-gb\/\",\"name\":\"Lewis Dartnell\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/lewisdartnell.com\/en-gb\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/#\/schema\/person\/f6217bd00be700085b5554a26f8b3732\",\"name\":\"lewis\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/lewisdartnell.com\/en-gb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/982e96b77e48c2710145f5fb186d1eebc865aa8f5caddaea617d468202c0815b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/982e96b77e48c2710145f5fb186d1eebc865aa8f5caddaea617d468202c0815b?s=96&d=mm&r=g\",\"caption\":\"lewis\"},\"url\":\"http:\/\/lewisdartnell.com\/en-gb\/author\/lewis\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Runge-Kutta and the Lorenz Attractor - Lewis Dartnell","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/","og_locale":"en_US","og_type":"article","og_title":"Runge-Kutta and the Lorenz Attractor - Lewis Dartnell","og_description":"The Lorenz equations are a set of three coupled non-linear ordinary differential equations (ODE). They make up a simplified system describing the two-dimensional flow of a fluid. As can be seen, the derivative of all three variables is given with respect to\u00a0t, and as a function involving one or both of the other variables (thus [&hellip;]","og_url":"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/","og_site_name":"Lewis Dartnell","article_published_time":"2003-07-01T22:33:25+00:00","og_image":[{"url":"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_eq.jpg","type":"","width":"","height":""}],"author":"lewis","twitter_card":"summary_large_image","twitter_misc":{"Written by":"lewis","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/","url":"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/","name":"Runge-Kutta and the Lorenz Attractor - Lewis Dartnell","isPartOf":{"@id":"http:\/\/lewisdartnell.com\/en-gb\/#website"},"primaryImageOfPage":{"@id":"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/#primaryimage"},"image":{"@id":"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/#primaryimage"},"thumbnailUrl":"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_eq.jpg","datePublished":"2003-07-01T22:33:25+00:00","author":{"@id":"http:\/\/lewisdartnell.com\/en-gb\/#\/schema\/person\/f6217bd00be700085b5554a26f8b3732"},"breadcrumb":{"@id":"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/#primaryimage","url":"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_eq.jpg","contentUrl":"http:\/\/lewis.dsruptiv.net\/en-gb\/wp-content\/uploads\/2013\/11\/Lorenz_eq.jpg"},{"@type":"BreadcrumbList","@id":"http:\/\/lewisdartnell.com\/en-gb\/2003\/07\/runge-kutta-and-the-lorenz-attractor\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/lewisdartnell.com\/en-gb\/"},{"@type":"ListItem","position":2,"name":"Runge-Kutta and the Lorenz Attractor"}]},{"@type":"WebSite","@id":"http:\/\/lewisdartnell.com\/en-gb\/#website","url":"http:\/\/lewisdartnell.com\/en-gb\/","name":"Lewis Dartnell","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/lewisdartnell.com\/en-gb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/lewisdartnell.com\/en-gb\/#\/schema\/person\/f6217bd00be700085b5554a26f8b3732","name":"lewis","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/lewisdartnell.com\/en-gb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/982e96b77e48c2710145f5fb186d1eebc865aa8f5caddaea617d468202c0815b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/982e96b77e48c2710145f5fb186d1eebc865aa8f5caddaea617d468202c0815b?s=96&d=mm&r=g","caption":"lewis"},"url":"http:\/\/lewisdartnell.com\/en-gb\/author\/lewis\/"}]}},"_links":{"self":[{"href":"http:\/\/lewisdartnell.com\/en-gb\/wp-json\/wp\/v2\/posts\/878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/lewisdartnell.com\/en-gb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/lewisdartnell.com\/en-gb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/lewisdartnell.com\/en-gb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/lewisdartnell.com\/en-gb\/wp-json\/wp\/v2\/comments?post=878"}],"version-history":[{"count":0,"href":"http:\/\/lewisdartnell.com\/en-gb\/wp-json\/wp\/v2\/posts\/878\/revisions"}],"wp:attachment":[{"href":"http:\/\/lewisdartnell.com\/en-gb\/wp-json\/wp\/v2\/media?parent=878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/lewisdartnell.com\/en-gb\/wp-json\/wp\/v2\/categories?post=878"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/lewisdartnell.com\/en-gb\/wp-json\/wp\/v2\/tags?post=878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}