1.6. Evolution in Time 17 endpoints of the interval of interest. The first line of the program is where we tell it the formula for the right-hand side of the evolu- tion equation we wish to investigate. Instead of writing u, we use profile since that is whatever formula the user has given for the ini- tial profile, we indicate derivatives using Mathematica notation such as ux = D[profile,x], uxx = D[profile,{x,2}] and so on. The next two lines of the program contain parameters that you can ma- nipulate. What I have called numpts determines how many points it will consider. Just as we considered 3 points only in the example, this program will consider 1000 points, which is enough to make the graph look smooth in most instances. The parameter tsize deter- mines the size of the “time step” since it is set to 0.1 here it is as if we are trying to approximate what the graph of u(x, .1) will look like if given u(x, 0). It is only for very small values of this parameter that one can expect the output to accurately represent the dynamics determined by the equation. The definition of profiletable uses the Table command to make a long list of the coordinates of numpts points on the graph of the profile. (Note that profile /. x-xi is a way to tell Mathematica to evaluate the formula profile at x=xi.) The definition of evolvedtable is similar, but note that the y-coordinates of the points are not just given by the initial profile but by profile + tsize RHS. This is a linear approximation in which we add the derivative ut multiplied by the tiny step size to get an approximation of the value after a small amount of time has passed. Finally, the last line of the program draws two curves: one containing the points from the initial profile and the other (drawn with a dashed line) whose points come from the linear approximation of the state of the function at a later time. The output of saying SimpleEvolver[x^2,{x,-1,1}] is the graph shown in Figure 1.6-2. It shows the initial profile as a solid line and its estimate of the values at a later time as the dashed line. Note that as we predicted in the example, the point on the dashed line at x = −1 is above the point (−1, 1). (It is .3 units above it since it was going up at a speed of 3 and we chose a time step of size .1 so it only had time to move up .3 units.) Similarly, the point with x-coordinate equal to 1 moved down by .1 while the point at the origin stayed fixed. Warning We will see later that a numerical approximation to the solution of an evolution equation played an important role in the history of soliton theory. At that point, you may benefit from your
Previous Page Next Page