{"id":6141,"date":"2019-05-13T00:31:25","date_gmt":"2019-05-13T04:31:25","guid":{"rendered":"http:\/\/pages.vassar.edu\/magnes\/?p=6141"},"modified":"2019-05-13T01:11:11","modified_gmt":"2019-05-13T05:11:11","slug":"modeling-the-n-body-problem","status":"publish","type":"post","link":"https:\/\/pages.vassar.edu\/magnes\/2019\/05\/13\/modeling-the-n-body-problem\/","title":{"rendered":"Modeling the N-Body Problem"},"content":{"rendered":"<p>In this project, I focused on creating a program which would model the motion of any system of any number of objects interacting gravitationally. I used this project as a way to become more comfortable with computational methods we&#8217;ve already explored in class, to expand upon them, and to become more comfortable with the actual modeling and animation process, so that I can become more skilled in presenting the information I gather computationally. I was also attracted to this subject matter, because the generalized form I developed it for allows me to learn something new every time I plot it, exploring new systems every time.<\/p>\n<p><strong>Background<\/strong><\/p>\n<p>The \u201cN-body problem\u201d is one that has plagued physicists since Newton\u2019s times. Newtonian\/Classical gravity is defined by<span class=\"Apple-converted-space\">\u00a0<\/span><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.06.10-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6340 aligncenter\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.06.10-AM-300x131.png\" alt=\"\" width=\"130\" height=\"57\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.06.10-AM-300x131.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.06.10-AM.png 354w\" sizes=\"auto, (max-width: 130px) 100vw, 130px\" \/><\/a>The behavior of two objects, interacting through Newtonian gravity, is well understood, easy to analyze by hand, and easy to model. However, as we increase the number of objects in our system, the problem immediately becomes far more complicated. People have studied the n-body problem for centuries, searching for a solution. In the late 19th century, the king of Sweden offered a prize to anyone who could find a general solution to the n-body problem. This challenge was left unmet, and the award went to Poincar\u00e9 for an unrelated accomplishment. In more recent times, understanding the n-body problem has become far more feasible with technological advancements and the associated rise of computational physics. While there is no analytical solution to the n-body problem for 3 or more bodies, we can use computational methods to model and better understand gravitational interactions between celestial bodies and their resulting behavior.<\/p>\n<p>We begin this analysis of gravitational interactions using the formula for gravitational force in conjunction with Newton\u2019s Second Law.<\/p>\n<p>From this, we get<a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.09.17-AM-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-6342 aligncenter\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.09.17-AM-1.png\" alt=\"\" width=\"142\" height=\"73\" \/><\/a>To analyze this behavior, we must examine the system component by component. This results in the rate of change for velocity<a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.12.37-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-6343 aligncenter\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.12.37-AM-300x200.png\" alt=\"\" width=\"158\" height=\"105\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.12.37-AM-300x200.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.12.37-AM.png 418w\" sizes=\"auto, (max-width: 158px) 100vw, 158px\" \/><\/a><\/p>\n<p>This velocity rate of changes allow us to analyze the position of all of the celestial bodies in our system, since<a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.14.27-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-6344 aligncenter\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.14.27-AM.png\" alt=\"\" width=\"88\" height=\"122\" \/><\/a><\/p>\n<p><strong>Method<\/strong><\/p>\n<p><em>Equations of Motion<\/em><\/p>\n<p>To model the n-body problem, I start by creating a set of input variables. This allows to me to create a very general program which should run whether we examine a system of 1 celestial body, 10, or 100. The program allows the input of number of bodies in the system, mass, initial position, initial speed, and initial direction of motion for each body.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<div id=\"attachment_6346\" style=\"width: 468px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.17.06-AM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6346\" class=\" wp-image-6346\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.17.06-AM-300x182.png\" alt=\"\" width=\"458\" height=\"278\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.17.06-AM-300x182.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.17.06-AM-768x466.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.17.06-AM-1024x621.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.17.06-AM-624x379.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.17.06-AM.png 1292w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/a><p id=\"caption-attachment-6346\" class=\"wp-caption-text\">This is the code for collecting information from the user of the program. This excerpt of code applies to all objects other than the first.<\/p><\/div>\n<p>Once the inputs have been obtained, we can proceed with the Euler-Cromer method to analyze the motions of however many bodies.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>The Euler-Cromer method uses a known rate of change for some desired variable, and adds the product of the rate of change with some step of the independent variable, to approximate some behavior. The distinction between the Euler-Cromer and Euler methods lies the fact that Euler-Cromer uses a newly calculated rate of change to calculate the new position. The Euler-Cromer method is effective for 2nd order differential equations, such as this case, where the Euler method fails. In the case of the n-body problem, this method takes the following form:<a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.22.04-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-6349 aligncenter\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.22.04-AM-300x243.png\" alt=\"\" width=\"222\" height=\"180\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.22.04-AM-300x243.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.22.04-AM-624x506.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.22.04-AM.png 634w\" sizes=\"auto, (max-width: 222px) 100vw, 222px\" \/><\/a><\/p>\n<p>However, the above form only accounts for an object interacting with one other object. To address this, I summed the acceleration due to each object in my code.<\/p>\n<div id=\"attachment_6350\" style=\"width: 528px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.24.00-AM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6350\" class=\"wp-image-6350 \" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.24.00-AM-300x80.png\" alt=\"\" width=\"518\" height=\"138\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.24.00-AM-300x80.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.24.00-AM-768x204.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.24.00-AM-1024x272.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.24.00-AM-624x166.png 624w\" sizes=\"auto, (max-width: 518px) 100vw, 518px\" \/><\/a><p id=\"caption-attachment-6350\" class=\"wp-caption-text\">This excerpt of code includes the summation of the gravitational forces and their influence on each object&#8217;s velocity.<\/p><\/div>\n<p><em>Plotting\/Animation<\/em><\/p>\n<p>To understand how these interacting bodies behave, I examined their motion through graphing their paths and animating their motion. This plots demanded very little in terms of new plotting\/animation methods, but rather demanded a lot of finessing, not all of which paid off. The drawnow command in conjunction with &#8220;hold on&#8221; and &#8220;hold off&#8221; produced the animation plots, whereas the same command only with &#8220;hold on&#8221; provided the plotted paths.<\/p>\n<div id=\"attachment_6353\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.25.41-AM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6353\" class=\" wp-image-6353\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.25.41-AM-300x109.png\" alt=\"\" width=\"490\" height=\"178\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.25.41-AM-300x109.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.25.41-AM-768x279.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.25.41-AM-1024x372.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.25.41-AM-624x226.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.25.41-AM.png 1152w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><\/a><p id=\"caption-attachment-6353\" class=\"wp-caption-text\">This is the code which plots the path of each object as we cycle through each time step.<\/p><\/div>\n<div id=\"attachment_6354\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.26.01-AM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6354\" class=\" wp-image-6354\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.26.01-AM-300x106.png\" alt=\"\" width=\"490\" height=\"173\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.26.01-AM-300x106.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.26.01-AM-768x272.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.26.01-AM-1024x363.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.26.01-AM-624x221.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.26.01-AM.png 1174w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><\/a><p id=\"caption-attachment-6354\" class=\"wp-caption-text\">Here is the code which plots the animation of each object&#8217;s motion. The primary difference between this code excerpt than the previous one is the use of &#8220;hold off&#8221;.<\/p><\/div>\n<p><strong>Results<\/strong><\/p>\n<p>It is hard to comprehensively discuss the results of this program because its input-based nature leaves infinite potential results. To examine how systems of n number of celestial bodies behave, I will discuss several cases as n increases.<\/p>\n<p><em>Case 1:<\/em><\/p>\n<p>This case is the most simple and best understood in case, in which two bodies interact gravitationally. The initial conditions of this case are as follows:<\/p>\n<p><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.29-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6273\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.29-PM-300x28.png\" alt=\"\" width=\"535\" height=\"50\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.29-PM-300x28.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.29-PM-768x73.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.29-PM-1024x97.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.29-PM-624x59.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.29-PM.png 1630w\" sizes=\"auto, (max-width: 535px) 100vw, 535px\" \/><\/a><\/p>\n<p>Graphing the path of each of these objects yields the following result:<\/p>\n<div id=\"attachment_6276\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6276\" class=\"wp-image-6276 size-medium\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case1-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case1-300x225.jpg 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case1-768x576.jpg 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case1-1024x768.jpg 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case1-624x468.jpg 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case1.jpg 1120w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-6276\" class=\"wp-caption-text\">Above is the path of each individual object in Case 1, on a plot in units AU.<\/p><\/div>\n<div id=\"attachment_6277\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case1Label.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6277\" class=\"wp-image-6277 size-medium\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case1Label-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case1Label-300x225.jpg 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case1Label-768x576.jpg 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case1Label-1024x768.jpg 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case1Label-624x468.jpg 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case1Label.jpg 1120w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-6277\" class=\"wp-caption-text\">This (messy) version of the previous plot is simply to provide clarity for each individual path of the objects.<\/p><\/div>\n<p>Below is a clip of the animation for this case.<\/p>\n<div id=\"attachment_6358\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/giphy-2.gif\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6358\" class=\"size-medium wp-image-6358\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/giphy-2-300x226.gif\" alt=\"\" width=\"300\" height=\"226\" \/><\/a><p id=\"caption-attachment-6358\" class=\"wp-caption-text\">This is a 15 second clip of the animation of this case&#8217;s behavior. I could not include the entire animation because the video would not work, and GIFs are limited in length. If the animation is not playing automatically, click to view.<\/p><\/div>\n<p>The results for Case 1 are precisely what one would expect from such a case. Object 1, the more massive object, experiences smaller acceleration due to the gravitational force from Object 2 than vice-versa, yielding a much smaller spiral of motion.<\/p>\n<p><em>Case 2:<\/em><\/p>\n<p>Maintaining the same conditions for the first two objects, we then consider adding a third into the system and see how it impacts the motion of the objects within the system. The initial conditions are as follows:<a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.40-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-6282 aligncenter\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.40-PM-300x37.png\" alt=\"\" width=\"552\" height=\"68\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.40-PM-300x37.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.40-PM-768x94.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.40-PM-1024x125.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.40-PM-624x76.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.40-PM.png 1626w\" sizes=\"auto, (max-width: 552px) 100vw, 552px\" \/><\/a><\/p>\n<p>The results of Case 2 are graphed below.<\/p>\n<div id=\"attachment_6285\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case2.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6285\" class=\"size-medium wp-image-6285\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case2-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case2-300x225.jpg 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case2-768x576.jpg 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case2-1024x768.jpg 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case2-624x468.jpg 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case2.jpg 1120w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-6285\" class=\"wp-caption-text\">The paths of gravitationally interacting objects 1,2, and 3 are shown above, on a graph of units AU.<\/p><\/div>\n<div id=\"attachment_6290\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case2Label.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6290\" class=\"size-medium wp-image-6290\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case2Label-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case2Label-300x225.jpg 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case2Label-768x576.jpg 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case2Label-1024x768.jpg 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case2Label-624x468.jpg 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case2Label.jpg 1120w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-6290\" class=\"wp-caption-text\">This graph is simply the plot above, with sketched color coding to clarify the paths of individual objects.<\/p><\/div>\n<p>An animation of this case is shown below:<\/p>\n<div id=\"attachment_6359\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/giphy-1-1.gif\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6359\" class=\"size-medium wp-image-6359\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/giphy-1-1-300x224.gif\" alt=\"\" width=\"300\" height=\"224\" \/><\/a><p id=\"caption-attachment-6359\" class=\"wp-caption-text\">This GIF is 15 second clip of the animation of Case 2. If not playing automatically, click to view.<\/p><\/div>\n<p>Case 2&#8217;s results are less predictable than the results of Case 1, because of the additional object included. The most massive object (Object 1) still changes position the least, with each object of a lower mass moving more significantly than the last. This is the first case whose results we could not have calculated analytically. We can understand the trajectory of an object influenced by more than one object if one or more of those objects are held still, but the fact that each and every object experiences a gravitational force due to every other object eliminates the possibility of an analytical solution.<\/p>\n<p><em>Case 3:<\/em><\/p>\n<p>Adding a fourth body to our system, we will further examine how motion evolves as n increases. The initial conditions of this case are listed below.\u00a0<a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.49-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-6294 aligncenter\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.49-PM-300x45.png\" alt=\"\" width=\"493\" height=\"74\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.49-PM-300x45.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.49-PM-768x115.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.49-PM-1024x154.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.49-PM-624x94.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-12-at-11.01.49-PM.png 1626w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\" \/><\/a><\/p>\n<p>This case yields the following results:<\/p>\n<div id=\"attachment_6298\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case3.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6298\" class=\"wp-image-6298 size-medium\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case3-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case3-300x225.jpg 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case3-768x576.jpg 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case3-1024x768.jpg 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case3-624x468.jpg 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/case3.jpg 1120w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-6298\" class=\"wp-caption-text\">On a plot with axis units AU, objects 1,2,3, and 4&#8217;s paths are shown.<\/p><\/div>\n<div id=\"attachment_6299\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case3Label.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6299\" class=\"size-medium wp-image-6299\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case3Label-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case3Label-300x225.jpg 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case3Label-768x576.jpg 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case3Label-1024x768.jpg 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case3Label-624x468.jpg 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Case3Label.jpg 1120w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-6299\" class=\"wp-caption-text\">The same plot as above is shown here with sketched on color-coding the clarify the paths of each individual object.<\/p><\/div>\n<p>The animation for this case is shown below.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_6360\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/giphy-2-1.gif\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6360\" class=\"size-medium wp-image-6360\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/giphy-2-1-300x226.gif\" alt=\"\" width=\"300\" height=\"226\" \/><\/a><p id=\"caption-attachment-6360\" class=\"wp-caption-text\">This GIF is a 15 second excerpt of the animation of Case 3. If it does not play automatically, click to view.<\/p><\/div>\n<p>This case further demonstrates the transition from order in a two body system, to a far less ordered and less predictable system as n increases. Where in Case 1, object 1 moved in a clear spiral, here object 1 moves in a slow and oddly-shaped motion, as the forces it experiences are now based on the motion of 3 different objects.<\/p>\n<p>From here we could continue to add more and more cases as n increases to watch this shift more clearly. However, while this program is theoretically general, and can run more than 4 objects at a time, as n increases, the program&#8217;s effectiveness decreases. The limitations and flaws in this program become and more likely to obstruct results, the more objects we consider in a system. I will discuss these flaws and the next steps to take to correct them below.<\/p>\n<p><strong>Obstacles\/Limitations<\/strong><\/p>\n<ol>\n<li>2-D<br \/>\nThe first limitation in this program is that it views celestial motion as 2 dimensional, where our universe is clearly exists within (at least) 3 dimensions. I made this choice to examine orbits and celestial motion from the perspective we usually view it ( we often view orbits as 2 dimensional, where they are not entirely), despite the fact that it does not entirely match reality.<\/li>\n<li>Collisions<br \/>\nOne problem within this program is that it is not built to address collisions of celestial objects. When two objects wind up in the same position in the program&#8211; something that is physically impossible, but which this code does not explicitly prevent&#8211; they experience some large acceleration\u00a0<em>away<\/em> from the other object. This behavior is not physically accurate and is a result of Matlab&#8217;s inability to understand an infinite acceleration.Here is an example of what a plot looks like when two objects collide:<\/p>\n<p><div id=\"attachment_6338\" style=\"width: 366px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.02.02-AM.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6338\" class=\" wp-image-6338\" src=\"http:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.02.02-AM-300x227.png\" alt=\"\" width=\"356\" height=\"269\" srcset=\"https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.02.02-AM-300x227.png 300w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.02.02-AM-768x582.png 768w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.02.02-AM-1024x776.png 1024w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.02.02-AM-624x473.png 624w, https:\/\/pages.vassar.edu\/magnes\/files\/2019\/05\/Screen-Shot-2019-05-13-at-12.02.02-AM.png 1116w\" sizes=\"auto, (max-width: 356px) 100vw, 356px\" \/><\/a><p id=\"caption-attachment-6338\" class=\"wp-caption-text\">This plot (with axis unit AU) shows the way that objects react when they collide in this program. Both objects can be seen bolting away from one another immediately after their collision.<\/p><\/div><\/li>\n<li>Inaccurate Plotted Points<br \/>\nThis is an issue that has not occurred often, but for which I have little explanation. Occasionally, in the middle of a program running, a new path of an unknown object will begin being plotted, which appears to be fairly massive, because it attracts the surrounding objects fairly strongly.<\/li>\n<li>Path Plotting: Rainbow Everywhere<br \/>\nAs illustrated by my attempts to color-code my path plots, I have not yet found a way to plot the path of n number of objects in a for loop, where the program recognizes the paths of each object as distinct. This is why my original plots are all comprised of many colorful points, instead of a consistent color for each object. This problem also makes diagnosing the cause of the previous issue, because I cannot see which object the program is recognizing as also being in a different position.<\/li>\n<li>Flashing Animation<br \/>\nAssuming the links to the animations work properly, you can see that all objects except Object 1 are flashing. Having experimented with draw now, refresh data, hold on, and hold off, I have not yet identified a way to have a consistent, non-flashing animation of these systems&#8217; behavior.<\/li>\n<\/ol>\n<p><strong>Where Next?<\/strong><\/p>\n<ol>\n<li>3 dimensional<br \/>\nMaking this program 3-dimensional would be fairly simple upgrade to the program, to understand gravitational interactions as they actually occur in our universe. This would simply demand obtaining input information about the z component of motion, and applying it using the Euler Cromer method.<\/li>\n<li>Conservation of Momentum<br \/>\nTaking into account conservation of momentum would be one way to potentially address the limitation in my program in regards to collisions. Without significantly more information, this would likely demand the assumption of inelastic collisions in all cases. I could achieve this by adding the masses of colliding objects in one objects&#8217; array information, and setting the other objects&#8217; mass to zero. This however, may not actually be a large upgrade in terms of accuracy, as perfectly inelastic collisions are no where near the reality of what occurs when objects collide in space, so it would have its drawbacks as well.<\/li>\n<li>Individual Track Paths of Different Objects<br \/>\nAnother clear next step would be to solve my issues in plotting, and develop a method where the program would recognize the individual paths of different objects, instead of considering every data point as unique. I admittedly am not sure how to accomplish this. However, once this is accomplished, it would play significant role in finding the error which causes random data points to pop up where they do not belong (problem #3 above).<\/li>\n<li>Somehow Stop Flashing???<br \/>\nThe other significant next step in developing this program would be to solve the issue of flashing objects. This would likely just require even more deep diving on the internet into MatLab animation techniques, however the particular solution to this problem evaded me for the duration of the project length.<\/li>\n<\/ol>\n<p>Another step moving forward that I would take with this program is to explore more explicitly what yields a stable (or stable-enough) orbit so that I could examine the behavior within a system of objects for a longer period of time. In this case, I would also explore more of the physics of the system, seeing how different objects&#8217; velocities change with respect to time, how their acceleration changes, etcetera. With the program as it stands, exploring those would likely yield a fairly confusing set of graphs, with objects&#8217; behaviors layered on top of each other in an incomprehensible mess. However, if I were to take the time to find systems for which this information is notable and readable, and sort through how to represent it sensibly, this would provide a lot more context for the behavior of these systems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this project, I focused on creating a program which would model the motion of any system of any number of objects interacting gravitationally. I used this project as a way to become more comfortable with computational methods we&#8217;ve already explored in class, to expand upon them, and to become more comfortable with the actual [&hellip;]<\/p>\n","protected":false},"author":5525,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6141","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts\/6141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/users\/5525"}],"replies":[{"embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/comments?post=6141"}],"version-history":[{"count":12,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts\/6141\/revisions"}],"predecessor-version":[{"id":6361,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/posts\/6141\/revisions\/6361"}],"wp:attachment":[{"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/media?parent=6141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/categories?post=6141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pages.vassar.edu\/magnes\/wp-json\/wp\/v2\/tags?post=6141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}