16 1. Differential Equations Solution Using the fact that u = x2 and ux = 2x, the right-hand side of the equation can be written simply as x2(x2 2x) = x4 2x3. This will tell us the value of ut at each of the points in question. At x = −1 this has the value ut(−1, 0) = 1 + 2 = 3. Thus, the point (−1, 1) will begin by moving up with speed three. Since ut(0, 0) = 02 2(03) = 0, at least initially the point (0, 0) will neither move up nor down. Finally, the point (1, 1) will move down with speed one because ut(1, 0) = 14 2 = −1. Although it is possible to do this by hand for a few different values of x, it is difficult to get a good sense of the dynamics of the solution from this information. However, we can implement this procedure in the form of a Mathematica program that will do this for a large number of x values and draw a graph of what the solution might look like a short amount of time after time t = 0. Here is a program which will illustrate one step in the dynamics for the evolution equation from the previous example. (Again, it is recommended that you try to download a file from the publisher’s website so that you do not have to retype this definition.) SimpleEvolver[profile_, {x, x0_, x1_}] := ( RHS = profile (profile - D[profile, x]) numpts = 1000 tsize = .1 profiletable = Table[{xi, (profile /. x - xi)}, {xi, x0, x1, (x1 - x0)/numpts}] evolvedtable = Table[{xi, (profile + tsize RHS /. x - xi)}, {xi, x0, x1, (x1 - x0)/numpts}] Show[Graphics[{Line[profiletable], Dashing[.01], Line[evolvedtable]}], Axes - True]) You do not need to understand every line in this program, but you should especially attempt to understand the lines that define RHS, profiletable and evolvedtable. Moreover, it may be useful for you to learn a bit more about Mathematica. So, the following paragraph will explain each line before we proceed to illustrating its use. The three arguments that it expects are indicated with the “un- derline” symbol as profile (which is the formula for the initial profile u(x, 0)) and the numbers x0 and x1, which are just the left and right
Previous Page Next Page