(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. The data for the notebook starts with the line containing 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[ 8472, 289]*) (*NotebookOutlinePosition[ 9259, 319]*) (* CellTagsIndexPosition[ 9188, 313]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Write2", "Subsection", CellTags->"Write2"], Cell[CellGroupData[{ Cell["Description", "Subsubsection"], Cell["\<\ Write2[file, val1 = expr1, val2 = expr2, ...] writes the settings \ val1 = expr1, val2 = expr2 in sequence followed by a newline, to the \ specified output file. Setting the option FormatType of Write2 to FortranForm \ results in FORTRAN syntax output.\ \>", "Text"], Cell["\<\ The continuation character for FORTRAN output can be controlled by \ changing $FortranContinuationCharacter.\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(FullForm[$FortranContinuationCharacter]\)], "Input"], Cell[BoxData[ FormBox[ TagBox[ StyleBox["\"\<&\>\"", ShowSpecialCharacters->False, ShowStringCharacters->True], FullForm], TraditionalForm]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Options[Write2]\)], "Input"], Cell[BoxData[ \(TraditionalForm\`{FinalSubstitutions \[Rule] {}, FormatType \[Rule] InputForm, D0Convention \[Rule] 0, PageWidth \[Rule] 62, PreFortranFile \[Rule] \*"\<\"\"\>", PostFortranFile \[Rule] \*"\<\"\"\>", StringReplace \[Rule] {}}\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Attributes[Write2]\)], "Input"], Cell[BoxData[ \(TraditionalForm\`{HoldRest, ReadProtected}\)], "Output"] }, Open ]], Cell[TextData[{ "See also: ", " ", ButtonBox["Isolate", ButtonData:>"Isolate", ButtonStyle->"Hyperlink", ButtonNote->"Isolate"], ", ", ButtonBox["PaVeReduce", ButtonData:>"PaVeReduce", ButtonStyle->"Hyperlink", ButtonNote->"PaVeReduce"], "." }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["Examples", "Subsubsection"], Cell[CellGroupData[{ Cell[BoxData[ \(t = Collect[\((\((a - c)\)\^2 + \((a - b)\)\^2)\)\^2, a, Factor]\)], "Input"], Cell[BoxData[ \(TraditionalForm\`4\ a\^4 - 8\ \((b + c)\)\ a\^3 + 8\ \((b\^2 + c\ b + c\^2)\)\ a\^2 - 4\ \((b + c)\)\ \((b\^2 + c\^2)\)\ a + \((b\^2 + c\^2)\)\^2\)], "Output"] }, Open ]], Cell[BoxData[ \(tempfilename = ToString[$SessionID] <> "\<.s\>"; \)], "Input"], Cell["This writes the assignment r=t to a file.", "Text"], Cell[BoxData[ \(Write2[tempfilename, r = t]; \)], "Input"], Cell["This shows the contents of the file.", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TableForm[ ReadList[If[$OperatingSystem === "\", "\<:\>", "\<\>"] <> tempfilename, String]]\)], "Input"], Cell[BoxData[ FormBox[ InterpretationBox[GridBox[{ {"\<\"r = ( 4*a^4 - 8*a^3*(b + c) - 4*a*(b + c)*(b^2 + c^2) + \ \"\>"}, {"\<\" (b^2 + c^2)^2 + 8*a^2*(b^2 + b*c + c^2)\"\>"}, {"\<\" );\"\>"} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], TableForm[ { "r = ( 4*a^4 - 8*a^3*(b + c) - 4*a*(b + c)*(b^2 + c^2) + ", " (b^2 + c^2)^2 + 8*a^2*(b^2 + b*c + c^2)", " );"}]], TraditionalForm]], "Output"] }, Open ]], Cell[BoxData[ \(DeleteFile[ If[$OperatingSystem === "\", "\<:\>", "\<\>"] <> tempfilename]\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(t2 = x + Isolate[t, a, IsolateNames \[Rule] W]\)], "Input"], Cell[BoxData[ FormBox[ RowBox[{\(4\ a\^4\), "-", RowBox[{"8", " ", TagBox[\(W(1)\), HoldForm], " ", \(a\^3\)}], "+", RowBox[{"8", " ", TagBox[\(W(3)\), HoldForm], " ", \(a\^2\)}], "-", RowBox[{"4", " ", TagBox[\(W(1)\), HoldForm], " ", TagBox[\(W(2)\), HoldForm], " ", "a"}], "+", SuperscriptBox[ RowBox[{"(", TagBox[\(W(2)\), HoldForm], ")"}], "2"], "+", "x"}], TraditionalForm]], "Output"] }, Open ]], Cell[BoxData[ \(Write2[tempfilename, r = t2]; \)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(TableForm[ ReadList[If[$OperatingSystem === "\", "\<:\>", "\<\>"] <> tempfilename, String]]\)], "Input"], Cell[BoxData[ FormBox[ InterpretationBox[GridBox[{ {"\<\"W[1] = (b + c\"\>"}, {"\<\" );\"\>"}, {"\<\"W[2] = (b^2 + c^2\"\>"}, {"\<\" );\"\>"}, {"\<\"W[3] = (b^2 + b*c + c^2\"\>"}, {"\<\" );\"\>"}, {"\<\"r = ( 4*a^4 + x - 8*a^3*HoldForm[W[1]] - \"\>"}, {"\<\" 4*a*HoldForm[W[1]]*HoldForm[W[2]] + HoldForm[W[2]]^2 + \"\ \>"}, {"\<\" 8*a^2*HoldForm[W[3]]\"\>"}, {"\<\" );\"\>"} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], TableForm[ {"W[1] = (b + c", " );", "W[2] = (b^2 + c^2", " );", "W[3] = (b^2 + b*c + c^2", " );", "r = ( 4*a^4 + x - 8*a^3*HoldForm[W[1]] - ", " 4*a*HoldForm[W[1]]*HoldForm[W[2]] + HoldForm[W[2]]^2 + ", " 8*a^2*HoldForm[W[3]]", " );"}]], TraditionalForm]], "Output"] }, Open ]], Cell[BoxData[ \(DeleteFile[ If[$OperatingSystem === "\", "\<:\>", "\<\>"] <> tempfilename]\)], "Input"], Cell["\<\ This is how to write out the expression t2 in Fortran format.\ \>", \ "Text"], Cell[BoxData[ \(Write2[tempfilename, r = t2, FormatType -> FortranForm]; \)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(TableForm[ ReadList[If[$OperatingSystem === "\", "\<:\>", "\<\>"] <> tempfilename, String]]\)], "Input"], Cell[BoxData[ FormBox[ InterpretationBox[GridBox[{ {"\<\" W(1)= b + c\"\>"}, {"\<\" W(2)= b**2 + c**2\"\>"}, {"\<\" W(3)= b**2 + b*c + c**2\"\>"}, {"\<\" r = 4*a**4 + x - 8*a**3*W(1) - 4*a*W(1)*W(2) + \ W(2)**2 + \"\>"}, {"\<\" & 8*a**2*W(3)\"\>"}, {"\<\" \"\>"} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], TableForm[ {" W(1)= b + c", " W(2)= b**2 + c**2", " W(3)= b**2 + b*c + c**2", " r = 4*a**4 + x - 8*a**3*W(1) - 4*a*W(1)*W(2) + W(2)**2 + ", " & 8*a**2*W(3)", " "}]], TraditionalForm]], "Output"] }, Open ]], Cell[BoxData[ \(DeleteFile[ If[$OperatingSystem === "\", "\<:\>", "\<\>"] <> tempfilename]; Clear[t, t2, tempfilename]; \)], "Input"] }, Open ]] }, Open ]] }, FrontEndVersion->"4.0 for X", ScreenRectangle->{{0, 1024}, {0, 768}}, WindowSize->{520, 485}, WindowMargins->{{Automatic, 244}, {114, Automatic}}, StyleDefinitions -> "Demo.nb" ] (*********************************************************************** 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->{ "Write2"->{ Cell[1739, 51, 50, 1, 40, "Subsection", CellTags->"Write2"]} } *) (*CellTagsIndex CellTagsIndex->{ {"Write2", 9091, 306} } *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1739, 51, 50, 1, 40, "Subsection", CellTags->"Write2"], Cell[CellGroupData[{ Cell[1814, 56, 36, 0, 36, "Subsubsection"], Cell[1853, 58, 276, 5, 71, "Text"], Cell[2132, 65, 132, 3, 43, "Text"], Cell[CellGroupData[{ Cell[2289, 72, 72, 1, 31, "Input"], Cell[2364, 75, 197, 6, 47, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[2598, 86, 48, 1, 31, "Input"], Cell[2649, 89, 287, 5, 83, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[2973, 99, 51, 1, 31, "Input"], Cell[3027, 102, 76, 1, 47, "Output"] }, Open ]], Cell[3118, 106, 289, 13, 70, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[3444, 124, 33, 0, 70, "Subsubsection"], Cell[CellGroupData[{ Cell[3502, 128, 104, 2, 70, "Input"], Cell[3609, 132, 193, 3, 70, "Output"] }, Open ]], Cell[3817, 138, 82, 1, 70, "Input"], Cell[3902, 141, 57, 0, 70, "Text"], Cell[3962, 143, 62, 1, 70, "Input"], Cell[4027, 146, 52, 0, 70, "Text"], Cell[CellGroupData[{ Cell[4104, 150, 149, 3, 70, "Input"], Cell[4256, 155, 586, 15, 70, "Output"] }, Open ]], Cell[4857, 173, 130, 3, 70, "Input"], Cell[CellGroupData[{ Cell[5012, 180, 79, 1, 70, "Input"], Cell[5094, 183, 566, 17, 70, "Output"] }, Open ]], Cell[5675, 203, 63, 1, 70, "Input"], Cell[CellGroupData[{ Cell[5763, 208, 149, 3, 70, "Input"], Cell[5915, 213, 1024, 24, 70, "Output"] }, Open ]], Cell[6954, 240, 130, 3, 70, "Input"], Cell[7087, 245, 87, 3, 70, "Text"], Cell[7177, 250, 90, 1, 70, "Input"], Cell[CellGroupData[{ Cell[7292, 255, 149, 3, 70, "Input"], Cell[7444, 260, 829, 19, 70, "Output"] }, Open ]], Cell[8288, 282, 156, 3, 70, "Input"] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)