(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 68158, 2148]*) (*NotebookOutlinePosition[ 85763, 2786]*) (* CellTagsIndexPosition[ 85719, 2782]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["\<\ Transforming systems of PDEs for efficient numerical solution \ \>", "Title", FontSize->26], Cell["\<\ Andreas Wrangsj\[ODoubleDot], Peter Fritzson and K. Sheshadri Department of Computer and Information Science Link\[ODoubleDot]ping University, S-581 83 Link\[ODoubleDot]ping, Sweden Email: {andwr, petfr, shesh}@ida.liu.se Phone: +46 13 281484, Fax: +46 13 284499 \ \>", "Text", FontSlant->"Italic"], Cell[CellGroupData[{ Cell["Abstract", "Section"], Cell[TextData[{ "A ", StyleBox["Mathematica", FontSlant->"Italic"], " package to deal with a system of partial differential equations (PDEs) is \ presented. This package uses explicit finite-difference schemes to handle \ equations in an arbitrary number of variables that are functions of one \ spatial variable and time. The code has the flexibility to incorporate any \ difference approximation specified by the user, and transforms the given \ system of PDEs into a system of difference equations that can be iteratively \ solved using the discretized forms of initial and boundary conditions. The \ iteration is made considerably faster by converting the ", StyleBox["Mathematica", FontSlant->"Italic"], " code into an optimized C++ code using the MathCode C++ compiler[1]. \ Examples are presented in which the generated C++ code runs about a \ thousand times faster than the ", StyleBox["Mathematica", FontSlant->"Italic"], " code." }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["1. Introduction", "Section"], Cell[TextData[{ "There exist many packages for solving partial differential equations \ (PDEs) (see references [MinOh95, Ames92, Gust95] for an overview). The \ motivation for developing yet another package is the following. The existing \ packages are very efficient, but they are invariably restricted to some \ particular solution method, and hence to the class of equations for which the \ solution method is efficient. Often the user has very little freedom to \ choose an approximation scheme for a particular equation that needs to be \ solved. There also exists a ", StyleBox["Mathematica", FontSlant->"Italic"], " package [Ganza96] that can handle a variety of PDEs, but in our opinion \ it has two limitations: (1) it does not provide a framework for treating an \ arbitrary PDE, and (2) it uses ", StyleBox["Mathematica", FontSlant->"Italic"], " for numerical computation, which makes it rather inefficient. \n\nIt \ would be both challenging and useful to develop a PDE solver that has (a) the \ generality and flexibility to handle, at least in principle, an arbitrary \ equation with an arbitrary approximation method, and (b) the efficiency and \ speed to be useful in a real-world situation. We believe that the package \ that we have developed is a first step towards this goal: we use the symbolic \ abilities of ", StyleBox["Mathematica", FontSlant->"Italic"], " to address the first issue, and the idea of code generation to address \ the second. At present, our package is restricted to systems of PDEs in \ functions of two variables, and to explicit finite-difference schemes, but \ can be extended to overcome these limitations in a straightforward manner. \ Any further limitation is only because the field of PDEs itself is not, and \ can not be, completely systematized. The high degree of flexibility of our \ package is because it uses ", StyleBox["Mathematica", FontSlant->"Italic"], " for the symbolic parts of the problem; its efficiency is because it uses \ a compiled language (C++ in this case) for numerical computation.\n\nOur main \ results are the following. We have defined various ", StyleBox["Mathematica", FontSlant->"Italic"], " functions that symbolically perform the discretization of the variables \ in the given PDE problem and generate a set of difference equations. This is \ done based on the approximation method specified in the input. We test these \ functions on a simple one dimensional parabolic equation ", Cell[BoxData[ FormBox[ StyleBox[ RowBox[{ FractionBox[\(\[PartialD]\(u(x, t)\)\), \(\[PartialD]t\), MultilineFunction->None], "=", FractionBox[\(\[PartialD]\^2\(u(x, t)\)\), \(\[PartialD]x\^2\), MultilineFunction->None]}], FontSize->12], TraditionalForm]]], " for ", StyleBox["x", FontSlant->"Italic"], "=[0,1] and ", StyleBox["t", FontSlant->"Italic"], "=[0,\[Infinity]] with the boundary conditions ", StyleBox["u(", FontSlant->"Italic"], "0", StyleBox[",t)=", FontSlant->"Italic"], "0", StyleBox["=u(", FontSlant->"Italic"], "1", StyleBox[",t)", FontSlant->"Italic"], " and the initial condition ", StyleBox["u(x,", FontSlant->"Italic"], "0", StyleBox[")=x/", FontSlant->"Italic"], "2 for ", StyleBox["x<", FontSlant->"Italic"], "1/2 and ", StyleBox["u(x,t)=", FontSlant->"Italic"], "1", StyleBox["-x/", FontSlant->"Italic"], "2 for ", StyleBox["x\[GreaterEqual]", FontSlant->"Italic"], "1/2. We find that the compiled C++ code runs about a thousand times \ faster than the interpreted ", StyleBox["Mathematica", FontSlant->"Italic"], " code for the iteration part. \n\nThis paper is organized as follows. In \ Sec.2 we describe in some detail the way in which we discretize the \ independent variables to generate a grid and convert the given PDE problem \ into a system of difference equations to be iteratively solved to obtain the \ solution at an arbitrary point on the grid. The iteration is done most \ efficiently by defining a separate function and generating a C++ code for it; \ the way in which this is done is described in Sec.3. We demonstrate our \ package for the parabolic equation in Sec.4. Some conclusions and possible \ future work are discused in Sec.5." }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["2. Discretizing the PDE Problem", "Section"], Cell[TextData[{ "The following format is used for specifying the PDE problem. The problem \ specification is divided into six lists: (i) ", StyleBox["equations", FontSlant->"Italic"], ", which contains the PDE, (ii) ", StyleBox["initials", FontSlant->"Italic"], ", which contains the initial conditions, (iii) ", StyleBox["boundaries", FontSlant->"Italic"], ", which contains the boundary conditions, (iv) ", StyleBox["geometries", FontSlant->"Italic"], ", which specifies the system geometry, (v) ", StyleBox["variables", FontSlant->"Italic"], ", which specifies the problem variable names, the number of grid points \ and grid spacings, and (vi) ", StyleBox["methods", FontSlant->"Italic"], ", which specifies the kind of difference approximation and numerical \ boundary conditions to be used. These lists are given as options to a \ function called ", StyleBox["DefinePDEProblem", "Input"], " that we have defined. \n\nAt the highest level, our package has a \ function ", StyleBox["solvePDE", "Input"], " which performs the iterative numeric computation to obtain the solution \ at an arbitrary grid point. This iteration uses a set of difference \ equations, which are obtained by discretizing the given PDE and the initial \ and boundary conditions. These difference equations are converted into \ assignment statements for the array of dependent variables: this is a three \ dimensional array in the present case, the first denoting the name of the \ dependent variable, and the second and the third, the space and time grid \ coordinates, respectively. \n\nThe assignment statements corresponding to \ the given PDE are based on its stencil that is obtained by applying the \ given difference method on the equation. The stencil is generated as a rule \ that relates the value of the dependent variable at a grid point to its \ values at a set of other points. The actual set of points is determined by \ the approximation method, which is specified in the ", StyleBox["methods", FontSlant->"Italic"], " list. The functions corresponding to the dependent variables are then \ replaced by the corresponding array variables.\n\nIn a similar manner, \ assignment statements are generated using the discretized forms of the \ initial and boundary conditions. Together, these three sets of assignment \ statements are sufficient to iteratively determine the values of the \ dependent variables at any grid point.\n\nThe above process relies on a \ number of lower level functions which can be classified into two groups:\n\n", StyleBox["(1) Information retrieval functions:", FontVariations->{"Underline"->True}], " These functions extract the various global variables, the dependent and \ independent variables, the approximation orders, and the solution methods \ from the input lists. \n\n", StyleBox["(2) Discretization functions:", FontVariations->{"Underline"->True}], " At the highest level in this category are the functions that generate the \ stencil and the discretized forms of the initial and boundary conditions. \ These in turn depend on the functions that constitute the approximation \ methods, that in turn are constructed from functions that replace \ derivatives of any order by forward, backward or central difference \ approximations of a specified order. Finally, there are functions that can \ transform the independent variables between discrete (grid) and continuous \ forms." }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["3. Code Generation", "Section"], Cell[TextData[{ "We have separated the symbolic and numerical aspects of the problem with \ the idea of code generation in mind. Accordingly, everything except the \ numerical iteration part is done symbolically in the first part of the \ package, called PDESymbolic. The result of this part are the assignment \ statements referred to above, along with some global variables that are \ extracted from the input. This part of the problem is the so called set-up \ part, and the time it takes is independent of the problem size. The \ numerical part of the package, PDERuntime, performs the numerical iteration \ using these assignment statements, and the time it takes increases with the \ problem size. Evidently, the efficiency of the package is determined by how \ efficiently the iteration is performed. \n\n We use the idea of code \ generation to perform efficient numerical computation. We employ the \ MathCode C++ code generator [Fritz98] which generates efficient C++ code for \ a suitably stated ", StyleBox["Mathematica", FontSlant->"Italic"], " task. This requires us to declare the types of all the variables, \ functions and arrays that the iterator uses, and this we do in the PDERuntime \ part of our package. We can also directly run the iterator ", StyleBox["solvePDE", "Input"], " interpretively within ", StyleBox["Mathematica. ", FontSlant->"Italic"], "We find, however, that the generated C++ code for the ", StyleBox["solvePDE", "Input"], " function runs almost a thousand times faster than the ", StyleBox["Mathematica", FontSlant->"Italic"], " run. In the next section, we give an example of a parabolic equation, for \ which we obtain a speedup of about one thousand." }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["4. An Example: Parabolic Equation", "Section"], Cell["\<\ In this section we demonstrate the use of our symbolic functions and code \ generation for the parabolic equation in one spatial dimension and time:\ \>", "Text"], Cell[TextData[{ Cell[BoxData[ FormBox[ StyleBox[ RowBox[{ FractionBox[\(\[PartialD]\(u(x, t)\)\), \(\[PartialD]t\), MultilineFunction->None], "=", FractionBox[\(\[PartialD]\^2\(u(x, t)\)\), \(\[PartialD]x\^2\), MultilineFunction->None]}], FontSize->16], TraditionalForm]], FontSize->36], StyleBox[" ", FontSize->36], " " }], "Text"], Cell["\<\ with an initial condition \ \>", "Text"], Cell[TextData[{ StyleBox["\n", FontSize->12], StyleBox["u(x,", FontSize->12, FontSlant->"Italic"], StyleBox["0", FontSize->12], StyleBox[")=x/", FontSize->12, FontSlant->"Italic"], StyleBox["2 for ", FontSize->12], StyleBox["x<", FontSize->12, FontSlant->"Italic"], StyleBox["1/2 and ", FontSize->12], StyleBox["u(x,t)=1-x/", FontSize->12, FontSlant->"Italic"], StyleBox["2 for ", FontSize->12], StyleBox["x\[GreaterEqual]", FontSize->12, FontSlant->"Italic"], StyleBox["1/2, ", FontSize->12] }], "Text"], Cell["\<\ and boundary conditions \ \>", "Text"], Cell[TextData[{ "\n", StyleBox["u(", FontSize->12, FontSlant->"Italic"], StyleBox["0", FontSize->12], StyleBox[",t)=", FontSize->12, FontSlant->"Italic"], StyleBox["0", FontSize->12], StyleBox["=u(", FontSize->12, FontSlant->"Italic"], StyleBox["1", FontSize->12], StyleBox[",t). ", FontSize->12, FontSlant->"Italic"] }], "Text"], Cell[TextData[{ StyleBox["\n", FontSlant->"Italic"], "We use a difference method in which the time derivative is replaced by a \ first-order forward difference ", Cell[BoxData[ \(TraditionalForm\`\(D\^+\)\)]], " and the second-order space derivative is replaced by ", Cell[BoxData[ \(TraditionalForm\`\(D\_+\) \(D\_-\)\)]], ", which is a second-order central difference. As a result, we obtain the \ difference equation " }], "Text"], Cell[TextData[{ "\n", StyleBox["U(", FontSize->12, FontSlant->"Italic"], StyleBox["1,", FontSize->12], StyleBox["j,n)=(", FontSize->12, FontSlant->"Italic"], StyleBox["1-2", FontSize->12], StyleBox["r)U(", FontSize->12, FontSlant->"Italic"], StyleBox["1,", FontSize->12], StyleBox["j,n-", FontSize->12, FontSlant->"Italic"], StyleBox["1", FontSize->12], StyleBox[")+r{U(", FontSize->12, FontSlant->"Italic"], StyleBox["1,", FontSize->12], StyleBox["j+", FontSize->12, FontSlant->"Italic"], StyleBox["1,", FontSize->12], StyleBox["n-", FontSize->12, FontSlant->"Italic"], StyleBox["1", FontSize->12], StyleBox[")+U(", FontSize->12, FontSlant->"Italic"], StyleBox["1,", FontSize->12], StyleBox["j-", FontSize->12, FontSlant->"Italic"], StyleBox["1", FontSize->12], StyleBox[",n-", FontSize->12, FontSlant->"Italic"], StyleBox["1", FontSize->12], StyleBox[")}", FontSize->12, FontSlant->"Italic"] }], "Text"], Cell[TextData[{ StyleBox["\n", FontSlant->"Italic"], "for the discretized dependent variable ", StyleBox["U(", FontSlant->"Italic"], "1,", StyleBox["j,n)", FontSlant->"Italic"], " (corresponding to the continuous variable ", StyleBox["u(x,t)", FontSlant->"Italic"], ") at the grid point ", StyleBox["(j,n)", FontSlant->"Italic"], "; here ", StyleBox["r", FontSlant->"Italic"], " ", Cell[BoxData[ \(TraditionalForm\`\(\( = k/h\^2\)\ \)\)]], "where ", StyleBox["h", FontSlant->"Italic"], " and ", StyleBox["k", FontSlant->"Italic"], " are the space and time steps, respectively. The first index refers to \ the dependent variable name, and is 1 in the present since we have only one \ dependent variable ", StyleBox["u", FontSlant->"Italic"], ". This difference equation is easily solved by using the discretized \ forms of the initial and boundary conditions, and it is well known (see \ [Ames92], for example) that the solution is convergent when ", StyleBox["r", FontSlant->"Italic"], "<0.5. We now show how this problem is handled by our package.\n\nTo begin \ with, the input is specified in the form of six lists using the function ", StyleBox["DefinePDEProblem", "Input"], ":" }], "Text"], Cell[BoxData[ RowBox[{"\n", RowBox[{ RowBox[{"DefinePDEProblem", "[", " ", RowBox[{ StyleBox["parabolic", FontSlant->"Italic"], ",", " ", "\n", " ", RowBox[{ StyleBox["equations", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], StyleBox["->", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], RowBox[{"{", FormBox[ RowBox[{ FractionBox[\(\[PartialD]\(u(x, t)\)\), \(\[PartialD]t\), MultilineFunction->None], "==", FractionBox[\(\[PartialD]\^2\( u(x, t)\)\), \(\[PartialD]x\^2\), MultilineFunction->None]}], "TraditionalForm"], "}"}]}], ",", "\n", " ", RowBox[{ StyleBox["initials", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], StyleBox["->", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], "\n", "\t\t", "\n", " ", RowBox[{"{", RowBox[{"{", RowBox[{ StyleBox["t", FontSlant->"Italic"], StyleBox["==", FontSlant->"Italic"], StyleBox[\(u[x, t]\), FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], StyleBox["==", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], RowBox[{"If", "[", StyleBox[\(x\ < \ 0.5, \ \ x, \ \ 1.0 - x\), FontSlant->"Italic"], "]"}]}], "}"}], "}"}]}], ",", "\n", " ", "\n", "\t\t ", RowBox[{ StyleBox["boundaries", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], StyleBox["->", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], RowBox[{"{", RowBox[{ RowBox[{"{", StyleBox[\(x == 0, \ \ u[x, t] == 0\), FontSlant->"Italic"], "}"}], ",", " ", "\n", "\t\t\t ", RowBox[{"{", StyleBox[\(x == 1, \ u[x, t] == 0\), FontSlant->"Italic"], "}"}]}], "}"}]}], ",", "\n", " ", "\n", "\t\t ", RowBox[{ StyleBox["geometries", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], StyleBox["->", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], RowBox[{"{", RowBox[{ RowBox[{ StyleBox["x", FontSlant->"Italic"], "\[GreaterEqual]", "0"}], ",", " ", RowBox[{ StyleBox["x", FontSlant->"Italic"], "\[LessEqual]", "1"}]}], "}"}]}], ",", "\n", " ", "\n", "\t\t ", RowBox[{ StyleBox["variables", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], StyleBox["-", FontSlant->"Italic"], RowBox[{"{", RowBox[{ RowBox[{"{", StyleBox[\(x, \ 2, \ 200\), FontSlant->"Italic"], "}"}], ",", " ", "\n", "\t\t\t ", RowBox[{"{", StyleBox[\(t, \ 1, \ 500, \ 0.0000111111\), FontSlant->"Italic"], "}"}], ",", " ", RowBox[{"{", StyleBox["u", FontSlant->"Italic"], "}"}]}], "}"}]}], ",", "\n", " ", "\n", "\t\t ", RowBox[{ StyleBox["methods", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], StyleBox["->", FontSlant->"Italic"], StyleBox[" ", FontSlant->"Italic"], \({SingleStep1D, \ none, \ none}\)}]}], "\n", "]"}], ";"}]}]], "Input", CellLabel->"In[3]:="], Cell[TextData[{ "\nwhere ", StyleBox["equations, initials, boundaries, geometries, variables, ", FontSlant->"Italic"], " and ", StyleBox["methods ", FontSlant->"Italic"], " are ", StyleBox["Mathematica", FontSlant->"Italic"], " option parameters. This function keeps the input data in an unevaluated \ form, by applying the ", StyleBox["Hold", "Input"], " construct around the elements of the list in a suitable manner, and \ stores the problem definition in global variables named ", StyleBox["equations, initials, boundaries, geometries, variables, ", FontSlant->"Italic"], " and ", StyleBox["methods", FontSlant->"Italic"], ". \n\nNote that though the ", StyleBox["equations", FontSlant->"Italic"], " list has only one element in this case, our package can handle any number \ of entries in this list. ", StyleBox[" \n\n", FontSlant->"Italic"], "In the present case, the ", StyleBox["initials", FontSlant->"Italic"], " list has just one sublist that contains two statements: the first \ specifies the time point and the second specifies the value of the dependent \ variable at all space points at this time point. If there were more \ statements in the initial conditions of the problem, they could be added to \ this sublist. \n\nIn the same way, the ", StyleBox["boundaries", FontSlant->"Italic"], " list has two sublists for the left and right spatial boundaries of the \ system, each containing the values of spatial points followed by the function \ values at these points. More conditions, if there are any, can be added to \ these sublists. \n\nThe ", StyleBox["geometries", FontSlant->"Italic"], " list specifies the system boundaries, which are simply the left and right \ ends of the system in the present one-dimensional case. \n\nThe ", StyleBox["variables", FontSlant->"Italic"], " list has three entries in the present case. The first specifies the name \ of the spatial coordinate, the approximation order to be used for derivatives \ with respect to this variable, and the number of grid points along this \ direction. The second entry specifies similar information for the time \ coordinate; in this case, the discrete step size is also specified. The last \ element in the list specifies the name of the dependent variable. \n\n \ Finally, the ", StyleBox["methods", FontSlant->"Italic"], " list has three entries. The first refers to the approximation method to \ be used on the PDE: in this case, we have specified ", StyleBox["SingleStep1D", "Input"], ", which for the approximation orders 1 and 2, respectively, for time and \ space, reproduces the difference equation referred to at the beginning of \ this section. The next two entries are not required in the present example \ [Ganza96]: the second entry refers to the numerical boundary conditions, and \ the third refers to the numerical initial conditions. \n\nOur information \ retrieval functions can then be used to extract data from the input. For \ example, the values of the x-coordinate at the system boundaries are \ extracted as follows:" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(GetGeometry1D[geometries, variables, "\"]\)], "Input"], Cell[BoxData[ \(0\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(GetGeometry1D[geometries, variables, "\"]\)], "Input"], Cell[BoxData[ \(1\)], "Output"] }, Open ]], Cell["We give some more examples below.", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(GetDiffMethod1D[variables, methods, "\"]\)], "Input"], Cell[BoxData[ \(SingleStep1D\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(GetDiffMethod1D[variables, methods, "\"]\)], "Input", CellLabel->"In[261]:="], Cell[BoxData[ \(200\)], "Output", CellLabel->"Out[261]="] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(GetDiffMethod1D[variables, methods, "\"]\)], "Input", CellLabel->"In[262]:="], Cell[BoxData[ \(500\)], "Output", CellLabel->"Out[262]="] }, Open ]], Cell["\<\ The difference equation corresponding to the given PDE is obtained in \ the following way. \ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(DifferenceEquations1D[equations, GetDiffMethod1D[variables, methods, "\"], GetDiffMethod1D[variables, methods, "\"], GetDiffMethod1D[variables, methods, "\"], h, k]\)], "Input"], Cell[BoxData[ \({u[x, 1 + t] \[Rule] \(k\ u[\(-1\) + x, t] + \((h\^2 - 2\ k)\)\ u[x, t] + k\ u[1 + x, t]\)\/h\^2}\)], "Output"] }, Open ]], Cell[TextData[{ "Here, ", StyleBox["h ", FontSlant->"Italic"], "and ", StyleBox["k ", FontSlant->"Italic"], "are the discrete step sizes for ", StyleBox["x ", FontSlant->"Italic"], "and", StyleBox[" t", FontSlant->"Italic"], ", respectively. The function ", StyleBox["setupproblem", "Input"], " generates the iteration function ", StyleBox["solvePDE", "Input"], " with the assignment statements, and also extracts all the global \ variables from the input lists. In the following, ", StyleBox["dvl ", FontSlant->"Italic"], "is the number of dependent variables. " }], "Text"], Cell[CellGroupData[{ Cell["\<\ setupproblem[equations, initials, boundaries, geometries, variables, methods]\ \ \>", "Input", CellLabel->"In[297]:="], Cell[BoxData[ \({HoldPattern[ solvePDE[nx$_, nt$_, InteriorBelow$_, InteriorLeft$_, InteriorRight$_, dvl$_]] \[RuleDelayed] Module[{Integer\ j$, Integer\ n$}, \(\((U\[LeftDoubleBracket]1 | dvl$, 1 | nx$, 1 | nt$\[RightDoubleBracket] = 0; For[j$ = 1, j$ < nx$ + 1, \(j$++\), U\[LeftDoubleBracket]1, j$, 1\[RightDoubleBracket] = If[0.00502512562814070395`\ \((\(-1.`\) + j$)\) < 0.5`, 0.00502512562814070395`\ \((\(-1.`\) + j$)\), \(1.`\[InvisibleSpace]\) - 1.`\ \((0.00502512562814070395`\ \((\(-1.`\) + j$)\)) \)]]; For[n$ = 1, n$ < nt$ + 1, \(n$++\), U\[LeftDoubleBracket]1, 1, n$\[RightDoubleBracket] = 0]; For[n$ = 1, n$ < nt$ + 1, \(n$++\), U\[LeftDoubleBracket]1, 200, n$\[RightDoubleBracket] = 0]; For[n$ = InteriorBelow$, n$ < nt$ + 1, \(n$++\), For[j$ = InteriorLeft$, j$ < InteriorRight$ + 1, \(j$++\), U\[LeftDoubleBracket]1, j$, n$\[RightDoubleBracket] = 0.440010671099999939`\ U\[LeftDoubleBracket]1, \(-1\) + j$, \(-1\) + n$\[RightDoubleBracket] + 0.119978657799999988`\ U\[LeftDoubleBracket]1, j$, \(-1\) + n$\[RightDoubleBracket] + 0.440010671099999939`\ U\[LeftDoubleBracket]1, 1 + j$, \(-1\) + n$\[RightDoubleBracket]]])\); \)]}\)], "Output", CellLabel->"Out[297]="] }, Open ]], Cell[TextData[{ "\nThis completes the symbolic part of our package. The time taken to \ run the iteration function ", StyleBox["solvePDE", "Input"], " increases with the size of the problem. The following are the results \ of running the iteration function first on ", StyleBox["Mathematica", FontSlant->"Italic"], " directly, and then using the generated C++ code from the MathCode \ compiler. In the following, the function AbsTime measures the time required \ to run the function which is given as its argument; ", StyleBox["timem", FontSlant->"Italic"], " and ", StyleBox["timemcode ", FontSlant->"Italic"], "are the times taken to run within ", StyleBox["Mathematica", FontSlant->"Italic"], ", and the generated C++ code, respectively.\n\nHere is the ", StyleBox["Mathematica", FontSlant->"Italic"], " run:" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(timem = AbsTime[solvePDE[nx, nt, InteriorBelow, InteriorLeft, InteriorRight, \ dvl]; ]\)], "Input", CellLabel->"In[325]:="], Cell[BoxData[ \({200.`8.0206\ Second, Null}\)], "Output", CellLabel->"Out[325]="] }, Open ]], Cell[TextData[{ "Now we run the iteration function ", StyleBox["solvePDE", "Input"], " within MathCode by executing the following sequence of commands:" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(CompilePackage["\"]\)], "Input", CellLabel->"In[326]:="], Cell[BoxData[ \("Successful compilation to C++: 3 function(s)"\)], "Print"] }, Open ]], Cell["MakeBinary[]", "Input", CellLabel->"In[327]:="], Cell[CellGroupData[{ Cell[BoxData[ \(InstallCode["\"]\)], "Input", CellLabel->"In[328]:="], Cell[BoxData[ InterpretationBox[\("PDESolver"\[InvisibleSpace]" is installed."\), SequenceForm[ "PDESolver", " is installed."], Editable->False]], "Print"], Cell[BoxData[ \(LinkObject["'./PDESolverml.exe'", 3, 2]\)], "Output", CellLabel->"Out[328]="] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(timemcode = \ AbsTime[\n\t\t Table[solvePDE[nx, nt, InteriorBelow, InteriorLeft, InteriorRight, \ dvl], \ {i, 1, 100}]; \n\t]\)], "Input", CellLabel->"In[329]:="], Cell[BoxData[ \({22.`7.062\ Second, Null}\)], "Output", CellLabel->"Out[329]="] }, Open ]], Cell[CellGroupData[{ Cell["\<\ timelist={nx,nt,timem[[1]], timemcode[[1]], 100*timem[[1]]/timemcode[[1]]}\ \>", "Input", CellLabel->"In[330]:="], Cell[BoxData[ \({200, 500, 200.`8.0206\ Second, 22.`7.062\ Second, 909.090909090909116`7.0167}\)], "Output", CellLabel->"Out[330]="] }, Open ]], Cell[TextData[{ "\nIn the MathCode part, we run the function 100 times since the time taken \ for a single run is too small for the time measurement to be accurate. We \ therefore have to divide the above time by 100 to compare it with the time \ taken for the ", StyleBox["Mathematica", FontSlant->"Italic"], " run. We find that for this case the generated C++ code runs about 900 \ times faster.\n\nWe show below the results from the above runs. For this \ purpose, we have defined a function ", StyleBox["tabmcode", "Input"], " (which is compiled alongwith ", StyleBox["solvePDE", "Input"], ") which contains the solution vector for the ", StyleBox["i", FontSlant->"Italic"], "th dependent variable for the time slice ", StyleBox["t", FontSlant->"Italic"], ". We can directly plot this vector using the function ", StyleBox["ListPlot", "Input"], ". Here is the plot of the initial vector:" }], "Text"], Cell[CellGroupData[{ Cell["ListPlot[tabmcode[1,1,nx],PlotJoined->True];", "Input", CellLabel->"In[331]:="], Cell[GraphicsData["PostScript", "\<\ %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart /Mabs { Mgmatrix idtransform Mtmatrix dtransform } bind def /Mabsadd { Mabs 3 -1 roll add 3 1 roll add exch } bind def %% Graphics %%IncludeResource: font Courier %%IncludeFont: Courier /Courier findfont 10 scalefont setfont % Scaling calculations 0.0238095 0.0047619 0.0147151 1.18315 [ [.2619 .00222 -6 -9 ] [.2619 .00222 6 0 ] [.5 .00222 -9 -9 ] [.5 .00222 9 0 ] [.7381 .00222 -9 -9 ] [.7381 .00222 9 0 ] [.97619 .00222 -9 -9 ] [.97619 .00222 9 0 ] [.01131 .13303 -18 -4.5 ] [.01131 .13303 0 4.5 ] [.01131 .25135 -18 -4.5 ] [.01131 .25135 0 4.5 ] [.01131 .36966 -18 -4.5 ] [.01131 .36966 0 4.5 ] [.01131 .48798 -18 -4.5 ] [.01131 .48798 0 4.5 ] [.01131 .60629 -18 -4.5 ] [.01131 .60629 0 4.5 ] [ 0 0 0 0 ] [ 1 .61803 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath 0 g .25 Mabswid [ ] 0 setdash .2619 .01472 m .2619 .02097 L s [(50)] .2619 .00222 0 1 Mshowa .5 .01472 m .5 .02097 L s [(100)] .5 .00222 0 1 Mshowa .7381 .01472 m .7381 .02097 L s [(150)] .7381 .00222 0 1 Mshowa .97619 .01472 m .97619 .02097 L s [(200)] .97619 .00222 0 1 Mshowa .125 Mabswid .07143 .01472 m .07143 .01847 L s .11905 .01472 m .11905 .01847 L s .16667 .01472 m .16667 .01847 L s .21429 .01472 m .21429 .01847 L s .30952 .01472 m .30952 .01847 L s .35714 .01472 m .35714 .01847 L s .40476 .01472 m .40476 .01847 L s .45238 .01472 m .45238 .01847 L s .54762 .01472 m .54762 .01847 L s .59524 .01472 m .59524 .01847 L s .64286 .01472 m .64286 .01847 L s .69048 .01472 m .69048 .01847 L s .78571 .01472 m .78571 .01847 L s .83333 .01472 m .83333 .01847 L s .88095 .01472 m .88095 .01847 L s .92857 .01472 m .92857 .01847 L s .25 Mabswid 0 .01472 m 1 .01472 L s .02381 .13303 m .03006 .13303 L s [(0.1)] .01131 .13303 1 0 Mshowa .02381 .25135 m .03006 .25135 L s [(0.2)] .01131 .25135 1 0 Mshowa .02381 .36966 m .03006 .36966 L s [(0.3)] .01131 .36966 1 0 Mshowa .02381 .48798 m .03006 .48798 L s [(0.4)] .01131 .48798 1 0 Mshowa .02381 .60629 m .03006 .60629 L s [(0.5)] .01131 .60629 1 0 Mshowa .125 Mabswid .02381 .03838 m .02756 .03838 L s .02381 .06204 m .02756 .06204 L s .02381 .0857 m .02756 .0857 L s .02381 .10937 m .02756 .10937 L s .02381 .15669 m .02756 .15669 L s .02381 .18036 m .02756 .18036 L s .02381 .20402 m .02756 .20402 L s .02381 .22768 m .02756 .22768 L s .02381 .27501 m .02756 .27501 L s .02381 .29867 m .02756 .29867 L s .02381 .32233 m .02756 .32233 L s .02381 .346 m .02756 .346 L s .02381 .39332 m .02756 .39332 L s .02381 .41699 m .02756 .41699 L s .02381 .44065 m .02756 .44065 L s .02381 .46431 m .02756 .46431 L s .02381 .51164 m .02756 .51164 L s .02381 .5353 m .02756 .5353 L s .02381 .55897 m .02756 .55897 L s .02381 .58263 m .02756 .58263 L s .25 Mabswid .02381 0 m .02381 .61803 L s 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath .5 Mabswid .02857 .01472 m .03333 .02066 L .0381 .02661 L .04286 .03255 L .04762 .0385 L .05238 .04444 L .05714 .05039 L .0619 .05633 L .06667 .06228 L .07143 .06822 L .07619 .07417 L .08095 .08012 L .08571 .08606 L .09048 .09201 L .09524 .09795 L .1 .1039 L .10476 .10984 L .10952 .11579 L .11429 .12173 L .11905 .12768 L .12381 .13362 L .12857 .13957 L .13333 .14552 L .1381 .15146 L .14286 .15741 L .14762 .16335 L .15238 .1693 L .15714 .17524 L .1619 .18119 L .16667 .18713 L .17143 .19308 L .17619 .19903 L .18095 .20497 L .18571 .21092 L .19048 .21686 L .19524 .22281 L .2 .22875 L .20476 .2347 L .20952 .24064 L .21429 .24659 L .21905 .25253 L .22381 .25848 L .22857 .26443 L .23333 .27037 L .2381 .27632 L .24286 .28226 L .24762 .28821 L .25238 .29415 L .25714 .3001 L .2619 .30604 L Mistroke .26667 .31199 L .27143 .31794 L .27619 .32388 L .28095 .32983 L .28571 .33577 L .29048 .34172 L .29524 .34766 L .3 .35361 L .30476 .35955 L .30952 .3655 L .31429 .37144 L .31905 .37739 L .32381 .38334 L .32857 .38928 L .33333 .39523 L .3381 .40117 L .34286 .40712 L .34762 .41306 L .35238 .41901 L .35714 .42495 L .3619 .4309 L .36667 .43685 L .37143 .44279 L .37619 .44874 L .38095 .45468 L .38571 .46063 L .39048 .46657 L .39524 .47252 L .4 .47846 L .40476 .48441 L .40952 .49035 L .41429 .4963 L .41905 .50225 L .42381 .50819 L .42857 .51414 L .43333 .52008 L .4381 .52603 L .44286 .53197 L .44762 .53792 L .45238 .54386 L .45714 .54981 L .4619 .55575 L .46667 .5617 L .47143 .56765 L .47619 .57359 L .48095 .57954 L .48571 .58548 L .49048 .59143 L .49524 .59737 L .5 .60332 L Mistroke .50476 .60332 L .50952 .59737 L .51429 .59143 L .51905 .58548 L .52381 .57954 L .52857 .57359 L .53333 .56765 L .5381 .5617 L .54286 .55575 L .54762 .54981 L .55238 .54386 L .55714 .53792 L .5619 .53197 L .56667 .52603 L .57143 .52008 L .57619 .51414 L .58095 .50819 L .58571 .50225 L .59048 .4963 L .59524 .49035 L .6 .48441 L .60476 .47846 L .60952 .47252 L .61429 .46657 L .61905 .46063 L .62381 .45468 L .62857 .44874 L .63333 .44279 L .6381 .43685 L .64286 .4309 L .64762 .42495 L .65238 .41901 L .65714 .41306 L .6619 .40712 L .66667 .40117 L .67143 .39523 L .67619 .38928 L .68095 .38334 L .68571 .37739 L .69048 .37144 L .69524 .3655 L .7 .35955 L .70476 .35361 L .70952 .34766 L .71429 .34172 L .71905 .33577 L .72381 .32983 L .72857 .32388 L .73333 .31794 L .7381 .31199 L Mistroke .74286 .30604 L .74762 .3001 L .75238 .29415 L .75714 .28821 L .7619 .28226 L .76667 .27632 L .77143 .27037 L .77619 .26443 L .78095 .25848 L .78571 .25253 L .79048 .24659 L .79524 .24064 L .8 .2347 L .80476 .22875 L .80952 .22281 L .81429 .21686 L .81905 .21092 L .82381 .20497 L .82857 .19903 L .83333 .19308 L .8381 .18713 L .84286 .18119 L .84762 .17524 L .85238 .1693 L .85714 .16335 L .8619 .15741 L .86667 .15146 L .87143 .14552 L .87619 .13957 L .88095 .13362 L .88571 .12768 L .89048 .12173 L .89524 .11579 L .9 .10984 L .90476 .1039 L .90952 .09795 L .91429 .09201 L .91905 .08606 L .92381 .08012 L .92857 .07417 L .93333 .06822 L .9381 .06228 L .94286 .05633 L .94762 .05039 L .95238 .04444 L .95714 .0385 L .9619 .03255 L .96667 .02661 L .97143 .02066 L .97619 .01472 L Mistroke Mfstroke % End of Graphics MathPictureEnd \ \>"], "Graphics", CellLabel->"From In[331]:=", ImageSize->{288, 177.938}, ImageMargins->{{43, 0}, {0, 0}}, ImageRegion->{{0, 1}, {0, 1}}, ImageCache->GraphicsData["Bitmap", "\<\ CF5dJ6E]HGAYHf4PAg9QL6QYHg?U]lcI03>IIIS>IVC>Ic3>Ioc?<03?<[ZjWAdM:NWYj0Pl=WIfJj^[WMgMl30`?l_0?m70?mO0?mg0?n?0?nW0?no 0?oG0?o_0?Oo0=oo00000`40000300040@000C<00`4300040@000@8000@10001<0030@<000<100000`001040004a0004 0@000@8000@100010P001040004200005@000`40000h00@10`020CH000<100000P020@@00P4c0004 0@0000@10`020C<00P44008110020@<0000E00030@000?l02@0000h0o`4@0@<0000E00030@0100X0 00<100002P000`40000900030@0000X000<100002P000`40000:00030@0000X000<100002P000`40 000900030@0000X000<100002P000`40000:00030@0000X000<100002P000`40000900030@0000X0 00<100002P000`40000:00030@0000X000<100002@020@T0000E00040@010C`000<10000?@000`40 000m00030@0003`000<100402@0001D000D100000@3i00030@0000X0000E00030@00008000<10000 mP000`40000:00005@000`40000200030@000?D000<100002`0001D000<100000`000`40003c0003 0@0000`0000E008110020O<000<100003@0001D000<100001@000`40003_00030@0000h0000E0003 0@0000H000<10000kP000`40000>00005@000`40000600030@000>d000<100003`0001D000<10000 1`000`40003[00030@000100000E00030@0000P000<10000j@000`40000A00005@020@T000<10000 j0000`40000B00005@000`40000900030@000>L000<100004P0001D000<100002P000`40003U0003 0@0001<0000E00030@0000/000<10000h`000`40000D00005@000`40000<00030@000>4000<10000 5@0001D000<1000030020N4000<100005P0001D00P4?00030@000=d000<100005`0001D000<10000 3`000`40003L00030@0001L0000E00030@0000l000<10000f`000`40000H00005@000`40000@0003 0@000=X000<10000600001D000<1000040000`40003H00816`0001D000<100004@000`40003F0003 0@0001/0000E00030@00018000<10000e@000`40000K00005@020A@000<10000d`000`40000L0000 5@000`40000D00030@000=4000<100007@0001D000<100005@000`40003?00030@0001h0000E0003 0@0001D000<10000cP000`40000O00005@000`40000F00030@000@000`4000260003 0@0004<0000E00030@0003X000<10000Q@000`40001300005@000`40000j0081Q@000`4000140000 5@020Cd000<10000P@000`40001500005@000`40000m00030@00080000<10000A@0001D000<10000 ?@000`40001n0081B00001D000<10000?P000`40001l00030@0004P0000E00030@0003l000<10000 N`000`40001800005@000`40001000030@0007T000<10000B@0001D00P5200030@0007P000<10000 B@0001D000<10000@@000`40001f0081C00001D000<10000@P000`40001d00030@0004`0000E0003 0@0004<000<10000L`000`40001<00005@000`4000130081L`000`40001=00005@000`4000150003 0@0006l000<10000CP0001D000<10000AP000`40001^00030@0004h0000E0081A`000`40001]0003 0@0004l0000E00030@0004L000<10000J`000`40001@00005@000`4000170081J`000`40001A0000 5@000`40001900030@0006L000<10000DP0001D000<10000BP000`40001V00030@00058000020081 10000`40000300811@000`40001:00030@0006D000<10000D`0000050040004020001040004400<1 B`000`40001S00030@0005@000001@01000100/000<100000P000`40001<00030@00064000<10000 E@000005004000402@020@D000<10000C0000`40001P00030@0005H000001@01000100/000<10000 0P000`40001=00030@0005l000<10000EP0000050040004020001040004400030@0004h000<10000 G@000`40001G00000P020@X00P4500030@0004l000<10000F`000`40001H00005@020E4000<10000 F@000`40001I00005@000`40001@0081F@000`40001J00005@000`40001B00030@0005D000<10000 F`0001D000<10000D`000`40001D00030@0005/0000E00030@0005<000<10000D`000`40001L0000 5@000`40001D00030@00058000<10000G00001D000<10000E0000`40001@0081G`0001D00P5F0003 0@0004h000<10000G`0001D000<10000EP000`40001=00030@0005l0000E00030@0005L000<10000 B`000`40001P00005@000`40001H00030@0004T000<10000H@0001D000<10000F@000`4000170003 0@000680000E00030@0005T000<10000AP000`40001S00005@020E/000<10000A@000`40001S0000 5@000`40001K00030@0004<000<10000I00001D000<10000G0000`40001100030@0006D0000E0003 0@0005d000<10000@0000`40001U00005@000`40001M00030@0003h00P5X00005@000`40001N0003 0@0003`000<10000J00001D00P5P00030@0003/000<10000J00001D000<10000H0000`40000i0003 0@0006T0000E00030@00064000<10000>0000`40001Y00005@000`40001Q00030@0003H00P5/0000 5@000`40001R00030@0003@000<10000K00000800P4400030@0000@000<100000`000`40001S0003 0@0003<000<10000K0000005004000402P000`40000300030@0006@000<10000<@000`40001]0000 00D00@000@0700D110030FD000<10000;`000`40001^000000D00@000@0700040@000@D000<10000 IP000`40000^00030@0006h000001@01000100P000<100401@000`40001V00030@0002d000<10000 K`000005004000402@020@D000<10000I`000`40000[00030@000700000200812`000`4000030003 0@0006L00P4[00030@000740000E00030@0006T000<100009`000`40001b00005@020F/000<10000 9P000`40001b00005@000`40001Z00030@0002@00P5e00005@000`40001[00030@00028000<10000 M@0001D000<10000K0000`40000Q00030@0007D0000E00030@0006d000<100007`000`40001f0000 5@000`40001^00030@0001h000<10000MP0001D000<10000KP000`40000M00030@0007L0000E0081 L0000`40000K00030@0007P0000E00030@00070000<100006@000`40001i00005@000`40001`0081 6@000`40001j00005@000`40001b00030@0001D000<10000N`0001D000<10000L`000`40000D0003 0@0007/0000E00030@0007<000<100004`000`40001l00005@020GD000<100004@000`40001m0000 5@000`40001d00030@00010000<10000OP0001D000<10000M@000`40000>00030@0007l0000E0003 0@0007H000<100003@000`40001o00005@000`40001g00030@0000/000<10000P00001D000<10000 N0000`40000900030@000840000E0081NP000`40000700030@000880000E00030@0007T000<10000 1P000`40002300005@000`40001j00030@0000D000<10000P`0001D000<10000N`000`4000030003 0@0008@0000E00030@0007`000D100000@2700000P020@@000<100000P030@D000<10000O@000`40 0@28000000D00@000@0;00030@00008000<10000O@020HT000001@01000100/000<100000P030Ol0 2@0000050040004020030@D000<10000o`09000000D00@000@0800030@0000D000<10000o`090000 00D00@000@0800030@0000D000<10000o`0900000P020@T0107o01000000\ \>"], ImageRangeCache->{{{161, 448}, {586.312, 409.375}} -> {-142.127, 1.24423, 0.779335, 0.00313664}}] }, Open ]], Cell[TextData[{ "\nHere is the plot of the solution vector for ", StyleBox["t=nt", FontSlant->"Italic"], "." }], "Text"], Cell[CellGroupData[{ Cell["ListPlot[tabmcode[1,nt,nx],PlotJoined->True];", "Input", CellLabel->"In[333]:="], Cell[GraphicsData["PostScript", "\<\ %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart /Mabs { Mgmatrix idtransform Mtmatrix dtransform } bind def /Mabsadd { Mabs 3 -1 roll add 3 1 roll add exch } bind def %% Graphics %%IncludeResource: font Courier %%IncludeFont: Courier /Courier findfont 10 scalefont setfont % Scaling calculations 0.0238095 0.0047619 0.0147151 1.41513 [ [.2619 .00222 -6 -9 ] [.2619 .00222 6 0 ] [.5 .00222 -9 -9 ] [.5 .00222 9 0 ] [.7381 .00222 -9 -9 ] [.7381 .00222 9 0 ] [.97619 .00222 -9 -9 ] [.97619 .00222 9 0 ] [.01131 .15623 -18 -4.5 ] [.01131 .15623 0 4.5 ] [.01131 .29774 -18 -4.5 ] [.01131 .29774 0 4.5 ] [.01131 .43926 -18 -4.5 ] [.01131 .43926 0 4.5 ] [.01131 .58077 -18 -4.5 ] [.01131 .58077 0 4.5 ] [ 0 0 0 0 ] [ 1 .61803 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath 0 g .25 Mabswid [ ] 0 setdash .2619 .01472 m .2619 .02097 L s [(50)] .2619 .00222 0 1 Mshowa .5 .01472 m .5 .02097 L s [(100)] .5 .00222 0 1 Mshowa .7381 .01472 m .7381 .02097 L s [(150)] .7381 .00222 0 1 Mshowa .97619 .01472 m .97619 .02097 L s [(200)] .97619 .00222 0 1 Mshowa .125 Mabswid .07143 .01472 m .07143 .01847 L s .11905 .01472 m .11905 .01847 L s .16667 .01472 m .16667 .01847 L s .21429 .01472 m .21429 .01847 L s .30952 .01472 m .30952 .01847 L s .35714 .01472 m .35714 .01847 L s .40476 .01472 m .40476 .01847 L s .45238 .01472 m .45238 .01847 L s .54762 .01472 m .54762 .01847 L s .59524 .01472 m .59524 .01847 L s .64286 .01472 m .64286 .01847 L s .69048 .01472 m .69048 .01847 L s .78571 .01472 m .78571 .01847 L s .83333 .01472 m .83333 .01847 L s .88095 .01472 m .88095 .01847 L s .92857 .01472 m .92857 .01847 L s .25 Mabswid 0 .01472 m 1 .01472 L s .02381 .15623 m .03006 .15623 L s [(0.1)] .01131 .15623 1 0 Mshowa .02381 .29774 m .03006 .29774 L s [(0.2)] .01131 .29774 1 0 Mshowa .02381 .43926 m .03006 .43926 L s [(0.3)] .01131 .43926 1 0 Mshowa .02381 .58077 m .03006 .58077 L s [(0.4)] .01131 .58077 1 0 Mshowa .125 Mabswid .02381 .04302 m .02756 .04302 L s .02381 .07132 m .02756 .07132 L s .02381 .09962 m .02756 .09962 L s .02381 .12793 m .02756 .12793 L s .02381 .18453 m .02756 .18453 L s .02381 .21283 m .02756 .21283 L s .02381 .24114 m .02756 .24114 L s .02381 .26944 m .02756 .26944 L s .02381 .32604 m .02756 .32604 L s .02381 .35435 m .02756 .35435 L s .02381 .38265 m .02756 .38265 L s .02381 .41095 m .02756 .41095 L s .02381 .46756 m .02756 .46756 L s .02381 .49586 m .02756 .49586 L s .02381 .52416 m .02756 .52416 L s .02381 .55247 m .02756 .55247 L s .02381 .60907 m .02756 .60907 L s .25 Mabswid .02381 0 m .02381 .61803 L s 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath .5 Mabswid .02857 .01472 m .03333 .02183 L .0381 .02894 L .04286 .03605 L .04762 .04316 L .05238 .05027 L .05714 .05738 L .0619 .06449 L .06667 .0716 L .07143 .07872 L .07619 .08583 L .08095 .09294 L .08571 .10005 L .09048 .10716 L .09524 .11427 L .1 .12138 L .10476 .12849 L .10952 .1356 L .11429 .14271 L .11905 .14982 L .12381 .15693 L .12857 .16404 L .13333 .17115 L .1381 .17826 L .14286 .18537 L .14762 .19248 L .15238 .19959 L .15714 .2067 L .1619 .21381 L .16667 .22091 L .17143 .22802 L .17619 .23512 L .18095 .24222 L .18571 .24933 L .19048 .25643 L .19524 .26352 L .2 .27062 L .20476 .27771 L .20952 .2848 L .21429 .29189 L .21905 .29897 L .22381 .30604 L .22857 .31312 L .23333 .32018 L .2381 .32724 L .24286 .33429 L .24762 .34133 L .25238 .34836 L .25714 .35538 L .2619 .36238 L Mistroke .26667 .36937 L .27143 .37635 L .27619 .3833 L .28095 .39024 L .28571 .39715 L .29048 .40403 L .29524 .41089 L .3 .41771 L .30476 .42451 L .30952 .43126 L .31429 .43797 L .31905 .44463 L .32381 .45125 L .32857 .45781 L .33333 .46431 L .3381 .47075 L .34286 .47711 L .34762 .4834 L .35238 .48961 L .35714 .49573 L .3619 .50176 L .36667 .50769 L .37143 .51351 L .37619 .51921 L .38095 .52479 L .38571 .53025 L .39048 .53557 L .39524 .54074 L .4 .54576 L .40476 .55062 L .40952 .55531 L .41429 .55983 L .41905 .56416 L .42381 .5683 L .42857 .57225 L .43333 .57599 L .4381 .57951 L .44286 .58282 L .44762 .58589 L .45238 .58874 L .45714 .59135 L .4619 .59371 L .46667 .59582 L .47143 .59768 L .47619 .59928 L .48095 .60062 L .48571 .6017 L .49048 .60251 L .49524 .60305 L .5 .60332 L Mistroke .50476 .60332 L .50952 .60305 L .51429 .60251 L .51905 .6017 L .52381 .60062 L .52857 .59928 L .53333 .59768 L .5381 .59582 L .54286 .59371 L .54762 .59135 L .55238 .58874 L .55714 .58589 L .5619 .58282 L .56667 .57951 L .57143 .57599 L .57619 .57225 L .58095 .5683 L .58571 .56416 L .59048 .55983 L .59524 .55531 L .6 .55062 L .60476 .54576 L .60952 .54074 L .61429 .53557 L .61905 .53025 L .62381 .52479 L .62857 .51921 L .63333 .51351 L .6381 .50769 L .64286 .50176 L .64762 .49573 L .65238 .48961 L .65714 .4834 L .6619 .47711 L .66667 .47075 L .67143 .46431 L .67619 .45781 L .68095 .45125 L .68571 .44463 L .69048 .43797 L .69524 .43126 L .7 .42451 L .70476 .41771 L .70952 .41089 L .71429 .40403 L .71905 .39715 L .72381 .39024 L .72857 .3833 L .73333 .37635 L .7381 .36937 L Mistroke .74286 .36238 L .74762 .35538 L .75238 .34836 L .75714 .34133 L .7619 .33429 L .76667 .32724 L .77143 .32018 L .77619 .31312 L .78095 .30604 L .78571 .29897 L .79048 .29189 L .79524 .2848 L .8 .27771 L .80476 .27062 L .80952 .26352 L .81429 .25643 L .81905 .24933 L .82381 .24222 L .82857 .23512 L .83333 .22802 L .8381 .22091 L .84286 .21381 L .84762 .2067 L .85238 .19959 L .85714 .19248 L .8619 .18537 L .86667 .17826 L .87143 .17115 L .87619 .16404 L .88095 .15693 L .88571 .14982 L .89048 .14271 L .89524 .1356 L .9 .12849 L .90476 .12138 L .90952 .11427 L .91429 .10716 L .91905 .10005 L .92381 .09294 L .92857 .08583 L .93333 .07872 L .9381 .0716 L .94286 .06449 L .94762 .05738 L .95238 .05027 L .95714 .04316 L .9619 .03605 L .96667 .02894 L .97143 .02183 L .97619 .01472 L Mistroke Mfstroke % End of Graphics MathPictureEnd \ \>"], "Graphics", CellLabel->"From In[333]:=", ImageSize->{288, 177.938}, ImageMargins->{{43, 0}, {0, 0}}, ImageRegion->{{0, 1}, {0, 1}}, ImageCache->GraphicsData["Bitmap", "\<\ CF5dJ6E]HGAYHf4PAg9QL6QYHg?U]lcI03>IIIS>IVC>Ic3>Ioc?<03?<[ZjWAdM:NWYj0Pl=WIfJj^[WMgMl30`?l_0?m70?mO0?mg0?n?0?nW0?no 0?oG0?o_0?Oo0=oo00040@<00P4f00030@0000800P440081<`00104000040@<0 0P4c008110020@@00P4300005@000`40003o00T0000E00030@000?l02@0000h0o`4@0@<0000E0003 0@0100X000<100002P000`40000900030@0000X000<100002P000`40000:00030@0000X000<10000 2P000`40000900030@0000X000<100002P000`40000:00030@0000X000<100002P000`4000090003 0@0000X000<100002P000`40000:00030@0000X000<100002@020@T0000E00030@0103d000<10000 ?@000`40000m00030@0003`000<100402@0001D000@10001n`000`40000900005@001@4000010?T0 00<100002P0001D000<100000P000`40003f00030@0000X0000E00030@00008000<10000m@000`40 000;00005@000`40000300030@000?<000<10000300001D00P4400030@000?8000<100003@0001D0 00<1000010000`40003a00030@0000d0000E00030@0000D000<10000k`000`40000>00005@000`40 000600030@000>d000<100003`0001D000<100001`000`40003/00030@0000l0000E00030@0000L0 00<10000j`000`40000@00005@000`40000800030@000>T000<100004@0001D00P4900030@000>P0 00<100004P0001D000<100002@000`40003W00030@000180000E00030@0000X000<10000i@000`40 000C00005@000`40000;00030@000>@000<100004`0001D000<100002`000`40003S00030@0001@0 000E00030@0000`000<10000h@000`40000E00005@000`40000<00030@000>0000<100005P0001D0 00<100003@000`40003O00030@0001H0000E00813`000`40003M00030@0001L0000E00030@0000l0 00<10000g0000`40000G00005@000`40000?00030@000=/000<10000600001D000<1000040000`40 003J00030@0001P0000E00030@00010000<10000f@000`40000I00005@000`40000A00030@000=L0 00<100006P0001D000<100004@000`40003F00030@0001/0000E00814`000`40003E00030@0001/0 000E00030@0001<000<10000d`000`40000L00005@000`40000D00030@000=8000<10000700001D0 00<1000050000`40003@00817`0001D000<100005@000`40003>00030@0001l0000E00030@0001H0 00<10000c@000`40000O00005@000`40000G00030@00000001D000<10000<0000`40002I00030@0003T00002008110000`40 000200@110000`40000`00030@0009P000<10000>P0000050040004020000`40000500<1<@000`40 002G00030@0003X000001@01000100T000<1000010000`40000a0081U`000`40000k000000D00@00 0@0:00030@0000<000<10000<`000`40002C00030@0003`000001@01000100/000<100000P000`40 000d00030@00098000<10000?00000050040004020001040004400030@0003@000<10000T@000`40 000m00000P020@X00P4500030@0003D000<10000S`000`40000n00005@000`40000e00030@0008h0 00<10000?`0001D000<10000=P000`40002=00030@0003l0000E0081>0000`40002;00030@000400 000E00030@0003P000<10000RP000`40001000005@000`40000h00030@0008T000<10000@@0001D0 00<10000>@000`40002700030@000480000E00030@0003T000<10000QP000`40001300005@000`40 000j00030@0008D000<10000@`0001D000<10000>P000`40002400030@0004@0000E0081?0000`40 002300030@0004@0000E00030@0003`000<10000P@000`40001500005@000`40000m00030@000800 00<10000A@0001D000<10000?@000`40001n0081B00001D000<10000?P000`40001l00030@0004P0 000E00030@0003l000<10000N`000`40001800005@000`40001000030@0007T000<10000B@0001D0 00<10000@@000`40001h00030@0004T0000E0081@P000`40001g00030@0004X0000E00030@000480 00<10000M@000`40001;00005@000`40001200030@0007@000<10000C00001D000<10000@`000`40 001c00030@0004`0000E00030@0004<000<10000LP000`40001=00005@000`40001400030@000740 00<10000C@0001D000<10000A@000`40001_00030@0004h0000E00030@0004H000<10000KP000`40 001>00005@020DL000<10000K@000`40001?00005@000`40001700030@0006/000<10000D00001D0 00<10000A`020F/000<10000D@0001D000<10000B@000`40001W00030@000580000E00030@0004X0 00<10000IP000`40001B00005@000`40001:00030@0006D000<10000D`0000800P4400030@0000<0 0P4500030@0004/000<10000I0000`40001C000000D00@000@0800040@000@@00`5;00030@0006<0 00<10000E0000005004000402`000`40000200030@0004`000<10000H@000`40001E000000D00@00 0@0900811@000`40001<00030@00060000<10000EP000005004000402`000`40000200030@0004d0 00<10000G`000`40001F000000D00@000@0800040@000@@000<10000CP000`40001M00030@0005L0 000200812P020@D000<10000C`000`40001K00030@0005P0000E00030@00050000<10000F@000`40 001I00005@000`40001@00030@0005P000<10000FP0001D00P5B00030@0005L000<10000FP0001D0 00<10000DP000`40001E00030@0005/0000E00030@0005<000<10000E0000`40001K00005@000`40 001C00030@0005<000<10000G00001D000<10000E0000`40001A00030@0005d0000E00030@0005D0 00<10000C`000`40001N00005@000`40001E00030@0004h000<10000G`0001D000<10000EP000`40 001=00030@0005l0000E0081F0000`40001;00030@000600000E00030@0005P000<10000B@000`40 001Q00005@000`40001I00030@0004L000<10000HP0001D000<10000F@020DL000<10000H`0001D0 00<10000F`000`40001300030@0006@0000E00030@0005`000<10000@P000`40001T00005@000`40 001L00030@00044000<10000I@0001D00P5N00030@0003l000<10000IP0001D000<10000GP000`40 000m00030@0006L0000E00030@0005h00P4m00030@0006P0000E00030@00060000<10000>@000`40 001Y00005@000`40001Q00030@0003P000<10000J@0001D000<10000H@000`40000f0081K00001D0 00<10000HP020CD000<10000K00001D000<10000I0000`40000a00030@0006d0000E0081IP000`40 000`00030@0006d0000E00030@0006D000<10000;`000`40001^00005@000`40001V00030@0002`0 0P5a00005@000`40001W0081:`000`40001a00005@000`40001Y00030@0002L000<10000LP0001D0 00<10000JP000`40000T0081M@0000800P4400030@0000@000<100000`000`40001[00818`000`40 001e000000D00@000@0:00030@0000<00`5]00030@0001l000<10000MP000005004000401`050@@0 00<10000KP000`40000M00030@0007L000001@01000100L000@100011@000`40001_00030@0001X0 0P5j000000D00@000@0800030@0100D000<10000L0030AL00P5l000000D00@000@0900811@000`40 001c00030@0001800P5n00000P020@/000<100000`000`40001d00@13@030H00000E00030@0007P0 1@4200H1P`0001D000<10000O@020HT0000E0081o`0:00005@000`40003o00T0000E00030@000?l0 2@000?l08@000001\ \>"], ImageRangeCache->{{{161, 448}, {295.938, 119}} -> {-142.127, 0.277017, 0.779335, 0.00262245}}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["5. Conclusions", "Section"], Cell[TextData[{ "As we remarked in the Introduction, any PDE solver can only be incomplete, \ and the question really is one of the degree of completeness. Our PDE solver \ is incomplete at present in that it supports only explicit finite-difference \ schemes and is restricted to one spatial dimension and time. On the other \ hand, it has some definite advantages. Firstly, it is possible for the user \ to specify the approximation method, and the solver can transform the PDE \ based on that. Secondly, using the code generator , we are able to get C++ \ code that runs several orders faster than the ", StyleBox["Mathematica", FontSlant->"Italic"], " code. Thirdly, it is possible, in principle, to generate any \ finite-difference scheme (not necessarily explicit ones) using the functions \ that our package provides, although we have restricted ourselves to explicit \ schemes in our numerical computations. As a result, our package provides the \ user with a high-level interface to specify the PDE problem and the solution \ technique and generates an efficient C++ code for performing the numerical \ computation.\n\nIn the future, we plan to work along two directions. Our \ initial motivation for developing a PDE solver was to provide PDE support for \ the Modelica language [Mode99, Pelab99] within the ", StyleBox["Mathematica", FontSlant->"Italic"], " environment. Our package can serve this purpose since it is written in ", StyleBox["Mathematica,", FontSlant->"Italic"], " and there is presently some work in progress on developing Modelica \ syntax in a ", StyleBox["Mathematica", FontSlant->"Italic"], " environment [MathMod98]. The second direction of work will focus on \ developing a PDE ", StyleBox["analyzer", FontSlant->"Italic"], ", which will perform some preliminary analysis of the PDE problem and \ select a suitable approximation method by making a pattern matching with a \ library of PDEs and solution techniques. The analyzer will then employ a ", StyleBox["synthesizer, ", FontSlant->"Italic"], "which will actually perform the numerical computation, and can be any one \ of the available solvers. In case no available solver suits the suggested \ technique, the present model of code generation can be employed, thus \ providing a PDE solver with a high degree of completeness." }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["References", "Section"], Cell[TextData[{ StyleBox["[Ames92] Willam F. Ames, ", FontSlant->"Plain"], "Numerical Methods for Partial Differential Equations", StyleBox[", Academic Press, 1992. \n\n[Fritz98] Peter Fritzson, ", FontSlant->"Plain"], "MathCode C++", StyleBox[ ", published by MathCore (www.mathcore.com), 1998.\n\n[Ganza96] Victor G. \ Ganzha and Evgenii V. Vorozhtsov, ", FontSlant->"Plain"], "Numerical Solutions for Partial Differential Equations: Problems Solving \ Using ", StyleBox["Mathematica,", FontSlant->"Italic"], StyleBox[ " CRC Press, 1996.\n\n[Gust95] Bertil Gustafsson, Heinz-Otto Kreiss and \ Joseph Oliger, ", FontSlant->"Plain"], "Time Dependent Problems and Difference Methods, ", StyleBox[ "John Wiley & Sons, Inc., 1995.\n\n[MathMod98] Peter Fritzson, Vadim \ Engelson and Johan Gunnarsson, An Integrated Modelica Environment for \ Modeling, Documentation and Simulation, in ", FontSlant->"Plain"], "Proceedings of SCSC-98 (Summer Computer Simulation Conference)", StyleBox[", Reno, Nevada, July 1998.\n\n[MinOh95] Min Oh, ", FontSlant->"Plain"], "Modelling and simulation of combined lumped and distributed processes,", StyleBox[ " Ph.D thesis, University of London, 1995.\n\n[Mode99] Modelica homepage \ (www.modelica.org).\n\n[Pelab99] PELAB - Programming Environment \ Laboratory, Department of Computer Science, Link\[ODoubleDot]ping \ University, Sweden (www.ida.liu.se/~pelab/modelica).", FontSlant->"Plain"] }], "Text", FontSlant->"Italic"] }, Open ]] }, Open ]] }, FrontEndVersion->"X 3.0", ScreenRectangle->{{0, 1280}, {0, 1024}}, ScreenStyleEnvironment->"Printout", PrintingStyleEnvironment->"Printout", WindowToolbars->"RulerBar", WindowSize->{849, 559}, WindowMargins->{{177, Automatic}, {Automatic, 130}}, PrintingCopies->1, PrintingPageRange->{Automatic, Automatic}, PrintingOptions->{"PrintingMargins"->{{54, 54}, {72, 72}}, "PaperSize"->{612, 792}, "PaperOrientation"->"Portrait", "PrintCellBrackets"->False, "PrintRegistrationMarks"->False, "PrintMultipleHorizontalPages"->False, "Magnification"->1}, PrivateFontOptions->{"FontType"->"Outline"}, Magnification->1.5, StyleDefinitions -> Notebook[{ Cell[CellGroupData[{ Cell["Style Definitions", "Subtitle"], Cell["\<\ Modify the definitions below to change the default appearance of all cells in \ a given style. Make modifications to any definition using commands in the Format menu.\ \>", "Text"], Cell[CellGroupData[{ Cell["Style Environment Names", "Section"], Cell[StyleData[All, "Working"], ScriptMinSize->9], Cell[StyleData[All, "Printout"], PageWidth->PaperWidth, ShowCellLabel->False, CellFrameLabelMargins->6, ImageSize->{200, 200}, PrivateFontOptions->{"FontType"->"Outline"}] }, Closed]], Cell[CellGroupData[{ Cell["Notebook Options", "Section"], Cell["\<\ The options defined for the style below will be used at the Notebook level.\ \>", "Text"], Cell[StyleData["Notebook"], PageHeaders->{{Cell[ TextData[ { CounterBox[ "Page"]}], "PageNumber"], None, Cell[ TextData[ { ValueBox[ "FileName"]}], "Header"]}, {Cell[ TextData[ { ValueBox[ "FileName"]}], "Header"], None, Cell[ TextData[ { CounterBox[ "Page"]}], "PageNumber"]}}, PageHeaderLines->{True, True}, PrintingOptions->{"FirstPageHeader"->False, "FacingPages"->True}, CellLabelAutoDelete->False, CellFrameLabelMargins->6, StyleMenuListing->None] }, Closed]], Cell[CellGroupData[{ Cell["Styles for Headings", "Section"], Cell[CellGroupData[{ Cell[StyleData["Title"], CellFrame->{{0, 0}, {0, 0.5}}, CellMargins->{{18, 10}, {4, 20}}, CellGroupingRules->{"TitleGrouping", 0}, PageBreakBelow->False, CellFrameMargins->9, LineSpacing->{0.95, 0}, CounterIncrements->"Title", CounterAssignments->{{"Section", 0}, {"Equation", 0}, {"Figure", 0}}, FontFamily->"Helvetica", FontSize->36, FontWeight->"Bold"], Cell[StyleData["Title", "Printout"], CellMargins->{{18, 4}, {0, 0}}, CellFrameMargins->4, FontSize->24] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Subtitle"], CellMargins->{{18, 10}, {0, 10}}, CellGroupingRules->{"TitleGrouping", 10}, PageBreakBelow->False, LineSpacing->{1, 0}, CounterIncrements->"Subtitle", CounterAssignments->{{"Section", 0}, {"Equation", 0}, {"Figure", 0}}, FontFamily->"Helvetica", FontSize->24], Cell[StyleData["Subtitle", "Printout"], FontSize->18] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["SectionFirst"], CellFrame->{{0, 0}, {0, 3}}, CellMargins->{{18, 10}, {10, 30}}, CellGroupingRules->{"SectionGrouping", 40}, PageBreakBelow->False, CellFrameMargins->5, CounterIncrements->"Section", CounterAssignments->{{"Subsection", 0}, {"Subsubsection", 0}}, FontFamily->"Helvetica", FontSize->18, FontWeight->"Bold"], Cell[StyleData["SectionFirst", "Printout"], CellMargins->{{18, 4}, {10, 30}}, FontSize->14] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Section"], CellMargins->{{18, 10}, {10, 30}}, CellGroupingRules->{"SectionGrouping", 40}, PageBreakBelow->False, CounterIncrements->"Section", CounterAssignments->{{"Subsection", 0}, {"Subsubsection", 0}}, FontFamily->"Helvetica", FontSize->18, FontWeight->"Bold"], Cell[StyleData["Section", "Printout"], CellMargins->{{18, 4}, {10, 30}}, PageBreakBelow->Automatic, FontSize->14] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["Subsection"], CellDingbat->"\[FilledSquare]", CellMargins->{{18, 50}, {10, 26}}, CellGroupingRules->{"SectionGrouping", 50}, PageBreakBelow->False, CounterIncrements->"Subsection", CounterAssignments->{{"Subsubsection", 0}}, FontFamily->"Helvetica", FontSize->14, FontWeight->"Bold"], Cell[StyleData["Subsection", "Printout"], FontSize->12] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Subsubsection"], CellDingbat->"\[FilledSmallSquare]", CellMargins->{{18, 50}, {6, 20}}, CellGroupingRules->{"SectionGrouping", 60}, PageBreakBelow->False, CounterIncrements->"Subsubsection", FontFamily->"Helvetica", FontSize->12, FontWeight->"Bold"], Cell[StyleData["Subsubsection", "Printout"], FontSize->10] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell["Styles for Body Text", "Section"], Cell[CellGroupData[{ Cell[StyleData["Text"], CellMargins->{{18, 10}, {Inherited, 4}}, TextJustification->1, LineSpacing->{1, 3}, CounterIncrements->"Text"], Cell[StyleData["Text", "Printout"], CellMargins->{{18, 4}, {Inherited, 0}}, LineSpacing->{1, 3}, FontSize->10] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Caption"], CellMargins->{{55, 55}, {5, 4}}, PageBreakAbove->False, FontFamily->"Helvetica", FontSize->9], Cell[StyleData["Caption", "Printout"], FontSize->8] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Styles for Input/Output", "Section"], Cell["\<\ The cells in this section define styles used for input and output to the \ kernel. Be careful when modifying, renaming, or removing these styles, \ because the front end associates special meanings with these style names.\ \>", "Text"], Cell[CellGroupData[{ Cell[StyleData["Input"], CellFrame->{{1, 1}, {0, 1}}, CellMargins->{{55, 10}, {0, 10}}, Evaluatable->True, CellGroupingRules->"InputGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, CellLabelMargins->{{23, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultInputFormatType, AutoItalicWords->{}, FormatType->InputForm, ShowStringCharacters->True, NumberMarks->True, CounterIncrements->"Input", FontWeight->"Bold", Background->GrayLevel[0.850004]], Cell[StyleData["Input", "Printout"], CellMargins->{{55, 55}, {0, 10}}, ShowCellLabel->False, FontSize->10] }, Closed]], Cell[StyleData["InlineInput"], Evaluatable->True, CellGroupingRules->"InputGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, DefaultFormatType->DefaultInputFormatType, AutoItalicWords->{}, FormatType->InputForm, ShowStringCharacters->True, NumberMarks->True, CounterIncrements->"Input", FontWeight->"Bold"], Cell[CellGroupData[{ Cell[StyleData["Output"], CellFrame->{{1, 1}, {1, 0}}, CellMargins->{{55, 10}, {10, 0}}, CellEditDuplicate->True, CellGroupingRules->"OutputGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, CellLabelMargins->{{23, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultOutputFormatType, AutoItalicWords->{}, FormatType->InputForm, CounterIncrements->"Output", Background->GrayLevel[0.850004]], Cell[StyleData["Output", "Printout"], CellMargins->{{55, 55}, {10, 0}}, ShowCellLabel->False, FontSize->10] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["InputOnly"], CellFrame->1, CellMargins->{{55, 10}, {0, 10}}, Evaluatable->True, CellGroupingRules->"InputGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, CellLabelMargins->{{23, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultInputFormatType, AutoItalicWords->{}, FormatType->InputForm, ShowStringCharacters->True, NumberMarks->True, CounterIncrements->"Input", FontWeight->"Bold", Background->GrayLevel[0.850004]], Cell[StyleData["InputOnly", "Printout"], CellMargins->{{55, 55}, {0, 10}}, ShowCellLabel->False, FontSize->10] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Message"], CellFrame->{{1, 1}, {0, 0}}, CellDingbat->"\[LongDash]", CellMargins->{{55, 10}, {0, 0}}, CellGroupingRules->"OutputGrouping", PageBreakWithin->False, GroupPageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, ShowCellLabel->False, CellLabelMargins->{{23, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultOutputFormatType, AutoItalicWords->{}, FormatType->InputForm, CounterIncrements->"Message", StyleMenuListing->None, FontFamily->"Helvetica", FontSize->10, FontSlant->"Oblique"], Cell[StyleData["Message", "Printout"], CellMargins->{{55, 55}, {0, 0}}, FontSize->8] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Print"], CellMargins->{{55, 26}, {1, 6}}, CellGroupingRules->"OutputGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, ShowCellLabel->False, CellLabelMargins->{{23, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultOutputFormatType, TextAlignment->Left, AutoItalicWords->{}, FormatType->InputForm, CounterIncrements->"Print", StyleMenuListing->None, Background->GrayLevel[0.700008]], Cell[StyleData["Print", "Printout"], CellMargins->{{54, 72}, {2, 6}}, FontSize->10] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Graphics"], CellFrame->{{1, 1}, {0, 0}}, CellMargins->{{55, 10}, {0, 0}}, CellGroupingRules->"GraphicsGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, ShowCellLabel->False, DefaultFormatType->DefaultOutputFormatType, FormatType->InputForm, CounterIncrements->"Graphics", ImageMargins->{{35, Inherited}, {Inherited, 0}}, StyleMenuListing->None, Background->GrayLevel[0.850004]], Cell[StyleData["Graphics", "Printout"], CellMargins->{{55, 55}, {0, 0}}, ImageSize->{0.0625, 0.0625}] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["CellLabel"], StyleMenuListing->None, FontFamily->"Helvetica", FontSize->9, FontSlant->"Oblique"], Cell[StyleData["CellLabel", "Printout"], CellMargins->{{0, Inherited}, {Inherited, Inherited}}, FontSize->8] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Unique Styles", "Section"], Cell[CellGroupData[{ Cell[StyleData["Author"], CellMargins->{{20, Inherited}, {2, 20}}, CellGroupingRules->{"TitleGrouping", 20}, PageBreakBelow->False, CounterAssignments->{{"Section", 0}, {"Equation", 0}, {"Figure", 0}}, FontFamily->"Helvetica", FontSize->14, FontSlant->"Italic"], Cell[StyleData["Author", "Printout"], CellMargins->{{36, Inherited}, {2, 30}}, FontSize->12] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Address"], CellMargins->{{18, Inherited}, {2, 2}}, CellGroupingRules->{"TitleGrouping", 30}, PageBreakBelow->False, LineSpacing->{1, 1}, CounterAssignments->{{"Section", 0}, {"Equation", 0}, {"Figure", 0}}, FontFamily->"Helvetica", FontSlant->"Italic"], Cell[StyleData["Address", "Printout"], CellMargins->{{36, Inherited}, {2, 2}}, FontSize->10] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Abstract"], CellFrame->False, CellMargins->{{45, 75}, {Inherited, 30}}, LineSpacing->{1, 1}], Cell[StyleData["Abstract", "Printout"], CellMargins->{{36, 67}, {Inherited, 50}}, FontSize->10] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Reference"], CellMargins->{{18, 40}, {Inherited, 0}}, TextJustification->1, LineSpacing->{1, 0}], Cell[StyleData["Reference", "Printout"], FontSize->8] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["PictureGroup"], CellFrame->{{1, 1}, {0, 0}}, CellMargins->{{55, Inherited}, {0, 0}}, CellGroupingRules->"GraphicsGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, ShowCellLabel->False, CounterIncrements->"Graphics", ImageMargins->{{35, Inherited}, {Inherited, 0}}, StyleMenuListing->None, Background->GrayLevel[0.850004]], Cell[StyleData["PictureGroup", "Printout"], CellMargins->{{55, Inherited}, {0, 0}}, ImageSize->{0.0625, 0.0625}] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Styles for Automatic Numbering", "Section"], Cell["\<\ The following styles are useful for numbered equations, figures, etc. They \ automatically give the cell a FrameLabel containing a reference to a \ particular counter, and also increment that counter.\ \>", "Text"], Cell[CellGroupData[{ Cell[StyleData["NumberedEquation"], CellMargins->{{55, 10}, {2, 10}}, CellFrameLabels->{{None, Cell[ TextData[ {"(", CounterBox[ "NumberedEquation"], ")"}], FontFamily -> "Helvetica", FontSize -> 10, FontWeight -> "Bold"]}, { None, None}}, DefaultFormatType->DefaultInputFormatType, CounterIncrements->"NumberedEquation", FormatTypeAutoConvert->False], Cell[StyleData["NumberedEquation", "Printout"], CellFrameLabels->{{None, Cell[ TextData[ {"(", CounterBox[ "NumberedEquation"], ")"}], FontFamily -> "Helvetica", FontSize -> 8, FontWeight -> "Bold"]}, { None, None}}] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["NumberedFigure"], CellMargins->{{55, 145}, {2, 10}}, CellFrameLabels->{{None, None}, {Cell[ TextData[ {"Figure ", CounterBox[ "NumberedFigure"]}], FontFamily -> "Helvetica", FontSize -> 10, FontWeight -> "Bold"], None}}, TextAlignment->Left, CounterIncrements->"NumberedFigure", FormatTypeAutoConvert->False], Cell[StyleData["NumberedFigure", "Printout"], CellFrameLabels->{{None, None}, {Cell[ TextData[ {"Figure ", CounterBox[ "NumberedFigure"]}], FontFamily -> "Helvetica", FontSize -> 8, FontWeight -> "Bold"], None}}] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["NumberedTable"], CellMargins->{{55, 145}, {2, 10}}, CellFrameLabels->{{None, None}, {Cell[ TextData[ {"Table ", CounterBox[ "NumberedTable"]}], FontFamily -> "Helvetica", FontSize -> 10, FontWeight -> "Bold"], None}}, TextAlignment->Center, CounterIncrements->"NumberedTable", FormatTypeAutoConvert->False], Cell[StyleData["NumberedTable", "Printout"], CellFrameLabels->{{None, None}, {Cell[ TextData[ {"Table ", CounterBox[ "NumberedTable"]}], FontFamily -> "Helvetica", FontSize -> 8, FontWeight -> "Bold"], None}}] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Formulas and Programming", "Section"], Cell[CellGroupData[{ Cell[StyleData["DisplayFormula"], CellMargins->{{55, 10}, {2, 10}}, CellHorizontalScrolling->True, DefaultFormatType->DefaultInputFormatType, ScriptLevel->0, SingleLetterItalics->True, UnderoverscriptBoxOptions->{LimitsPositioning->True}], Cell[StyleData["DisplayFormula", "Printout"], FontSize->10] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["ChemicalFormula"], CellMargins->{{55, 10}, {2, 10}}, DefaultFormatType->DefaultInputFormatType, AutoSpacing->False, ScriptLevel->1, ScriptBaselineShifts->{0.6, Automatic}, SingleLetterItalics->False, ZeroWidthTimes->True], Cell[StyleData["ChemicalFormula", "Printout"], FontSize->10] }, Closed]], Cell[CellGroupData[{ Cell[StyleData["Program"], CellMargins->{{18, 10}, {Inherited, 6}}, FontFamily->"Courier"], Cell[StyleData["Program", "Printout"], CellMargins->{{18, 30}, {Inherited, 4}}, FontSize->9.5] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Styles for Headers and Footers", "Section"], Cell[StyleData["Header"], StyleMenuListing->None, FontFamily->"Helvetica", FontSize->9], Cell[StyleData["PageNumber"], StyleMenuListing->None, FontFamily->"Helvetica", FontSize->9, FontWeight->"Bold"], Cell[StyleData["Footer"], StyleMenuListing->None, FontFamily->"Helvetica", FontSize->7] }, Closed]] }, Open ]] }] ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1731, 51, 104, 5, 144, "Title"], Cell[1838, 58, 315, 13, 201, "Text"], Cell[CellGroupData[{ Cell[2178, 75, 27, 0, 80, "Section"], Cell[2208, 77, 989, 20, 131, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[3234, 102, 34, 0, 80, "Section"], Cell[3271, 104, 4429, 101, 605, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[7737, 210, 50, 0, 80, "Section"], Cell[7790, 212, 3543, 66, 615, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[11370, 283, 37, 0, 80, "Section"], Cell[11410, 285, 1758, 31, 275, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[13205, 321, 52, 0, 80, "Section"], Cell[13260, 323, 173, 3, 41, "Text"], Cell[13436, 328, 433, 14, 59, "Text"], Cell[13872, 344, 51, 3, 41, "Text"], Cell[13926, 349, 591, 28, 47, "Text"], Cell[14520, 379, 51, 3, 41, "Text"], Cell[14574, 384, 389, 20, 44, "Text"], Cell[14966, 406, 463, 12, 77, "Text"], Cell[15432, 420, 1077, 55, 44, "Text"], Cell[16512, 477, 1300, 41, 167, "Text"], Cell[17815, 520, 5245, 129, 339, "Input"], Cell[23063, 651, 3186, 67, 597, "Text"], Cell[CellGroupData[{ Cell[26274, 722, 83, 1, 56, "Input"], Cell[26360, 725, 35, 1, 55, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[26432, 731, 81, 1, 56, "Input"], Cell[26516, 734, 35, 1, 55, "Output"] }, Open ]], Cell[26566, 738, 49, 0, 23, "Text"], Cell[CellGroupData[{ Cell[26640, 742, 86, 1, 56, "Input"], Cell[26729, 745, 46, 1, 55, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[26812, 751, 104, 2, 56, "Input"], Cell[26919, 755, 63, 2, 55, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[27019, 762, 104, 2, 56, "Input"], Cell[27126, 766, 63, 2, 55, "Output"] }, Open ]], Cell[27204, 771, 121, 5, 59, "Text"], Cell[CellGroupData[{ Cell[27350, 780, 264, 5, 103, "Input"], Cell[27617, 787, 153, 3, 72, "Output"] }, Open ]], Cell[27785, 793, 638, 22, 59, "Text"], Cell[CellGroupData[{ Cell[28448, 819, 131, 5, 79, "Input"], Cell[28582, 826, 1673, 30, 245, "Output"] }, Open ]], Cell[30270, 859, 881, 23, 149, "Text"], Cell[CellGroupData[{ Cell[31176, 886, 163, 4, 71, "Input"], Cell[31342, 892, 87, 2, 55, "Output"] }, Open ]], Cell[31444, 897, 175, 4, 41, "Text"], Cell[CellGroupData[{ Cell[31644, 905, 91, 2, 56, "Input"], Cell[31738, 909, 79, 1, 51, "Print"] }, Open ]], Cell[31832, 913, 55, 1, 53, "Input"], Cell[CellGroupData[{ Cell[31912, 918, 88, 2, 55, "Input"], Cell[32003, 922, 171, 3, 51, "Print"], Cell[32177, 927, 99, 2, 56, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[32313, 934, 212, 5, 102, "Input"], Cell[32528, 941, 85, 2, 55, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[32650, 948, 125, 3, 66, "Input"], Cell[32778, 953, 145, 3, 55, "Output"] }, Open ]], Cell[32938, 959, 953, 22, 149, "Text"], Cell[CellGroupData[{ Cell[33916, 985, 87, 1, 53, "Input"], Cell[34006, 988, 15049, 532, 290, 6122, 417, "GraphicsData", "PostScript", "Graphics"] }, Open ]], Cell[49070, 1523, 130, 5, 41, "Text"], Cell[CellGroupData[{ Cell[49225, 1532, 88, 1, 53, "Input"], Cell[49316, 1535, 14713, 516, 290, 5914, 402, "GraphicsData", "PostScript", "Graphics"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[64078, 2057, 33, 0, 80, "Section"], Cell[64114, 2059, 2406, 42, 364, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[66557, 2106, 29, 0, 80, "Section"], Cell[66589, 2108, 1541, 36, 382, "Text"] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)