(*********************************************************************** 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[ 6989, 253]*) (*NotebookOutlinePosition[ 19875, 725]*) (* CellTagsIndexPosition[ 19831, 721]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData[StyleBox["Example of initialization cell", FontSlant->"Italic"]], "Title", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell["Preliminary definitions", "Section"], Cell[TextData[{ "These two input cells are designated as \"initialization cells\"; this was \ done by highlighting the cell bracket at the far right, and selecting \"", StyleBox["Initialization Cell", FontSlant->"Italic"], "\" under ", StyleBox["Cell Properties", FontWeight->"Bold"], " in the ", StyleBox["Cell", FontWeight->"Bold"], " pull-down menu above. When this notebook is opened, the first time the \ user tries to evaluate an input cell she will be reminded to evaluate the \ initialization cells first...\n\nYou should try going to some other input \ cells below and try evaluating them first, just to test this feature !" }], "Text"], Cell["\<\ The following definitions will be used later in this notebook:\ \>", "Text"], Cell["\<\ f[x_] := 3x+1; f[x_,y_] := 3x+y; g[x_,y_] := f[f[x], f[x,y]];\ \>", "Input", Editable->False, InitializationCell->True], Cell[TextData[{ "The ", StyleBox["PlotVectorField", FontWeight->"Bold"], " command, to be used later in this notebook, first requires that this \ Standard Package be loaded:" }], "Text"], Cell["Get[ \"Graphics`PlotField`\" ];", "Input", Editable->False, InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell["The differential equation", "Section", Background->GrayLevel[1]], Cell["t y' + 2y = sin(t) / t", "Text", TextAlignment->Center, FontSize->24, FontWeight->"Bold", FontSlant->"Italic", FontColor->RGBColor[1, 1, 0], Background->RGBColor[0, 0, 1]] }, Open ]], Cell[CellGroupData[{ Cell["Plotting the Vector Field", "Section", FontWeight->"Bold"], Cell[TextData[{ "The differential equation\n\n", StyleBox["\t\t\t\tt y' + 2y = sin(t) / t\n\n", FontWeight->"Bold", FontSlant->"Italic"], "implies that the slope ", StyleBox["dy/dt", FontSlant->"Italic"], " on any curve satisfying the differential equation will be\n\n\t\t\t \ ", StyleBox["y'= ", FontSlant->"Italic"], StyleBox["(sin(t)-2ty)", FontWeight->"Bold", FontSlant->"Italic"], StyleBox[" / ", FontSlant->"Italic"], StyleBox["t^2", FontWeight->"Bold", FontSlant->"Italic"], "\n\t\t\t \nat point ", StyleBox["(t,y)", FontSlant->"Italic"], ". (Remember that until an initial condition is specified, the \ differential equation alone does ", StyleBox["not", FontSlant->"Italic"], " describe a single function ", StyleBox["y(t)", FontSlant->"Italic"], "...) Thus the vector field arrows should be (before scaling)\n\n\t\t\t\ { ", StyleBox[" 1, (sin(t)-2ty) / t^2 ", FontWeight->"Bold", FontSlant->"Italic"], " }\nor, equivalently,\n\t\t\t { ", StyleBox["t^2, sin(t)-2ty ", FontWeight->"Bold", FontSlant->"Italic"], " }\n\t\t\t " }], "Text"], Cell["\<\ vec = {t^2, Sin[t] - 2 t y}; field = PlotVectorField[ vec, {t,0.2, 5}, {y,-1.5, 1.5}, \t\tAxes->True, AxesLabel->{\"t\",\"y\"}, \t\tScaleFunction->(1&), ScaleFactor->0.15, \t\tPlotPoints->17, ColorFunction->(Hue[0.1]&)];\ \>", "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Plotting a specific solution", "Section"], Cell[TextData[{ "To fit with the vector field graphic above, we can find a specific \ solution numerically, using ", StyleBox["NDSolve", FontWeight->"Bold"], ", if some initial condition is also specified. For this numerical \ solution we must also give the desired range of ", StyleBox["t", FontSlant->"Italic"], ", which might as well be about the same as in the vector field plot \ above." }], "Text"], Cell["\<\ diffeq = t y'[t] + 2y[t] == Sin[t]/t; initialcondition = y[0.4] == -1; onesoln = NDSolve[ {diffeq, initialcondition}, \t\t\t\t\ty[t],{t,0.4,5}][[1]]; \t\t\t\t\t soln = Plot[ y[t]/.onesoln, {t,0.4,5}];\ \>", "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Superimposing the two graphics", "Section"], Cell[TextData[{ "Because the individual graphics above were given names, it is easy now to \ combine them using ", StyleBox["Show", FontWeight->"Bold"], ". After the combined graphic below is created, click inside the new \ graph (using mouse/button) and then resize the image, enlarging it to better \ see the details." }], "Text"], Cell["Show[field, soln];", "Input"] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ "Using functions ", StyleBox["f ", FontSlant->"Italic"], " and ", StyleBox["g", FontSlant->"Italic"] }], "Section"], Cell[TextData[{ "Functions ", StyleBox["f", FontSlant->"Italic"], " and ", StyleBox["g", FontSlant->"Italic"], " were defined in the initialization cell at the beginning of the file. \ (When ", StyleBox["Mathematica", FontSlant->"Italic"], " prompts you to ask if you wish to evaluate the initialization cells, you \ probably should answer \"yes\"!!)" }], "Text"], Cell["Table[ f[t], {t,5} ]", "Input"], Cell["Table[ f[i,j], {i,4}, {j,4} ] // TableForm", "Input"], Cell["Table[ g[i,j], {i,4}, {j,4} ] // TableForm", "Input"] }, Open ]] }, Open ]] }, FrontEndVersion->"X 3.0", ScreenRectangle->{{0, 1152}, {0, 900}}, AutoGeneratedPackage->None, WindowToolbars->{}, CellGrouping->Automatic, WindowSize->{658, 600}, WindowMargins->{{178, Automatic}, {Automatic, 102}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, 128}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, CharacterEncoding->"MacintoshAutomaticEncoding", 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"], CellBracketOptions->{"Color"->RGBColor[0.771908, 0.399634, 0.262867]}, ScriptMinSize->9], Cell[StyleData[All, "Printout"], PageWidth->PaperWidth, PrivateFontOptions->{"FontType"->"Outline"}], Cell[StyleData[All, "ColorPrintout"], PageWidth->PaperWidth, 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"]}}, StyleMenuListing->None] }, Closed]], Cell[CellGroupData[{ Cell["Styles for Headings", "Section"], Cell[CellGroupData[{ Cell[StyleData["Title"], CellMargins->{{36, 20}, {2, 10}}, CellGroupingRules->{"TitleGrouping", 0}, PageBreakBelow->False, CellFrameMargins->{{100, 4}, {8, 10}}, TextAlignment->Center, LineSpacing->{1, -5}, CounterIncrements->"Title", CounterAssignments->{{"Section", 0}, {"Equation", 0}, {"Figure", 0}, { "Subtitle", 0}, {"Subsubtitle", 0}}, FontFamily->"New century schoolbook", FontSize->34, FontWeight->"Bold", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], Cell[StyleData["Title", "Printout"], TextAlignment->Center, FontFamily->"New century schoolbook", FontSize->33, FontColor->RGBColor[0, 0, 1]], Cell[StyleData["Title", "ColorPrintout"], TextAlignment->Center, FontFamily->"New century schoolbook", FontSize->33, FontColor->RGBColor[0, 0, 1]] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["Subtitle"], CellFrame->{{0, 0}, {0.5, 0}}, CellMargins->{{144, 20}, {2, 10}}, CellGroupingRules->{"TitleGrouping", 10}, PageBreakBelow->False, TextAlignment->Center, CounterIncrements->"Subtitle", CounterAssignments->{{"Section", 0}, {"Equation", 0}, {"Figure", 0}, { "Subsubtitle", 0}}, FontSize->24, FontSlant->"Italic", FontColor->RGBColor[1, 0, 1]], Cell[StyleData["Subtitle", "Printout"], CellFrame->{{0, 0}, {0.5, 0}}, TextAlignment->Center, FontColor->RGBColor[1, 0, 1]], Cell[StyleData["Subtitle", "ColorPrintout"], CellFrame->{{0, 0}, {0.5, 0}}, TextAlignment->Center, FontColor->RGBColor[1, 0, 1]] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["Subsubtitle"], CellFrame->{{0, 0}, {0.5, 0}}, CellMargins->{{144, 20}, {2, 2}}, CellGroupingRules->{"TitleGrouping", 20}, PageBreakBelow->False, TextAlignment->Center, CounterIncrements->"Subsubtitle", CounterAssignments->{{"Section", 0}, {"Equation", 0}, {"Figure", 0}}, FontFamily->"Helvetica", FontSize->18, FontSlant->"Italic", FontColor->RGBColor[1, 0, 0]], Cell[StyleData["Subsubtitle", "Printout"], CellFrame->{{0, 0}, {0.5, 0}}, TextAlignment->Center, FontSize->18, FontColor->RGBColor[1, 0, 0]], Cell[StyleData["Subsubtitle", "ColorPrintout"], CellFrame->{{0, 0}, {0.5, 0}}, TextAlignment->Center, FontSize->18, FontColor->RGBColor[1, 0, 0]] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["Section"], CellFrame->{{0, 0}, {0, 0.25}}, CellMargins->{{36, 20}, {10, 20}}, CellGroupingRules->{"SectionGrouping", 30}, PageBreakBelow->False, CellFrameMargins->{{10, 4}, {6, 2}}, CounterIncrements->"Section", CounterAssignments->{{"Subsection", 0}, {"Subsubsection", 0}}, FontSize->18, FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], Cell[StyleData["Section", "Printout"], FontSize->18, FontColor->RGBColor[1, 0, 0]], Cell[StyleData["Section", "ColorPrintout"], FontSize->18, FontColor->RGBColor[1, 0, 0]] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["Subsection"], CellFrame->{{0, 0}, {0, 0.5}}, CellDingbat->"\[FilledSmallSquare]", CellMargins->{{36, 20}, {Inherited, 18}}, CellGroupingRules->{"SectionGrouping", 40}, PageBreakBelow->False, CellFrameMargins->{{2, 12}, {0, 12}}, CellFrameLabelMargins->6, TextAlignment->Center, CounterIncrements->"Subsection", CounterAssignments->{{"Subsubsection", 0}}, FontSize->18, FontWeight->"Bold", FontColor->RGBColor[1, 0, 1]], Cell[StyleData["Subsection", "Printout"], CellFrame->{{0, 0}, {0, 0.5}}, TextAlignment->Center, FontSize->18, FontColor->RGBColor[1, 0, 1]], Cell[StyleData["Subsection", "ColorPrintout"], CellFrame->{{0, 0}, {0, 0.5}}, TextAlignment->Center, FontSize->18, FontColor->RGBColor[1, 0, 1]] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["Subsubsection"], CellDingbat->"\[EmptySquare]", CellMargins->{{36, Inherited}, {Inherited, 12}}, CellGroupingRules->{"SectionGrouping", 50}, PageBreakBelow->False, CellFrameLabelMargins->6, CounterIncrements->"Subsubsection", FontFamily->"Helvetica", FontSize->16], Cell[StyleData["Subsubsection", "Printout"], FontSize->16], Cell[StyleData["Subsubsection", "ColorPrintout"], FontSize->16] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Styles for Body Text", "Section"], Cell[CellGroupData[{ Cell[StyleData["Text"], CellFrame->False, CellMargins->{{36, 20}, {4, 4}}, CellFrameMargins->{{4, 10}, {6, 0}}, CellFrameLabelMargins->4, LineSpacing->{1, 2}, CounterIncrements->"Text", FontSize->14], Cell[StyleData["Text", "Printout"], LineSpacing->{1, 1}, FontSize->14], Cell[StyleData["Text", "ColorPrintout"], LineSpacing->{1, 1}, FontSize->14] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["SmallText"], CellMargins->{{100, 38}, {4, 4}}, LineSpacing->{1.1, 1}, CounterIncrements->"SmallText", FontSize->14], Cell[StyleData["SmallText", "Printout"], LineSpacing->{1.1, 1}, FontSize->14], Cell[StyleData["SmallText", "ColorPrintout"], LineSpacing->{1.1, 1}, FontSize->14] }, Open ]] }, Open ]], 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"], CellMargins->{{36, 0}, {0, Inherited}}, Evaluatable->True, CellGroupingRules->"InputGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, CellLabelMargins->{{3, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultInputFormatType, FormatType->InputForm, ShowStringCharacters->True, NumberMarks->True, CounterIncrements->"Input", FontSize->14, FontWeight->"Bold", FontColor->GrayLevel[0], Background->RGBColor[0.95021, 0.934356, 0.499062]], Cell[StyleData["Input", "Printout"], FontSize->14, Background->GrayLevel[0.900008]], Cell[StyleData["Input", "ColorPrintout"], FontSize->14] }, Open ]], Cell[StyleData["InlineInput"], Evaluatable->True, CellGroupingRules->"InputGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, DefaultFormatType->DefaultInputFormatType, AutoItalicWords->{}, FormatType->InputForm, ShowStringCharacters->True, NumberMarks->True, CounterIncrements->"Input", FontSize->14, FontWeight->"Bold"], Cell[CellGroupData[{ Cell[StyleData["Output"], CellFrame->True, CellMargins->{{36, 0}, {Inherited, 0}}, CellEditDuplicate->True, CellGroupingRules->"OutputGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, CellLabelMargins->{{3, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultOutputFormatType, TextAlignment->Center, FormatType->InputForm, CounterIncrements->"Output", FontSize->14, FontColor->GrayLevel[0], Background->RGBColor[0, 1, 1]], Cell[StyleData["Output", "Printout"], CellFrame->True, TextAlignment->Center, FontSize->14, Background->RGBColor[0, 1, 1]], Cell[StyleData["Output", "ColorPrintout"], CellFrame->True, TextAlignment->Center, FontSize->14, Background->RGBColor[0, 1, 1]] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["Message"], CellDingbat->"\[LongDash]", CellMargins->{{64, Inherited}, {Inherited, Inherited}}, CellGroupingRules->"OutputGrouping", PageBreakWithin->False, GroupPageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, ShowCellLabel->False, CellLabelMargins->{{3, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultOutputFormatType, FormatType->InputForm, CounterIncrements->"Message", StyleMenuListing->None, FontFamily->"Helvetica", FontSize->10, FontSlant->"Oblique"], Cell[StyleData["Message", "Printout"], FontSize->8], Cell[StyleData["Message", "ColorPrintout"], FontSize->8] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["Print"], CellMargins->{{36, 20}, {3, 3}}, CellGroupingRules->"OutputGrouping", CellHorizontalScrolling->True, PageBreakWithin->False, GroupPageBreakWithin->False, GeneratedCell->True, CellAutoOverwrite->True, ShowCellLabel->False, CellLabelMargins->{{3, Inherited}, {Inherited, Inherited}}, DefaultFormatType->DefaultOutputFormatType, TextAlignment->Left, FormatType->InputForm, CounterIncrements->"Print", StyleMenuListing->None, FontFamily->"Courier", FontSize->12, Background->RGBColor[0.967727, 0.972747, 0.534508]], Cell[StyleData["Print", "Printout"], FontFamily->"Courier", Background->GrayLevel[0.900008]], Cell[StyleData["Print", "ColorPrintout"], FontFamily->"Courier"] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["Graphics"], CellMargins->{{36, 0}, {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}}, Background->RGBColor[0, 1, 1]], Cell[StyleData["Graphics", "Printout"], FontSize->10, Background->GrayLevel[0.8]], Cell[StyleData["Graphics", "ColorPrintout"], FontSize->10, Background->RGBColor[0, 1, 1]] }, Open ]], Cell[CellGroupData[{ Cell[StyleData["CellLabel"], StyleMenuListing->None, FontFamily->"Helvetica", FontSize->10, FontColor->RGBColor[0.551492, 0.231144, 0.313466]], Cell[StyleData["CellLabel", "Printout"], FontColor->GrayLevel[0]], Cell[StyleData["CellLabel", "ColorPrintout"]] }, Open ]] }, Open ]] }, 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, 138, 3, 46, "Title"], Cell[CellGroupData[{ Cell[1894, 58, 42, 0, 53, "Section"], Cell[1939, 60, 674, 15, 127, "Text"], Cell[2616, 77, 87, 3, 42, "Text"], Cell[2706, 82, 135, 6, 71, "Input", InitializationCell->True], Cell[2844, 90, 198, 6, 42, "Text"], Cell[3045, 98, 95, 2, 37, "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell[3177, 105, 72, 1, 37, "Section"], Cell[3252, 108, 193, 6, 41, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[3482, 119, 66, 1, 53, "Section"], Cell[3551, 122, 1184, 40, 263, "Text"], Cell[4738, 164, 251, 7, 122, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[5026, 176, 47, 0, 37, "Section"], Cell[5076, 178, 423, 11, 59, "Text"], Cell[5502, 191, 231, 8, 139, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[5770, 204, 49, 0, 37, "Section"], Cell[5822, 206, 345, 8, 59, "Text"], Cell[6170, 216, 35, 0, 37, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[6242, 221, 149, 7, 37, "Section"], Cell[6394, 230, 391, 13, 59, "Text"], Cell[6788, 245, 39, 0, 37, "Input"], Cell[6830, 247, 64, 0, 37, "Input"], Cell[6897, 249, 64, 0, 37, "Input"] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)