(*********************************************************************** 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[ 10096, 445]*) (*NotebookOutlinePosition[ 10770, 469]*) (* CellTagsIndexPosition[ 10726, 465]*) (*WindowFrame->Normal*) Notebook[{ Cell[TextData[StyleBox["Session #2", "Subtitle"]], "Subsubtitle"], Cell[CellGroupData[{ Cell["Notebooks and Cells", "Subsection"], Cell["Types of cells: input, output, text, initialization, ...", \ "Subsubsection"], Cell["Expression formats: Input, Traditional, Standard", "Subsubsection"], Cell[TextData[{ StyleBox["MathReader ", "Text", FontSlant->"Italic"], "for reading precomputed notebooks" }], "Subsubsection"], Cell[CellGroupData[{ Cell[TextData[{ StyleBox[" ", "Text", FontSlant->"Italic"], StyleBox["Packages", "Text"] }], "Subsubsection"], Cell[BoxData[ \(\(?Atom*\)\)], "Input"], Cell[BoxData[ \(<< Miscellaneous`ChemicalElements`\)], "Input"], Cell[BoxData[ \(\(?Atom*\)\)], "Input"], Cell[BoxData[ \(\(?AtomicWeight\)\)], "Input"], Cell[BoxData[ \(AtomicWeight[Kr]\)], "Input"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Using the Palette", "Subsection"], Cell[CellGroupData[{ Cell["A problem from session #1:", "Subsubsection"], Cell["Now in neat format", "Text"], Cell[BoxData[ \(N[\[Sum]\+\(n = 0\)\%13\(\((16\ \((1\/5)\)\^\(2\ n + 1\) - 4\ \ \((1\/239)\)\^\(2\ n + 1\))\)\ \((\(-1\))\)\^n\)\/\(2\ n + 1\), 23]\)], "Input"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Some Problems From Session #1", "Subsection"], Cell[BoxData[ \(poly\ = \ x^5\ + \ 8\ x^4\ - \ 72\ x^3\ - \ 382\ x^2\ + \ 727\ x\ + 2310\)], "Input"], Cell[BoxData[ \(Factor[poly]\)], "Input"], Cell[BoxData[ \(Plot[poly, {x, \(-12\), 12}, PlotStyle \[Rule] {Dashing[{ .01, .02}], RGBColor[1, 0, 0]}]\)], "Input"], Cell[BoxData[ \(Solve[poly \[Equal] 0, x]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Numerical Solutions", "Subsection"], Cell[BoxData[ \(Solve[x\ Sin[x] \[Equal] \ 1, x]\)], "Input"], Cell[BoxData[ \(Plot[x\ Sin[x] - 1, {x, 0, 10}]\)], "Input"], Cell[BoxData[ \(FindRoot[x\ Sin[x]\ \[Equal] \ 1, {x, 1}]\)], "Input"], Cell[BoxData[ \(FindRoot[x\ Sin[x]\ \[Equal] \ 1, {x, 8}]\)], "Input"], Cell[BoxData[ \(FindRoot[x\ Sin[x]\ \[Equal] \ 1, {x, 8, 10}]\)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Prefix and Postfix Forms", "Subsection"], Cell["Compare three ways of applying N:", "Text"], Cell[BoxData[ \({N[Pi], \ Pi // N, \ N@Pi}\)], "Input"], Cell["\<\ When you want to apply N to *everything* . Note use of \"pure \ function\", which will appear again later on.\ \>", "Text"], Cell[BoxData[ \($Post\ = \ N\)], "Input"], Cell["\<\ What if we want more digits? The problem is that N[] takes *two* \ arguments\ \>", "Text"], Cell[BoxData[ \($Post\ = \ \((N[#, 30])\)&\)], "Input"], Cell[BoxData[ \(Pi\)], "Input"], Cell["Clear the definition of $Post to get back to normal", "Text"], Cell[BoxData[ \($Post\ = \ .\)], "Input"], Cell["The prefix operator acts before the postfix operator:", "Text"], Cell[BoxData[ \(\(\ Sin@\((45\ Degree)\) // ArcSin\)\)], "Input"], Cell[TextData[StyleBox["", "Subsection"]], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Rules", "Subsection"], Cell["Compare single and multiple applications of a rule", "Text"], Cell[CellGroupData[{ Cell["/. and //.", "Subsubsection"], Cell[BoxData[ \(Cos[x]\ /. \ x -> 0\)], "Input"], Cell["This one may not produce the result you expect:", "Text"], Cell[BoxData[ \(\((a + b + c + d)\)\ /. \ {a -> x, \ b -> y, x -> 1}\)], "Input"], Cell["Here is the fix: // does *repeated* subsitutions.", "Text"], Cell[BoxData[ \(\((a + b + c + d)\)\ //. \ {a -> x, \ b -> y, x -> 1}\)], "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Matrices and Vectors", "Subsection"], Cell[CellGroupData[{ Cell["Lists and their pieces", "Subsubsection"], Cell["A list can contain all kinds of different objects", "Text"], Cell[BoxData[ \(lone\ = \ {thingone, \ Sin[x], \ 3}\)], "Input"], Cell["... including sublists.", "Text"], Cell[BoxData[ \(ltwo\ = \ {thingone, \ {Sin[x], \ Cos[x], \ Tan[x]}, \ {3, 6}}\)], "Input"], Cell["To pick off elements of a list, use double square brackets.", "Text"], Cell[BoxData[ \(lone[\([2]\)]\)], "Input"], Cell[BoxData[ \(ltwo\ [\([2]\)]\)], "Input"], Cell[BoxData[ \(ltwo[\([2, 3]\)]\)], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Lists as matrices", "Subsubsection"], Cell["What is a vector, except a list of components?", "Text"], Cell[BoxData[ \(vec\ = \ {a, b, c}\)], "Input"], Cell[BoxData[ \(MatrixForm[vec]\)], "Input"], Cell["Some vector operations:", "Text"], Cell[BoxData[ \(v1\ = \ {x, y, z}; \ v2\ = \ {2, blue, False};\)], "Input"], Cell[BoxData[ \(v1 . v2\)], "Input"], Cell[BoxData[ \(Cross[v1, v2]\)], "Input"], Cell["Suppose we want to show that A.(AxB) = 0.", "Text"], Cell[BoxData[ \(A\ = \ {Ax, Ay, Az}; \ B\ = \ {Bx, By, Bz};\)], "Input"], Cell[BoxData[ \(A . Cross[A, B]\)], "Input"], Cell["And what is a matrix except a list of vectors?", "Text"], Cell[BoxData[ \(\((m\ = {{x, 2, 3}, {4, y, 6}, {7, 8, z}}\ )\) // MatrixForm\)], "Input"], Cell[TextData[{ "For lists of the right shape, ", StyleBox["Mathematica", FontSlant->"Italic"], " can do matrix operations, such as ..." }], "Text"], Cell[BoxData[ \(Det[m]\)], "Input"], Cell["Scalar times matrix:", "Text"], Cell[BoxData[ \(Inverse[m]*Det[m] // MatrixForm\)], "Input"], Cell["matrix.matrix multiplication", "Text"], Cell[BoxData[ \(m\ .\ Inverse[m] // Simplify\)], "Input"], Cell[BoxData[ \(m\ .\ vec // MatrixForm\)], "Input"], Cell[BoxData[ \(n\ = \ m\ /. \ {x -> 1, y -> 2}\)], "Input"], Cell[BoxData[ \(Eigenvalues[n] /. z -> 3 // Simplify\)], "Input"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Calculus", "Subsection"], Cell[CellGroupData[{ Cell["Functions", "Subsubsection"], Cell["A naive attempt at defining a function", "Text"], Cell[BoxData[ \(f[x]\ = \ x^2\)], "Input"], Cell[BoxData[ \({f[2], f[a], f[x]}\)], "Input"], Cell["Clear the definition and try again", "Text"], Cell[BoxData[ \(f[x]\ = \ .\)], "Input"], Cell[BoxData[ \(f[x_]\ = \ x*x\)], "Input"], Cell[BoxData[ \({f[3], \ f[a], \ f[x]}\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Limits", "Subsubsection"], Cell["Despite the notional similarity, rules are not limits.", "Text"], Cell[BoxData[ \(Sin[x]/x\ /. \ x -> \ 0\)], "Input"], Cell["Instead use ", "Text"], Cell[BoxData[ \(Limit[Sin[x]/x, \ x -> 0]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Derivatives", "Subsubsection"], Cell[BoxData[ \(D[Sin[x], x]\)], "Input"], Cell[BoxData[ \(D[\ D[Sin[x\ y] x], x, y]\)], "Input"], Cell[BoxData[ \(D[BesselJ[2, x], x]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Series", "Subsubsection"], Cell["\<\ Given the ability to take derivatives, we can easily get the Taylor \ series. Normal[] strips off the expressions like \"O(x^7)\".\ \>", "Text"], Cell[BoxData[ \(Series[\ Exp[x], {x, 0, 6}] // Normal\)], "Input"], Cell[BoxData[ \(f[x_]\ = \ \((Sin[x]/x)\)^2\)], "Input"], Cell[BoxData[ \(q\ = Normal[Series[f[x], {x, 0, 10}]]\)], "Input"], Cell["\<\ Lets compare a function and a polynomial approximation to it:\ \>", \ "Text"], Cell[BoxData[ \(Plot[{f[x], q}, {x, 0, 4}, PlotStyle -> {Dashing[{1, 0}], Dashing[{ .01, .02}]}]\)], "Input"], Cell["To do Pade approximants, we need a package", "Text"], Cell[BoxData[ \(Needs["\"]\)], "Input"], Cell[BoxData[ \(\(?*Pade*\)\)], "Input"], Cell[BoxData[ \(q\ = Pade[f[x], {x, 0, 4, 4}]\)], "Input"], Cell[BoxData[ \(Plot[{f[x], q}, {x, 0, 4}, PlotStyle -> {Dashing[{1, 0}], Dashing[{ .01, .02}]}]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Integrals", "Subsubsection"], Cell["Indefinite", "Text"], Cell[BoxData[ \(Integrate[Sin[x], x]\)], "Input"], Cell["Definite", "Text"], Cell[BoxData[ \(Integrate[1/1 + Sin[x]^2, {x, 0, Pi/6}]\)], "Input"], Cell["Difficult", "Text"], Cell[BoxData[ \(f[x_]\ := \ 2/\((1 + Log[x]*x)\)\)], "Input"], Cell[BoxData[ \(Integrate[f[x], {x, 0, 1}]\)], "Input"], Cell["Numerical", "Text"], Cell[BoxData[ \(NIntegrate[\ f[x], {x, 0, 1}]\)], "Input"], Cell["Hmmmm ... suspiciously close to E.", "Text"] }, Open ]] }, Open ]] }, FrontEndVersion->"4.0 for X", ScreenRectangle->{{0, 1024}, {0, 768}}, WindowSize->{802, 661}, WindowMargins->{{63, Automatic}, {8, Automatic}}, StyleDefinitions -> "Classroom.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->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1717, 49, 65, 0, 103, "Subsubtitle"], Cell[CellGroupData[{ Cell[1807, 53, 41, 0, 67, "Subsection"], Cell[1851, 55, 83, 1, 53, "Subsubsection"], Cell[1937, 58, 73, 0, 53, "Subsubsection"], Cell[2013, 60, 134, 4, 59, "Subsubsection"], Cell[CellGroupData[{ Cell[2172, 68, 117, 4, 59, "Subsubsection"], Cell[2292, 74, 43, 1, 51, "Input"], Cell[2338, 77, 67, 1, 51, "Input"], Cell[2408, 80, 43, 1, 51, "Input"], Cell[2454, 83, 50, 1, 52, "Input"], Cell[2507, 86, 49, 1, 52, "Input"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[2605, 93, 39, 0, 39, "Subsection"], Cell[CellGroupData[{ Cell[2669, 97, 51, 0, 53, "Subsubsection"], Cell[2723, 99, 34, 0, 37, "Text"], Cell[2760, 101, 171, 3, 102, "Input"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[2980, 110, 51, 0, 39, "Subsection"], Cell[3034, 112, 127, 3, 52, "Input"], Cell[3164, 117, 45, 1, 52, "Input"], Cell[3212, 120, 141, 3, 70, "Input"], Cell[3356, 125, 58, 1, 52, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[3451, 131, 41, 0, 67, "Subsection"], Cell[3495, 133, 65, 1, 52, "Input"], Cell[3563, 136, 64, 1, 52, "Input"], Cell[3630, 139, 75, 1, 52, "Input"], Cell[3708, 142, 75, 1, 52, "Input"], Cell[3786, 145, 79, 1, 52, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[3902, 151, 46, 0, 39, "Subsection"], Cell[3951, 153, 50, 0, 37, "Text"], Cell[4004, 155, 59, 1, 52, "Input"], Cell[4066, 158, 134, 3, 37, "Text"], Cell[4203, 163, 46, 1, 52, "Input"], Cell[4252, 166, 101, 3, 37, "Text"], Cell[4356, 171, 60, 1, 53, "Input"], Cell[4419, 174, 35, 1, 51, "Input"], Cell[4457, 177, 67, 0, 37, "Text"], Cell[4527, 179, 46, 1, 52, "Input"], Cell[4576, 182, 69, 0, 37, "Text"], Cell[4648, 184, 69, 1, 52, "Input"], Cell[4720, 187, 50, 0, 43, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[4807, 192, 27, 0, 39, "Subsection"], Cell[4837, 194, 66, 0, 37, "Text"], Cell[CellGroupData[{ Cell[4928, 198, 35, 0, 53, "Subsubsection"], Cell[4966, 200, 53, 1, 52, "Input"], Cell[5022, 203, 63, 0, 37, "Text"], Cell[5088, 205, 86, 1, 52, "Input"], Cell[5177, 208, 65, 0, 37, "Text"], Cell[5245, 210, 87, 1, 52, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[5381, 217, 42, 0, 39, "Subsection"], Cell[CellGroupData[{ Cell[5448, 221, 47, 0, 53, "Subsubsection"], Cell[5498, 223, 65, 0, 37, "Text"], Cell[5566, 225, 69, 1, 52, "Input"], Cell[5638, 228, 39, 0, 37, "Text"], Cell[5680, 230, 99, 2, 52, "Input"], Cell[5782, 234, 75, 0, 37, "Text"], Cell[5860, 236, 46, 1, 52, "Input"], Cell[5909, 239, 48, 1, 52, "Input"], Cell[5960, 242, 49, 1, 52, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[6046, 248, 42, 0, 31, "Subsubsection"], Cell[6091, 250, 62, 0, 37, "Text"], Cell[6156, 252, 52, 1, 52, "Input"], Cell[6211, 255, 48, 1, 52, "Input"], Cell[6262, 258, 39, 0, 37, "Text"], Cell[6304, 260, 81, 1, 52, "Input"], Cell[6388, 263, 40, 1, 51, "Input"], Cell[6431, 266, 46, 1, 52, "Input"], Cell[6480, 269, 58, 0, 37, "Text"], Cell[6541, 271, 78, 1, 52, "Input"], Cell[6622, 274, 48, 1, 52, "Input"], Cell[6673, 277, 62, 0, 37, "Text"], Cell[6738, 279, 97, 2, 52, "Input"], Cell[6838, 283, 158, 5, 37, "Text"], Cell[6999, 290, 39, 1, 52, "Input"], Cell[7041, 293, 36, 0, 37, "Text"], Cell[7080, 295, 64, 1, 52, "Input"], Cell[7147, 298, 44, 0, 37, "Text"], Cell[7194, 300, 61, 1, 52, "Input"], Cell[7258, 303, 56, 1, 51, "Input"], Cell[7317, 306, 66, 1, 52, "Input"], Cell[7386, 309, 69, 1, 52, "Input"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[7504, 316, 30, 0, 39, "Subsection"], Cell[CellGroupData[{ Cell[7559, 320, 34, 0, 53, "Subsubsection"], Cell[7596, 322, 54, 0, 37, "Text"], Cell[7653, 324, 47, 1, 52, "Input"], Cell[7703, 327, 51, 1, 52, "Input"], Cell[7757, 330, 50, 0, 37, "Text"], Cell[7810, 332, 45, 1, 52, "Input"], Cell[7858, 335, 48, 1, 52, "Input"], Cell[7909, 338, 55, 1, 52, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[8001, 344, 31, 0, 53, "Subsubsection"], Cell[8035, 346, 70, 0, 37, "Text"], Cell[8108, 348, 57, 1, 52, "Input"], Cell[8168, 351, 28, 0, 37, "Text"], Cell[8199, 353, 58, 1, 52, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[8294, 359, 36, 0, 53, "Subsubsection"], Cell[8333, 361, 45, 1, 52, "Input"], Cell[8381, 364, 58, 1, 52, "Input"], Cell[8442, 367, 52, 1, 52, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[8531, 373, 31, 0, 53, "Subsubsection"], Cell[8565, 375, 154, 3, 58, "Text"], Cell[8722, 380, 70, 1, 52, "Input"], Cell[8795, 383, 61, 1, 52, "Input"], Cell[8859, 386, 71, 1, 52, "Input"], Cell[8933, 389, 87, 3, 37, "Text"], Cell[9023, 394, 121, 2, 70, "Input"], Cell[9147, 398, 58, 0, 37, "Text"], Cell[9208, 400, 60, 1, 52, "Input"], Cell[9271, 403, 44, 1, 51, "Input"], Cell[9318, 406, 63, 1, 52, "Input"], Cell[9384, 409, 121, 2, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[9542, 416, 34, 0, 53, "Subsubsection"], Cell[9579, 418, 26, 0, 37, "Text"], Cell[9608, 420, 53, 1, 52, "Input"], Cell[9664, 423, 24, 0, 37, "Text"], Cell[9691, 425, 72, 1, 52, "Input"], Cell[9766, 428, 25, 0, 37, "Text"], Cell[9794, 430, 66, 1, 52, "Input"], Cell[9863, 433, 59, 1, 52, "Input"], Cell[9925, 436, 25, 0, 37, "Text"], Cell[9953, 438, 62, 1, 52, "Input"], Cell[10018, 441, 50, 0, 37, "Text"] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)