(************** Content-type: application/mathematica ************** Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. 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[ 130914, 2524]*) (*NotebookOutlinePosition[ 131684, 2550]*) (* CellTagsIndexPosition[ 131640, 2546]*) (*WindowFrame->Normal*) Notebook[{ Cell["Lab 7: Integration", "Title", Background->RGBColor[0, 0, 1]], Cell[TextData[{ "Math 233\tFall 2003\t", StyleBox["Chapter 16", FontFamily->"Arial", FontSize->16, FontWeight->"Bold"], " " }], "Subtitle", TextAlignment->Left, TextJustification->0], Cell[BoxData[{ \( (*MVCal2\ library\ for\ "\", by\ C . K . Cheung, G . E . Keough\ and\ T . Murdoch, published\ by\ John\ Wiley\ and\ Sons, \(\(Inc\)\(.\)\), ISBN\ 0 - 471 - 13754 - 5. \ This\ is\ a\ supplement\ to\ "\", by\ the\ Calculus\ Consortium\ based\ at\ Harvard, also\ published\ by\ John\ Wiley\ and\ Sons, Inc . This\ file\ maintained\ by\ Jerry\ Keough, Dept . of\ Mathematics, Boston\ College . It\ can\ be\ found\ via\ gopher\ at\ mathgopher . bc . edu . Address\ questions, comments, bug\ reports\ and\ so\ forth\ to\ Jerry\ at\ electronic\ address\ \ "\" . Note\ that\ at\ this\ beta - level\ of\ development, almost\ everything\ that\ is\ given\ in\ the\ text\ does\ just\ about\ \ what\ it\ is\ supposed\ to\ do . We\ have\ not\ yet\ put\ in\ the\ full\ error - checking\ of\ parameters\ that\ we\ want, and\ there\ are\ probably\ a\ few\ situations\ where\ you' ll\ get\ an\ error\ message\ that\ we\ haven' t\ trapped . We\ hope\ this\ will\ generate\ only\ a\ few\ minor\ problems . The\ file\ is\ distributable\ at\ this\ time\ only\ as\ a\ flat\ \ text\ file\ in\ multiple\ CR/LF\ formats, and\ contains\ only\ definitions\ of\ terms\ in\ the\ Global\ context . We\ choose\ the\ text\ file\ format\ since\ it\ will\ be\ easier\ \ to\ distribute, but\ we\ will\ be\ looking\ at\ notebook - specific\ possibilities\ later . We' ll\ also\ be\ looking\ to\ turn\ this\ into\ a\ proper\ package\ as\ \ well . Finally, little\ "\"\ is\ available\ at\ this\ time . We' re\ still\ looking\ at\ some\ possible\ \(\(approaches\)\(.\)\)*) \ \(\(mvcal2$version := "\<1.0b17, Monday, August 3, 1998.\>"\)\(\n\)\(\ \[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--Startup\)\)\)\)\)\ \)\)\)\)\)\)\)\)\)\ \(\(\(\(\(\(\(\(\(\(\(\(\(\(Sequence--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(Off[General::spell, General::spell1];\)\), "\n", \(\(Needs["\"];\)\), "\n", \(\(Needs["\"];\)\), "\n", \(\(ClearAll[x, y, z, r, phi, theta, rho];\)\n\[IndentingNewLine] (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--Defaults\)\)\)\)\)\)\)\)\)\)\)\)\)\)/\(\(\(\(\(\(\(\(\(\ \(\(\(\(\(Options--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\)\(-\ \)*) \[IndentingNewLine]\), "\[IndentingNewLine]", \(\(\(genericviewpoint = {3, 1, 1};\)\(\[IndentingNewLine]\) \)\), "\n", \(\(SetOptions[{Plot3D}, ViewPoint \[Rule] genericviewpoint, PlotPoints \[Rule] 12];\)\), "\n", \(\(SetOptions[{ListPlot3D}, ViewPoint \[Rule] genericviewpoint];\)\), "\n", \(\(SetOptions[{Graphics3D}, ViewPoint \[Rule] genericviewpoint];\)\), "\n", \(\(SetOptions[{SurfaceGraphics}, ViewPoint \[Rule] genericviewpoint];\)\), "\n", \(\(SetOptions[{ParametricPlot3D}, ViewPoint \[Rule] genericviewpoint, PlotPoints \[Rule] 12, Compiled \[Rule] False];\)\), "\n", \(\(SetOptions[{ParametricPlot}, Compiled \[Rule] False];\)\n\[IndentingNewLine] (*\(\(--\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--General\)\)\)\)\)\)\)\)\)\)\)\)\ Usage\ \ \(\(\(\(\(\(\(\(\(\(\(\(Statements--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)\)\(-\)*) \[IndentingNewLine]\), "\[IndentingNewLine]", \(\(\(exercise::usage := "\"\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(experiment::usage := "\"\)\(\ \[IndentingNewLine]\) \)\), "\n", \(\(\(demo::usage := "\"\)\(\ \[IndentingNewLine]\) \)\), "\n", \(\(\(example::usage := "\"\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\ \)\ 03\ \(\(\(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[showpoint]\), "\n", \(\(\(showpoint[x_, y_, z_, ViewPoint \[Rule] {a_, b_, c_}] := Show[Graphics3D[{Thickness[0.008], Line[{{\(-1.5\) Abs[x], 0, 0}, {1.5 Abs[x], 0, 0}}], Line[{{0, \(-1.5\) Abs[y], 0}, {0, 1.5 Abs[y], 0}}], Line[{{0, 0, \(-1.5\) Abs[z]}, {0, 0, 1.5 Abs[z]}}], Text["\", {1.7 Abs[x], 0, 0}], Text["\", {0, 1.7 Abs[y], 0}], Text["\", {0, 0, 1.7 Abs[z]}], Thickness[0.005], Dashing[{0.01, 0.01}], Line[{{x, y, z}, {x, y, 0}}], PointSize[0.03], Point[{x, y, z}], Polygon[{{0, 0, 0}, {x, 0, 0}, {x, y, 0}, {0, y, 0}}]}, Axes \[Rule] True, ViewPoint \[Rule] {a, b, c}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showpoint[x_, y_, z_] := showpoint[x, y, z, ViewPoint \[Rule] genericviewpoint]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showpoint[{x_, y_, z_}] := showpoint[x, y, z]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showpoint[{x_, y_, z_}, ViewPoint \[Rule] {a_, b_, c_}] := showpoint[x, y, z, ViewPoint \[Rule] {a, b, c}]\)\(\[IndentingNewLine]\)\(\n\) \)\), "\[IndentingNewLine]", \(\(\(showplane::usage := "\< showplane is an MVCal command to produce a picture of a plane given by a linear equation in the three variables x, y and z. Example: showplane[2x+3y==4z-8]. Without further specification, the equation is solved for 'z', and plotted over the rectangular domain {x,-10,10} and {y,-10,10}. (If the equation cannot be solved for z, then we'll try for y, and lastly for x.) If you explicitly specify a range of any two of the variables, the equation is solved for the third variable and the plane plotted over the given rectangular domain (the third variable must appear in the equation for this to be meaningful). Example: showplane[x+2y+3z==6,{x,-3,3},{z,-4,5}]. showplane supports DisplayFunction, ViewPoint and PlotRange options. Caution: planes viewed from certain ViewPoints can produce an empty graphic, so you may need to explicitly specify a PlotRange. (However, if this happens, you'll still see a complete graphic of the plane once it is combined with other graphics.)\>"\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showplane]\), "\n", \(\(Attributes[showplane] = {HoldAll};\)\), "\n", \(\(\(Options[showplane] = {DisplayFunction \[Rule] $DisplayFunction, ViewPoint \[Rule] {3, 1, 1}, PlotRange \[Rule] Automatic};\)\(\[IndentingNewLine]\) \)\), "\n", \(showplane::doNotUseEqualSign := "\"\), "\n", \(showplane::badVariables := "\"\), "\n", \(showplane::noVariables := "\"\), "\n", \(showplane::notLinearTermsOnly := "\"\), "\n", \(showplane::noZGivenXAndY := "\"\), "\n", \(showplane::noXGivenYAndZ := "\"\), "\n", \(\(\(showplane::noYGivenXAndZ := "\"\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showplane[lhs_ = rhs_, anythingelse___] := Message[showplane::doNotUseEqualSign];\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showplane[lhs_ \[Equal] rhs_, {x, x1_, x2_}, {y, y1_, y2_}, opts___Rule] := Module[{varList = Variables[lhs - rhs], xCoeffList = CoefficientList[lhs - rhs, x], yCoeffList = CoefficientList[lhs - rhs, y], zCoeffList = CoefficientList[lhs - rhs, z], disoption = \(DisplayFunction /. Cases[{opts}, _Rule]\) /. Options[showplane], viewoption = \(ViewPoint /. Cases[{opts}, _Rule]\) /. Options[showplane], proption = \(PlotRange /. Cases[{opts}, _Rule]\) /. Options[showplane]}, If[Length[varList] \[Equal] 0, Message[showplane::noVariables]; Return[]]; \[IndentingNewLine]If[ Complement[varList, {x, y, z}] \[NotEqual] {}, Message[showplane::badVariables]; Return[]]; \[IndentingNewLine]If[ Length[xCoeffList] > 2 || Length[yCoeffList] > 2 || Length[zCoeffList] > 2, Message[showplane::notLinearTermsOnly]; Return[]]; \[IndentingNewLine]If[Length[zCoeffList] < 2, Message[showplane::noZGivenXAndY]; Return[]]; \[IndentingNewLine]vector = {x, y, \(-First[zCoeffList]\)/ Last[zCoeffList]}; \[IndentingNewLine]ParametricPlot3D[ Evaluate[vector], {x, x1, x2}, {y, y1, y2}, PlotPoints \[Rule] 2, DisplayFunction \[Rule] disoption, ViewPoint \[Rule] viewoption, PlotRange \[Rule] proption]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showplane[lhs_ \[Equal] rhs_, {y, y1_, y2_}, {x, x1_, x2_}, opts___Rule] := showplane[lhs \[Equal] rhs, {x, x1, x2}, {y, y1, y2}, opts]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showplane[lhs_ \[Equal] rhs_, {y, y1_, y2_}, {z, z1_, z2_}, opts___Rule] := Module[{varList = Variables[lhs - rhs], xCoeffList = CoefficientList[lhs - rhs, x], yCoeffList = CoefficientList[lhs - rhs, y], zCoeffList = CoefficientList[lhs - rhs, z], disoption = \(DisplayFunction /. Cases[{opts}, _Rule]\) /. Options[showplane], viewoption = \(ViewPoint /. Cases[{opts}, _Rule]\) /. Options[showplane], proption = \(PlotRange /. Cases[{opts}, _Rule]\) /. Options[showplane]}, If[Length[varList] \[Equal] 0, Message[showplane::noVariables]; Return[]]; \[IndentingNewLine]If[ Complement[varList, {x, y, z}] \[NotEqual] {}, Message[showplane::badVariables]; Return[]]; \[IndentingNewLine]If[ Length[xCoeffList] > 2 || Length[yCoeffList] > 2 || Length[zCoeffList] > 2, Message[showplane::notLinearTermsOnly]; Return[]]; \[IndentingNewLine]If[Length[xCoeffList] < 2, Message[showplane::noXGivenYAndZ]; Return[]]; \[IndentingNewLine]vector = {\(-First[xCoeffList]\)/ Last[xCoeffList], y, z}; \[IndentingNewLine]ParametricPlot3D[ Evaluate[vector], {y, y1, y2}, {z, z1, z2}, PlotPoints \[Rule] 2, DisplayFunction \[Rule] disoption, ViewPoint \[Rule] viewoption, PlotRange \[Rule] proption]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showplane[lhs_ \[Equal] rhs_, {z, z1_, z2_}, {y, y1_, y2_}, opts___Rule] := showplane[lhs \[Equal] rhs, {y, y1, y2}, {z, z1, z2}, opts]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showplane[lhs_ \[Equal] rhs_, {x, x1_, x2_}, {z, z1_, z2_}, opts___Rule] := Module[{varList = Variables[lhs - rhs], xCoeffList = CoefficientList[lhs - rhs, x], yCoeffList = CoefficientList[lhs - rhs, y], zCoeffList = CoefficientList[lhs - rhs, z], disoption = \(DisplayFunction /. Cases[{opts}, _Rule]\) /. Options[showplane], viewoption = \(ViewPoint /. Cases[{opts}, _Rule]\) /. Options[showplane], proption = \(PlotRange /. Cases[{opts}, _Rule]\) /. Options[showplane]}, If[Length[varList] \[Equal] 0, Message[showplane::noVariables]; Return[]]; \[IndentingNewLine]If[ Complement[varList, {x, y, z}] \[NotEqual] {}, Message[showplane::badVariables]; Return[]]; \[IndentingNewLine]If[ Length[xCoeffList] > 2 || Length[yCoeffList] > 2 || Length[zCoeffList] > 2, Message[showplane::notLinearTermsOnly]; Return[]]; \[IndentingNewLine]If[Length[yCoeffList] < 2, Message[showplane::noYGivenXAndZ]; Return[]]; \[IndentingNewLine]vector = {x, \(-First[yCoeffList]\)/ Last[yCoeffList], z}; \[IndentingNewLine]ParametricPlot3D[ Evaluate[vector], {x, x1, x2}, {z, z1, z2}, PlotPoints \[Rule] 2, DisplayFunction \[Rule] disoption, ViewPoint \[Rule] viewoption, PlotRange \[Rule] proption]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showplane[lhs_ \[Equal] rhs_, {z, z1_, z2_}, {x, x1_, x2_}, opts___Rule] := showplane[lhs \[Equal] rhs, {x, x1, x2}, {z, z1, z2}, opts]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showplane[lhs_ \[Equal] rhs_, opts___Rule] := Module[{xCoeffList = CoefficientList[lhs - rhs, x], yCoeffList = CoefficientList[lhs - rhs, y], zCoeffList = CoefficientList[lhs - rhs, z]}, Which[Length[zCoeffList] \[Equal] 2, showplane[lhs \[Equal] rhs, {x, \(-10\), 10}, {y, \(-10\), 10}, opts], Length[xCoeffList] \[Equal] 2, showplane[lhs \[Equal] rhs, {y, \(-10\), 10}, {z, \(-10\), 10}, opts], Length[yCoeffList] \[Equal] 2, showplane[lhs \[Equal] rhs, {x, \(-10\), 10}, {z, \(-10\), 10}, opts]]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showpyramid]\), "\n", \(\(\(showpyramid[a_List, b_List, c_List, d_List, p_List] := Module[{g1, g2, g3, g4}, g1 = Graphics3D[{Line[{a, b, c, d, a}], Line[{a, p}], Line[{b, p}], Line[{c, p}], Line[{d, p}]}]; \[IndentingNewLine]Show[g1, BoxRatios \[Rule] Automatic, Axes \[Rule] True, PlotRange \[Rule] All]]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--Module\)\)\)\)\)\)\)\)\)\)\)\)\)\ 03\ \ \(\(\(\(\(\(\(\(\(\(\(\(\(EXPERIMENTS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)--\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(experiment[3, 1.11] := showpoint[2, 1, 3]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(experiment[3, 1.12] := showpoint[\(-2\), \(-3\), 2]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(experiment[3, 1.13] := showpoint[\(-1\), 3, \(-3\)]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 03\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(\(EXAMPLES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)--\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(example[3, 3.2] := ParametricPlot3D[{2 Sin[p]*Cos[t], 2 Sin[p]*Sin[t], 2 Cos[p]}, {p, 0, Pi}, {t, 0, 2 Pi}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 03\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[3, 1.1] := showpoint[\(-1\), 2, 4]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[3, 1.2] := showpoint[2, 3, 1]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[3, 1.3] := showpoint[\(-4\), \(-1\), 2]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[3, 2] := Module[{g1, g2, g3, g4, g5, g6, a, b, c, d, p}, a = {\(-1\), 1, 0}; \[IndentingNewLine]b = {2, 5, 0}; \[IndentingNewLine]c = {6, 2, 0}; \[IndentingNewLine]d = {3, \(-2\), 0}; \[IndentingNewLine]p = {5/2, 3/2, 5/Sqrt[2]}; \[IndentingNewLine]g1 = Graphics3D[{Line[{a, b, p, a}]}]; \[IndentingNewLine]g2 = Graphics3D[{Line[{d, c, p, d}]}]; \[IndentingNewLine]g3 = Graphics3D[{Line[{b, c}]}]; \[IndentingNewLine]g4 = Graphics3D[{Line[{a, d}]}]; \[IndentingNewLine]g5 = Graphics3D[{Text["\", a + {1, 1/4, 0}], Text["\", b + {1, 0, 0}], Text["\", c + {\(-1\), 0, 0}], Text["\", d + {1, 1/2, 0}], Text["\", p + {0, 1/2, 0}]}]; \[IndentingNewLine]g6 = Graphics3D[{PointSize[0.02], Point[a], Point[b], Point[c], Point[d], Point[p]}]; \[IndentingNewLine]Show[g1, g2, g3, g4, g5, g6, ViewPoint \[Rule] {3, 1, 1}, BoxRatios \[Rule] Automatic, Axes \[Rule] True]]\)\(\n\)\(\[IndentingNewLine]\)\( (*demos\ for\ Module\ 03\ *) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(demo[3, 1] := Show[Graphics3D[{Line[{{2, 0, 0}, {\(-2\), 0, 0}}], Line[{{0, 2, 0}, {0, \(-2\), 0}}], Line[{{0, 0, 2}, {0, 0, \(-2\)}}], Text["\", {2.2, 0, 0}], Text["\", {0, 2.2, 0}], Text["\", {0, 0, 2.2}]}], Axes \[Rule] True]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[3, 2] := Show[Graphics3D[{Line[{{2, 0, 0}, {0, 0, 0}}], Line[{{0, 2, 0}, {0, 0, 0}}], Line[{{0, 0, 2}, {0, 0, 0}}], Text["\", {2.2, 0, 0}], Text["\", {0, 2.2, 0}], Text["\", {0, 0, 2.2}]}], Axes \[Rule] True, PlotRange \[Rule] {{\(-2.5\), 2.5}, {\(-2.5\), 2.5}, {\(-2.5\), 2.5}}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 04\ \ \(\(\(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(ClearAll[tableofvalues]\), "\n", \(SetAttributes[tableofvalues, {HoldAll}]\), "\n", \(\(\(tableofvalues[expr_, {x, xvals__}, {y, yvals__}] := Module[{g}, g[a_, b_] := {x \[Rule] a, y \[Rule] b}; \[IndentingNewLine]TableForm[ expr /. Outer[g, List[xvals], List[yvals]], TableHeadings \[Rule] {List[xvals], List[yvals]}, TableSpacing \[Rule] {0, 3}, TableAlignments \[Rule] {Center, Bottom}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[4, 3] := Plot3D[x^2*y^2*\((x^2 - y^2)\), {x, \(-2\), 2}, {y, \(-2\), 2}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[4, 4.1] := Plot3D[x^2, {x, \(-2\), 2}, {y, \(-2\), 2}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[4, 4.2] := ParametricPlot3D[{r*Cos[t], r*Sin[t], r}, {r, 0, 2}, {t, 0, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[4, 4.3] := Plot3D[Sin[x^2], {x, \(-3\), 3}, {y, \(-2\), 2}, PlotPoints \[Rule] 20]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[4, 4.4] := Plot3D[x^2 + y^3, {x, \(-2\), 2}, {y, \(-2\), 2}, BoxRatios \[Rule] {1, 1, 1}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[4, 5] := Plot3D[Cos[x - 2*y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, ViewPoint \[Rule] {2, 2, 1}, PlotPoints \[Rule] 20]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 06\ \(\(\(\(\ \(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[levelsurfaceWithZ]\), "\n", \(\(\(levelsurfaceWithZ[expr_, levels_List, a_, b_, c_, d_, disoption_, boxoption_, ppoption_] := Module[{g, solns, i}, solns = Flatten[ Table[Solve[expr \[Equal] levels[\([i]\)], z], {i, 1, Length[levels]}]]; \[IndentingNewLine]surfaces = Table[{x, y, z} /. solns[\([i]\)], {i, 1, Length[solns]}]; \[IndentingNewLine]Off[ ParametricPlot3D::pplr]; \[IndentingNewLine]g = ParametricPlot3D[Evaluate[surfaces], {x, a, b}, {y, c, d}, DisplayFunction \[Rule] disoption, BoxRatios \[Rule] boxoption, PlotPoints \[Rule] ppoption]; \[IndentingNewLine]On[ ParametricPlot3D::pplr]; \[IndentingNewLine]Return[ g]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[levelsurfaceWithY]\), "\n", \(\(\(levelsurfaceWithY[expr_, levels_List, a_, b_, c_, d_, disoption_, boxoption_, ppoption_] := Module[{g, solns, surfaces, i}, solns = Flatten[ Table[Solve[expr \[Equal] levels[\([i]\)], y], {i, 1, Length[levels]}]]; \[IndentingNewLine]surfaces = Table[{x, y, z} /. solns[\([i]\)], {i, 1, Length[solns]}]; \[IndentingNewLine]Off[ ParametricPlot3D::pplr]; \[IndentingNewLine]g = ParametricPlot3D[Evaluate[surfaces], {x, a, b}, {z, \(-4\), 4}, DisplayFunction \[Rule] disoption, BoxRatios \[Rule] boxoption, PlotPoints \[Rule] ppoption, PlotRange \[Rule] {Automatic, {c, d}, Automatic}]; \[IndentingNewLine]On[ ParametricPlot3D::pplr]; \[IndentingNewLine]Return[ g]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[levelsurfaceWithX]\), "\n", \(\(\(levelsurfaceWithX[expr_, levels_List, a_, b_, c_, d_, disoption_, boxoption_, ppoption_] := Module[{g, solns, surfaces, i}, solns = Flatten[ Table[Solve[expr \[Equal] levels[\([i]\)], x], {i, 1, Length[levels]}]]; \[IndentingNewLine]surfaces = Table[{x, y, z} /. solns[\([i]\)], {i, 1, Length[solns]}]; \[IndentingNewLine]Off[ ParametricPlot3D::pplr]; \[IndentingNewLine]g = ParametricPlot3D[Evaluate[surfaces], {y, c, d}, {z, \(-4\), 4}, DisplayFunction \[Rule] disoption, BoxRatios \[Rule] boxoption, PlotPoints \[Rule] ppoption, PlotRange \[Rule] {{a, b}, Automatic, Automatic}]; \[IndentingNewLine]On[ ParametricPlot3D::pplr]; \[IndentingNewLine]Return[ g]]\)\(\[IndentingNewLine]\) \)\), "\n", \(ClearAll[levelsurface]\), "\n", \(SetAttributes[levelsurface, {HoldAll}]\), "\n", \(\(Options[levelsurface] = {DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] Automatic, PlotPoints \[Rule] 15};\)\), "\n", \(levelsurface::novariables := "\"\), "\n", \(\(\(levelsurface[expr_, levels_, {x, a_, b_}, {y, c_, d_}, opts___] := Module[{levs, disoption, boxoption, ppoption}, If[ListQ[levels], levs = levels, levs = List[ levels]]; \[IndentingNewLine]disoption = \(DisplayFunction /. Cases[List[opts], _Rule]\) /. Options[levelsurface]; \[IndentingNewLine]boxoption = \(BoxRatios \ /. Cases[List[opts], _Rule]\) /. Options[levelsurface]; \[IndentingNewLine]ppoption = \(PlotPoints \ /. Cases[List[opts], _Rule]\) /. Options[levelsurface]; \[IndentingNewLine]Which[\(! FreeQ[expr, z]\) && FreeQ[Dt[expr, z, Constants \[Rule] {x, y}], z], levelsurfaceWithZ[expr, levs, a, b, c, d, disoption, boxoption, ppoption], \(! FreeQ[expr, y]\) && FreeQ[Dt[expr, y, Constants \[Rule] {x, z}], y], levelsurfaceWithY[expr, levs, a, b, c, d, disoption, boxoption, ppoption], \(! FreeQ[expr, x]\) && FreeQ[Dt[expr, x, Constants \[Rule] {y, z}], x], levelsurfaceWithX[expr, levs, a, b, c, d, disoption, boxoption, ppoption], \(! FreeQ[expr, z]\), levelsurfaceWithZ[expr, levs, a, b, c, d, disoption, boxoption, ppoption], \(! FreeQ[expr, y]\), levelsurfaceWithY[expr, levs, a, b, c, d, disoption, boxoption, ppoption], \(! FreeQ[expr, x]\), levelsurfaceWithX[expr, levs, a, b, c, d, disoption, boxoption, ppoption], True, Message[levelsurface::novariables]]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[testquadricequation]\), "\n", \(\(\(testquadricequation[expr1_ \[Equal] expr2_] := Module[{expr, xcoeff, ycoeff, zcoeff, xcenter = 0, ycenter = 0, zcenter = 0, x1, y1, z1, stform}, expr = ExpandAll[expr1 - expr2]; \[IndentingNewLine]If[ Coefficient[expr, x^2] \[NotEqual] 0, xcenter = \(\(-Coefficient[expr, x]\)/2\)/ Coefficient[expr, x^2]]; \[IndentingNewLine]If[ Coefficient[expr, y^2] \[NotEqual] 0, ycenter = \(\(-Coefficient[expr, y]\)/2\)/ Coefficient[expr, y^2]]; \[IndentingNewLine]If[ Coefficient[expr, z^2] \[NotEqual] 0, zcenter = \(\(-Coefficient[expr, z]\)/2\)/ Coefficient[expr, z^2]]; \[IndentingNewLine]reducedexpr = Expand[expr /. {x \[Rule] \((x1 + xcenter)\), y \[Rule] \((y1 + ycenter)\), z \[Rule] \((z1 + zcenter)\)}]; \[IndentingNewLine]legitimate = Length[CoefficientList[reducedexpr, x1]] \[Equal] 3 && Length[CoefficientList[reducedexpr, y1]] \[Equal] 3 && Length[CoefficientList[reducedexpr, z1]] \[LessEqual] 3 && Length[CoefficientList[reducedexpr, z1]] \[GreaterEqual] 2; \[IndentingNewLine]If[\(! legitimate\), Return[{}]]; \[IndentingNewLine]x2coeff = Coefficient[reducedexpr, x1^2]; \[IndentingNewLine]y2coeff = Coefficient[reducedexpr, y1^2]; \[IndentingNewLine]z2coeff = Coefficient[reducedexpr, z1^2]; \[IndentingNewLine]z2linearcoeff = Coefficient[reducedexpr, z1]; \[IndentingNewLine]c = reducedexpr - x2coeff*x1^2 - y2coeff*y1^2 - z2coeff*z1^2 - z2linearcoeff*z1; \[IndentingNewLine]If[ Sign[x2coeff] \[Equal] \(-1\), x2coeff *= \(-1\); \[IndentingNewLine]y2coeff *= \(-1\); \ \[IndentingNewLine]z2coeff *= \(-1\); \[IndentingNewLine]z2linearcoeff *= \ \(-1\); \[IndentingNewLine]c *= \(-1\)]; \[IndentingNewLine]Return[{x2coeff, y2coeff, z2coeff, z2linearcoeff, \(-c\), {xcenter, ycenter, zcenter}}];]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showparaboloid]\), "\n", \(\(\(showparaboloid[expr1_ \[Equal] expr2_] := Module[{result, a, b, c, d, center}, result = testquadricequation[expr1 \[Equal] expr2]; \[IndentingNewLine]If[ result \[Equal] {}, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]c = result[\([3]\)]; \[IndentingNewLine]If[c \[NotEqual] 0, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]c = result[\([4]\)]; \[IndentingNewLine]If[c \[Equal] 0, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]a = result[\([1]\)]; \[IndentingNewLine]b = result[\([2]\)]; \[IndentingNewLine]d = result[\([5]\)]; (*the\ constant*) center = Last[result]; \[IndentingNewLine]ParametricPlot3D[ Evaluate[{x, y, \((\(-a\)*x^2 - b*y^2 - d)\)/c}], {x, center[\([1]\)] - 4, center[\([1]\)] + 4}, {y, center[\([2]\)] - 4, center[\([2]\)] + 4}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showhparaboloid]\), "\n", \(\(\(showhparaboloid[expr_] := showparaboloid[expr]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showellipsoid]\), "\n", \(\(\(showellipsoid[expr1_ \[Equal] expr2_] := Module[{result, a, b, c, d, center}, result = testquadricequation[expr1 \[Equal] expr2]; \[IndentingNewLine]If[ result \[Equal] {}, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]a = result[\([1]\)]; \[IndentingNewLine]b = result[\([2]\)]; \[IndentingNewLine]c = result[\([3]\)]; \[IndentingNewLine]If[ Sign[b] \[Equal] \(-1\) || Sign[c] \[LessEqual] 0, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]d = result[\([5]\)]; \[IndentingNewLine]If[N[d] \[LessEqual] 0, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]a = N[Sqrt[d/a]]; \[IndentingNewLine]b = N[Sqrt[d/b]]; \[IndentingNewLine]c = N[Sqrt[d/c]]; \[IndentingNewLine]center = Last[result]; \[IndentingNewLine]ParametricPlot3D[ Evaluate[{a\ Cos[t]\ Sin[p], b\ Sin[t]\ Sin[p], c\ Cos[p]} + center], {t, 0, 2 Pi}, {p, 0, Pi}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showcone]\), "\n", \(\(\(showcone[expr1_ \[Equal] expr2_] := Module[{result, a, b, c, d, center}, result = testquadricequation[expr1 \[Equal] expr2]; \[IndentingNewLine]If[ result \[Equal] {}, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]c = result[\([4]\)]; \[IndentingNewLine]If[c \[NotEqual] 0, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]c = result[\([3]\)]; \[IndentingNewLine]If[c \[Equal] 0, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]a = result[\([1]\)]/c; \[IndentingNewLine]b = result[\([2]\)]/c; \[IndentingNewLine]d = result[\([5]\)]/c; (*the\ constant*) If[ a \[Equal] 0 || b \[Equal] 0 || d \[NotEqual] 0 || Sign[a] \[NotEqual] \((\(-1\))\) || Sign[b] \[NotEqual] \((\(-1\))\), Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine] (*so\ we\ have\ \ \((\(-a\))\)*x^2 + \((\(-b\))\)*y^2 - z^2 \[Equal] 0, a < 0, b < 0*) center = Last[result]; \[IndentingNewLine]a = N[1/Sqrt[\(-a\)]]; \[IndentingNewLine]b = N[1/Sqrt[\(-b\)]]; \[IndentingNewLine] (*so\ we\ have\ x^2/ a^2 + \(\(*\)\(y^2/b^2\)\) \[Equal] z^2, a > 0, b > 0*) ParametricPlot3D[ Evaluate[{a*t*Cos[u], b*t*Sin[u], t} + center], {u, 0, 2 Pi}, {t, \(-2\), 2}, BoxRatios \[Rule] {1, 1, 1}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showhyperboloid1]\), "\n", \(\(\(showhyperboloid1[expr1_ \[Equal] expr2_] := Module[{result, a, b, c, d, center}, result = testquadricequation[expr1 \[Equal] expr2]; \[IndentingNewLine]If[ result \[Equal] {}, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]c = result[\([4]\)]; \[IndentingNewLine]If[c \[NotEqual] 0, Print["\"]; \[IndentingNewLine]Return[]]; \[IndentingNewLine]c = result[\([3]\)]; \[IndentingNewLine]If[c \[Equal] 0, Print["\"]; \[IndentingNewLine]Return[]]; \[IndentingNewLine]a = result[\([1]\)]/c; \[IndentingNewLine]b = result[\([2]\)]/c; \[IndentingNewLine]d = result[\([5]\)]/c; (*the\ constant*) If[ a \[Equal] 0 || b \[Equal] 0 || Sign[d] \[NotEqual] \((\(-1\))\) || Sign[a] \[NotEqual] \((\(-1\))\) || Sign[b] \[NotEqual] \((\(-1\))\), Print["\"]; \[IndentingNewLine]Return[]]; \[IndentingNewLine] (*so\ we\ have\ \ \((\(-a\))\)*x^2 + \((\(-b\))\)*y^2 - z^2 \[Equal] \((\(-d\))\), a < 0, b < 0, d < 0*) center = Last[result]; \[IndentingNewLine]a = N[1/Sqrt[\(-a\)]]; \[IndentingNewLine]b = N[1/Sqrt[\(-b\)]]; \[IndentingNewLine]d = N[Sqrt[\(-d\)]]; \[IndentingNewLine] (*so\ we\ have\ x^2/ a^2 + \(\(*\)\(y^2/b^2\)\) - z^2 \[Equal] d^2, a > 0, b > 0, d > 0*) ParametricPlot3D[ Evaluate[{a*d*Cosh[v] Cos[u], b*d*Cosh[v] Sin[u], d*Sinh[v]} + center], {u, 0, 2 Pi}, {v, \(-2\), 2}, BoxRatios \[Rule] {1, 1, 1}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showhyperboloid2]\), "\n", \(\(\(showhyperboloid2[expr1_ \[Equal] expr2_] := Module[{result, a, b, c, d, center, g1, g2}, result = testquadricequation[expr1 \[Equal] expr2]; \[IndentingNewLine]If[ result \[Equal] {}, Print["\"]; \ \[IndentingNewLine]Return[]]; \[IndentingNewLine]c = result[\([4]\)]; \[IndentingNewLine]If[c \[NotEqual] 0, Print["\"]; \[IndentingNewLine]Return[]]; \[IndentingNewLine]c = result[\([3]\)]; \[IndentingNewLine]If[c \[Equal] 0, Print["\"]; \[IndentingNewLine]Return[]]; \[IndentingNewLine]a = result[\([1]\)]/c; \[IndentingNewLine]b = result[\([2]\)]/c; \[IndentingNewLine]d = result[\([5]\)]/c; (*the\ constant*) If[ a \[Equal] 0 || b \[Equal] 0 || Sign[d] \[NotEqual] 1 || Sign[a] \[NotEqual] \((\(-1\))\) || Sign[b] \[NotEqual] \((\(-1\))\), Print["\"]; \[IndentingNewLine]Return[]]; \[IndentingNewLine] (*so\ we\ have\ \ \((\(-a\))\)*x^2 + \((\(-b\))\)*y^2 - z^2 \[Equal] \((\(-d\))\), a < 0, b < 0, d > 0*) center = Last[result]; \[IndentingNewLine]g1 = Plot3D[Sqrt[\((\(-a\))\)*x^2 + \((\(-b\))\)*y^2 + d] + center[\([3]\)], {x, center[\([1]\)] - 4, center[\([1]\)] + 4}, {y, center[\([2]\)] - 4, center[\([2]\)] + 4}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = Plot3D[\(-Sqrt[\((\(-a\))\)*x^2 + \((\(-b\))\)*y^2 + d]\) + center[\([3]\)], {x, center[\([1]\)] - 4, center[\([1]\)] + 4}, {y, center[\([2]\)] - 4, center[\([2]\)] + 4}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, g2, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] {1, 1, 1}]]\)\(\n\)\(\[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 07\ \(\(\(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[crossproduct]\), "\n", \(\(\(crossproduct[vp_List, vq_List] := {vp[\([2]\)] vq[\([3]\)] - vp[\([3]\)] vq[\([2]\)], \(-vp[\([1]\)]\) vq[\([3]\)] + vp[\([3]\)] vq[\([1]\)], vp[\([1]\)] vq[\([2]\)] - vp[\([2]\)] vq[\([1]\)]}\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[arrow2d]\), "\n", \(\(\(arrow2d[{o1_, o2_}, {v1_, v2_}] := Graphics[{Arrow[{o1, o2}, {o1, o2} + {v1, v2}]}]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showvectors2d]\), "\n", \(\(Options[showvectors2d] = {initialpoint \[Rule] {0, 0}, AspectRatio \[Rule] Automatic, Axes \[Rule] True, DisplayFunction \[Rule] $DisplayFunction, PlotRange \[Rule] All};\)\), "\n", \(\(\(showvectors2d[v__] := Module[{args = Cases[{v}, _List], opts = Cases[{v}, _Rule], initpoint, g, displayoption, aroption, proption}, initpoint = \(initialpoint /. opts\) /. Options[showvectors2d]; \[IndentingNewLine]displayoption = \ \(DisplayFunction /. opts\) /. Options[showvectors2d]; \[IndentingNewLine]axoption = \(Axes /. opts\) /. Options[ showvectors2d]; \[IndentingNewLine]aroption = \(AspectRatio /. opts\) /. Options[ showvectors2d]; \[IndentingNewLine]proption = \(PlotRange /. opts\) /. Options[showvectors2d]; \[IndentingNewLine]Which[ Length[args] \[Equal] 0, Print["\"], Apply[And, Map[VectorQ, args]] \[Equal] False, Print["\"], Count[Map[Length, args], 2] \[NotEqual] Length[args], Print["\"], \(! VectorQ[ initpoint]\) || Length[initpoint] \[NotEqual] 2, Print["\"], True, g = Map[arrow2d[initpoint, #] &, args]; \[IndentingNewLine]Show[g, Axes \[Rule] axoption, AspectRatio \[Rule] aroption, DisplayFunction \[Rule] displayoption, PlotRange \[Rule] proption]]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[arrow3d]\), "\n", \(\(\(arrow3d[{o1_, o2_, o3_}, {v1_, v2_, v3_}] := Module[{rectangularof, deltaAngle = N[Pi/10], a = N[\(-v1\)], b = \(-v2\), c = \(-v3\), rho1, theta1, phi1}, rho1 = N[Sqrt[a^2 + b^2 + c^2]]; \[IndentingNewLine]theta1 = Which[a \[Equal] 0, N[Sign[b]*Pi/2], a > 0, N[ArcTan[b/a]], True, N[ArcTan[b/a] + Pi]]; \[IndentingNewLine]phi1 = N[ArcCos[c/Sqrt[rho1^2]]]; (*spherical\ for\ {a, b, c}*) rectangularof[rho_, theta_, phi_] := N[rho*{Sin[phi] Cos[theta], Sin[phi] Sin[theta], Cos[phi]}]; \[IndentingNewLine]g1 = Graphics3D[{GrayLevel[0], Thickness[0.01], Line[{{o1, o2, o3}, {o1, o2, o3} + {v1, v2, v3}}], Line[{{o1, o2, o3} + {v1, v2, v3}, {o1, o2, o3} + {v1, v2, v3} + rectangularof[rho1/10, theta1 + deltaAngle, phi1], {o1, o2, o3} + {v1, v2, v3} + rectangularof[rho1/10, theta1, phi1]}], Line[{{o1, o2, o3} + {v1, v2, v3}, {o1, o2, o3} + {v1, v2, v3} + rectangularof[rho1/10, theta1 - deltaAngle, phi1], {o1, o2, o3} + {v1, v2, v3} + rectangularof[rho1/10, theta1, phi1]}], Line[{{o1, o2, o3} + {v1, v2, v3}, {o1, o2, o3} + {v1, v2, v3} + rectangularof[rho1/10, theta1, phi1 + deltaAngle], {o1, o2, o3} + {v1, v2, v3} + rectangularof[rho1/10, theta1, phi1]}], Line[{{o1, o2, o3} + {v1, v2, v3}, {o1, o2, o3} + {v1, v2, v3} + rectangularof[rho1/10, theta1, phi1 - deltaAngle], {o1, o2, o3} + {v1, v2, v3} + rectangularof[rho1/10, theta1, phi1]}]}]; \[IndentingNewLine]Return[ g1]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showvectors3d]\), "\n", \(\(Options[showvectors3d] = {initialpoint \[Rule] {0, 0, 0}, BoxRatios \[Rule] Automatic, DisplayFunction \[Rule] $DisplayFunction, PlotRange \[Rule] All};\)\), "\n", \(\(\(showvectors3d[v__] := Module[{args = Cases[{v}, _List], opts = Cases[{v}, _Rule], initpoint, displayoption, g, boxoption, proption}, initpoint = \(initialpoint /. opts\) /. Options[showvectors3d]; \[IndentingNewLine]displayoption = \ \(DisplayFunction /. opts\) /. Options[showvectors3d]; \[IndentingNewLine]boxoption = \ \(BoxRatios /. opts\) /. Options[showvectors3d]; \[IndentingNewLine]proption = \(PlotRange \ /. opts\) /. Options[showvectors3d]; \[IndentingNewLine]Which[ Length[args] \[Equal] 0, Print["\"], Apply[And, Map[VectorQ, args]] \[Equal] False, Print["\"], Count[Map[Length, args], 3] \[NotEqual] Length[args], Print["\"], \(! VectorQ[ initpoint]\) || Length[initpoint] \[NotEqual] 3, Print["\"], True, g = Map[arrow3d[initpoint, #] &, args]; \[IndentingNewLine]Show[g, Axes \[Rule] True, DisplayFunction \[Rule] displayoption, BoxRatios \[Rule] boxoption, PlotRange \[Rule] proption]]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showvectors]\), "\n", \(\(\(showvectors[v__] := If[Length[First[{v}]] \[Equal] 2, showvectors2d[v], showvectors3d[v]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showarrow]\), "\n", \(\(\(showarrow[p_, q_] := showvectors[q - p, initialpoint \[Rule] p]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[vectorlength]\), "\n", \(\(\(vectorlength[v_] := Sqrt[Apply[Plus, Map[#^2 &, v]]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[angle]\), "\n", \(\(\(angle[v1_, v2_] := N[ArcCos[\(v1 . v2/vectorlength[v1]\)/ vectorlength[v2]]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[rhandtest]\), "\n", \(\(\(rhandtest[v_List, w_List] := Module[{g1, g2, g3, origin, cp, usecp, messg, fred}, origin = {0, 0, 0}; \[IndentingNewLine]g1 = Graphics3D[{RGBColor[0, 0, 1], Line[{origin, v}]}]; \[IndentingNewLine]g2 = Graphics3D[{RGBColor[0, 1, 0], Line[{origin, w}]}]; \[IndentingNewLine]usecp = 2*Random[Integer, {0, 1}] - 1; \[IndentingNewLine]cp = usecp*crossproduct[v, w]; \[IndentingNewLine]g3 = Graphics3D[{Thickness[0.02], RGBColor[1, 0, 0], Line[{origin, cp}]}]; \[IndentingNewLine]Show[g1, g2, g3, Axes \[Rule] True, PlotRange \[Rule] All]; \[IndentingNewLine]fred = Characters[ InputString["\"]]; \[IndentingNewLine]messg = Which[Length[fred] \[Equal] 0, "\", \((fred[\([1]\)] \ \[Equal] "\")\) && \((usecp \[Equal] 1)\), "\", \((fred[\([1]\)] \ \[Equal] "\")\) && \((usecp \[Equal] 1)\), "\", \((fred[\([1]\)] \ \[Equal] "\")\) && \((usecp \[Equal] \(-1\))\), "\", \((fred[\([1]\)] \[Equal] "\")\) && \((usecp \[Equal] \ \(-1\))\), "\", True, "\"]; \ \[IndentingNewLine]Print[messg]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showcrossproduct]\), "\n", \(\(Options[ showcrossproduct] = {initialpoint \[Rule] {0, 0, 0}};\)\), "\n", \(\(\(showcrossproduct[{a1_, a2_, a3_}, {b1_, b2_, b3_}, opts___] := showcrossproduct1[{a1, a2, a3}, {b1, b2, b3}, \(initialpoint /. Cases[List[opts], _Rule]\) /. Options[showcrossproduct]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showcrossproduct1]\), "\n", \(\(\(showcrossproduct1[{a1_, a2_, a3_}, {b1_, b2_, b3_}, {x1_, x2_, x3_}] := Module[{cp = {a2*b3 - b2*a3, \(-b3\)*a1 + b1*a3, a1*b2 - b1*a2}}, Show[Graphics3D[{GrayLevel[0.5], Line[{{x1, x2, x3}, {x1, x2, x3} + {a1, a2, a3}}], Line[{{x1, x2, x3}, {x1, x2, x3} + {b1, b2, b3}}], GrayLevel[0], Thickness[0.015], Line[{{x1, x2, x3}, {x1, x2, x3} + cp}]}], BoxStyle \[Rule] {GrayLevel[0.75]}, Axes \[Rule] True]]\)\(\[IndentingNewLine]\)\(\n\)\(\[IndentingNewLine]\)\( \ (*demos\ for\ Module\ 07*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(demo[7, 1] := showvectorfield[{1, 2}, {x, \(-2\), 2}, {y, \(-2\), 2}, plotpoints \[Rule] 4]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[7, 2, showit_] := (*comment : not\ really\ the\ picture\ in\ the\ \(text!\)*) Module[{g1}, g1 = showvectors[{1, 1, 3}, {\(-1\), 1, 0}, {0, \(-3\), 1}, {\(-2\), \(-1\), 1}, {3, 0, \(-1\)}, {1, 5, \(-2\)}, {2, 1, \(-1\)}, {\(-2\), 2, 0}, {3/2, \(-1\)/2, \(-2\)/6}, {\(-1\)/4, \(-1\)/4, \(-3\)/ 4}, {\(-1\), \(-1\), 2/3}, {1, \(-2\), 1/3}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]If[showit, Show[g1, BoxRatios \[Rule] {1, 1, 1}, ViewPoint \[Rule] {2, \(-0.5\), 0}, DisplayFunction \[Rule] $DisplayFunction], Show[g1, BoxRatios \[Rule] {1, 1, 1}, ViewPoint \[Rule] {2, \(-0.5\), 0}, DisplayFunction \[Rule] Identity]]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[7, 2] := demo[7, 2, True]\)\(\[IndentingNewLine]\)\(\[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\ \)\)\)\)\)\)\)\)\)\)\)\)\)\)\ \(\(\(\(\(\(\(\(\(\(\(\(\(\(\(\(08--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\n\)\(\ \[IndentingNewLine]\)\( (*demos\ for\ module\ 8*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(demo[8, 1] := Module[{pict1, pict2}, pict1 = ParametricPlot3D[{t, 1, t + 1 - t^3}, {t, \(-2\), 2}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]pict2 = ParametricPlot3D[{t, 1, 1 + t}, {t, \(-2\), 2}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[pict1, pict2, BoxRatios \[Rule] {1, 1, 1}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-10\), 10}}, DisplayFunction \[Rule] $DisplayFunction]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[8, 2] := Module[{pict1, pict2}, pict1 = ParametricPlot3D[{0, t, t^2}, {t, \(-2\), 2}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]pict2 = ParametricPlot3D[{0, 1 + t, 1 + 2 t}, {t, \(-2\), 2}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[pict1, pict2, BoxRatios \[Rule] {1, 1, 1}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-10\), 10}}, DisplayFunction \[Rule] $DisplayFunction]]\)\(\n\)\(\ \[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 08\ \(\(\(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[8, 1] := Plot3D[x^2 + 4 y^2 - Sin[x*y] - 3 y, {x, \(-1\), 1.2}, {y, \(-1\), 1.2}, BoxRatios \[Rule] {1, 1, 1}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[8, 4] := Plot3D[2 x + 3 y - 4, {x, \(-2\), 2}, {y, \(-2\), 2}, PlotPoints \[Rule] 5, AxesLabel \[Rule] {"\", "\", "\"}]\)\(\n\)\(\ \[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 10\ \(\(\(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(Clear[directionalplot];\)\), "\n", \(\(Options[ directionalplot] = {DisplayFunction \[Rule] $DisplayFunction};\)\), \ "\n", \(\(\(directionalplot[expr_, {x0_, y0_}, {dx_, dy_}, opts___] := Module[{unitvec, x3, y3, x4, y4, vertex1, vertex2, vertex3, theta, g1, g2, g3, g4, g5, displayoption}, displayoption = \(DisplayFunction /. Cases[List[opts], _Rule]\) /. Options[directionalplot]; \[IndentingNewLine]unitvec = {dx, dy}/ Sqrt[dx^2 + dy^2]; \[IndentingNewLine]x3 = First[unitvec]; \[IndentingNewLine]y3 = Last[unitvec]; \[IndentingNewLine]g1 = Graphics3D[{PointSize[ 0.2]; \[IndentingNewLine]Point[{x0, y0, 0}]; \[IndentingNewLine]AbsoluteThickness[ 0.1]; \[IndentingNewLine]Line[{{x0 + x3, y0 + y3, 0}, {x0, y0, 0}, {x0, y0, Evaluate[ expr /. {x \[Rule] x0, y \[Rule] y0}]}}]}]; \[IndentingNewLine]g2 = ParametricPlot3D[{x0 + t*x3, y0 + t*y3, Evaluate[ expr /. {x \[Rule] x0 + t*x3, y \[Rule] y0 + t*y3}]}, {t, 0, 1}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g3 = ParametricPlot3D[{x0 + t*x3, y0 + t*y3, s*Evaluate[ expr /. {x \[Rule] x0 + t*x3, y \[Rule] y0 + t*y3}]}, {t, 0, .5}, {s, 0, 1}, PlotPoints \[Rule] {3, 10}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]x4 = Max[x3, 1/2]; \[IndentingNewLine]y4 = Max[y3, 1/2]; \[IndentingNewLine]g4 = Plot3D[expr, {x, x0 - x4, x0 + x4}, {y, y0 - y4, y0 + y4}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine] (*now\ for\ the\ damn\ arrow*) vertex1 = {0, 0, 0} + {x0 + 1.2*x3, y0 + 1.2*y3, 0}; \[IndentingNewLine]theta = Pi/12; \[IndentingNewLine]vertex2 = \(({{Cos[ theta], \(-Sin[theta]\)}, {Sin[theta], Cos[theta]}} . \((\(-unitvec\))\))\)/ 4; \[IndentingNewLine]vertex2 = Append[vertex2, 0] + {x0 + 1.2*x3, y0 + 1.2*y3, 0}; \[IndentingNewLine]vertex3 = \(({{Cos[\(-theta\)], \ \(-Sin[\(-theta\)]\)}, {Sin[\(-theta\)], Cos[\(-theta\)]}} . \((\(-unitvec\))\))\)/ 4; \[IndentingNewLine]vertex3 = Append[vertex3, 0] + {x0 + 1.2*x3, y0 + 1.2*y3, 0}; \[IndentingNewLine]g5 = Graphics3D[{Thickness[0.012], Line[{{x0, y0, 0}, {x0 + 1.2*x3, y0 + 1.2*y3, 0}}], Polygon[{vertex1, vertex2, vertex3}]}]; \[IndentingNewLine]Show[ g1, g2, g3, g4, g5, DisplayFunction \[Rule] displayoption, BoxRatios \[Rule] {1, 1, 1}, Axes \[Rule] True]]\)\(\n\)\(\[IndentingNewLine]\)\( (*demos\ for\ module\ 10\ *) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(demo[10, 1] := Module[{f, g1, g2}, f[x_, y_] := x*y + y^3; \[IndentingNewLine]g1 = showvectors[{1/Sqrt[5], 1/Sqrt[5], 0}, initialpoint \[Rule] {1, 1, 0}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ParametricPlot3D[{1/Sqrt[5]*t + 1, 2/Sqrt[5]*t + 1, f[1/Sqrt[5]*t + 1, 2/Sqrt[5]*t + 1]}, {t, 0, 1}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, g2, PlotRange \[Rule] {{0, 2}, {0.5, 1.6}, {0, 10}}, BoxRatios \[Rule] {1, 1, 1}, ViewPoint \[Rule] {5, 1.5, .2}, Ticks \[Rule] {{0.5, 1, 1.5}, Automatic, Automatic}, DisplayFunction \[Rule] $DisplayFunction]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[10, 2] := Module[{f, g1}, f[x_, y_] := x*y + y^3; \[IndentingNewLine]g1 = directionalplot[f[x, y], {1, 1}, {1/Sqrt[5], 2/Sqrt[5]}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, ViewPoint \[Rule] {5, 1.5, .2}, DisplayFunction \[Rule] $DisplayFunction]]\)\(\n\)\(\ \[IndentingNewLine]\)\( (*\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(\ --\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 10\ \ \(\(\(\(\(\(\(\(\(\(\(\(\(\(EXAMPLES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)--\)--\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(example[10, 2.2] := Module[{pict1, pict2}, pict1 = ContourPlot[\((x*y - x)\)/5, {x, 0, 2}, {y, 1, 3}, ContourShading \[Rule] False, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]pict2 = showvectors[{1.5/5, 1.5/5}, {\(-2\)/5, 1/5}, {2/5, 0}, initialpoint \[Rule] {1, 2}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[pict1, pict2, DisplayFunction \[Rule] $DisplayFunction]]\)\(\n\)\(\ \[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 11\ \(\(\(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[poly]\), "\n", \(\(\(poly[expr_, {x0_, y0_}, order \[Rule] 1] := Module[{b0, b1, b2}, b0 = expr /. {x \[Rule] x0, y \[Rule] y0}; \[IndentingNewLine]b1 = D[expr, x] /. {x \[Rule] x0, y \[Rule] y0}; \[IndentingNewLine]b2 = D[expr, y] /. {x \[Rule] x0, y \[Rule] y0}; \[IndentingNewLine]b0 + b1*\((x - x0)\) + b2*\((y - y0)\)]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(poly[expr_, {x0_, y0_}, order \[Rule] n_Integer] := Module[{}, If[n < 1, Return["\"]]; \ \[IndentingNewLine]Sum[\((D[expr, {x, i}, {y, n - i}] /. {x \[Rule] x0, y \[Rule] y0})\)* Binomial[n, i]/\(n!\)*\((x - x0)\)^ i*\((y - y0)\)^\((n - i)\), {i, 0, n}] + poly[expr, {x0, y0}, order \[Rule] \((n - 1)\)]]\)\(\n\)\(\[IndentingNewLine]\)\( (*DEMOS\ for\ \ Module\ 11*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(demo[11, 1] := Module[{}, Animate[ParametricPlot[{{\((s - 0.5)\)/2 + t, 0.003*Sin[2765]\ Sin[Pi\ t] + \((s - 0.5)\)/2*0.003\ Pi\ Cos[ Pi\ t]\ Sin[2765]}, {s, 0.003\ Sin[2765]\ Sin[Pi\ s]}}, {s, 0, 1}, PlotRange \[Rule] {{0, 1}, {0, 0.0012}}, PlotStyle \[Rule] {{RGBColor[1, 0, 0]}, {GrayLevel[0]}}], {t, 0.2, 0.4}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[11, 2] := Module[{}, Animate[{Plot[0.003\ Sin[2765\ t]\ Sin[Pi\ x], {x, 0, 1}, PlotRange \[Rule] {{0, 1}, {\(-0.0035\), 0.0035}}], Plot[0.003*Sin[0.3*Pi]*Sin[2765*t] + \((x - 0.3)\)*0.003*Pi* Cos[0.3*Pi]*Sin[2765*t], {x, 0.1, 0.5}, PlotStyle \[Rule] {{RGBColor[1, 0, 0]}}, PlotRange \[Rule] {{0, 1}, {\(-0.0035\), 0.0035}}]}, {t, 1, 1.002}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[11, 3] := Module[{g1, g2}, g1 = Plot[0.003\ Sin[2765]\ Sin[Pi\ x], {x, 0, 1}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2[t_] := showvectors[{0, \((8.295*Cos[2765]*Sin[Pi*t])\)/5000}, initialpoint \[Rule] {t, 0.003\ Sin[2765]\ Sin[Pi\ t]}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Animate[ Show[g1, g2[t], PlotRange \[Rule] {{0, 1}, {0, 0.0030}}], {t, 0.2, 0.4}, Frames \[Rule] 10]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[11, 4] := Module[{h1, h2}, h1[t_] := Plot[0.003*Sin[Pi*x]*Sin[2765*t], {x, 0, 1}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]h2[t_] = showvectors[{0, \((8.295*Cos[2765*t]*Sin[Pi*0.3])\)/2000}, initialpoint \[Rule] {0.3, 0.003\ Sin[2765*t]*Sin[Pi*0.3]}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Animate[ Show[h1[t], h2[t], PlotRange \[Rule] {{0, 1}, {\(-0.0035\), 0.0035}}], {t, 1, 1.002}, Frames \[Rule] 8]]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 12\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[gradplot]\), "\n", \(\(\(gradplot[expr_, {x_Symbol, x1_, x2_}, {y_Symbol, y1_, y2_}] := showvectorfield[{D[expr, x], D[expr, y]}, {x, x1, x2}, {y, y1, y2}]\)\(\[IndentingNewLine]\)\(\[IndentingNewLine]\)\( (*\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\ \)\ 12\ \(\(\(\(\(\(\(\(\(\(\(\(\(\(EXAMPLES--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)*) \)\(\n\)\(\[IndentingNewLine]\)\( (*this\ one\ \ added\ to\ produce\ figure\ 5\ on\ page\ 109*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(example[12, 1.7] := ParametricPlot3D[ Evaluate[{{x, y, x^2 - y^2} /. {x \[Rule] 0, y \[Rule] t}, {x, y, x^2 - y^2} /. {x \[Rule] t, y \[Rule] 0}}], {t, \(-2\), 2}, BoxRatios \[Rule] {1, 1, 1}, ViewPoint \[Rule] {3, 1, 1}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(example[12, 1.8] := ParametricPlot3D[{{0, y, 0}, {y, 0, y^3}}, {y, \(-3\), 3}, BoxRatios \[Rule] {1, 1, 1}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 13\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[lagrange]\), "\n", \(\(\(lagrange[expr_, level_, Equal[one_, two_], {x_Symbol, a_, b_}, {y_Symbol, c_, d_}] := Module[{g1, g2}, g1 = ContourPlot[one - two, {x, a, b}, {y, c, d}, Contours \[Rule] {0}, ContourShading \[Rule] False, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ContourPlot[expr, {x, a, b}, {y, c, d}, Contours \[Rule] {level}, ContourShading \[Rule] False, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, g2, Frame \[Rule] False, Axes \[Rule] True, DisplayFunction \[Rule] $DisplayFunction]]\)\(\n\)\(\ \[IndentingNewLine]\)\( (*demos\ for\ Module\ 13*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(demo[13, 1] := ParametricPlot3D[{t, 3.78 - t, s*\((t)\)^\((2/3)\)*\((3.78 - t)\)^\((1/3)\)}, {t, 0.5, 3.5}, {s, 0, 1}, PlotRange \[Rule] {{0.5, 5}, {0.5, 5}, {0, 5}}, BoxRatios \[Rule] {1, 1, 1}, ViewPoint \[Rule] {3, 1, 1}, Ticks \[Rule] {Automatic, Automatic, {0, 2, 4}}]\)\(\n\)\(\[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 13\ \(\(\(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[13, 3] := Module[{pict1, pict2}, pict1 = showvectorfield[{0.5, 0.2}, {x, \(-2\), 1.5}, {y, \(-1.3\), 1.3}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]pict2 = ParametricPlot[{2 Cos[t], 4/3 Sin[t]}, {t, 0, 2 Pi}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[pict1, pict2, AspectRatio \[Rule] Automatic, DisplayFunction \[Rule] $DisplayFunction]]\)\(\n\)\(\ \[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 14\ \(\(\(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[showsolid]\), "\n", \(\(\(showsolid[expr_, {x, a_, b_}, {y, c_, d_}] := dzdxdyplot[{z, 0, expr}, {x, a, b}, {y, c, d}, BoxRatios \[Rule] {1, 1, 1}]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[riemannsum]\), "\n", \(\(\(riemannsum[expr_, {x, a_, b_}, {y, c_, d_}, n_, m_] := Module[{s}, s = Table[ N[expr], {x, a, b - \((b - a)\)/n, \((b - a)\)/n}, {y, c, d - \((d - c)\)/m, \((d - c)\)/m}]; \[IndentingNewLine]N[ Apply[Plus, Flatten[s]]*\((b - a)\)/n*\((d - c)\)/ m]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showsolidblocks]\), "\n", \(\(\(showsolidblocks[expr_, {x, a_, b_}, {y, c_, d_}, n_, m_] := Module[{t, dx, dy}, dx = \((b - a)\)/n; dy = \((d - c)\)/m; \[IndentingNewLine]t = Table[Cuboid[{x, y, 0}, {x + dx, y + dy, f[x, y]}], {x, a, b - dx, dx}, {y, c, d - dy, dy}]; \[IndentingNewLine]Show[ Graphics3D[Flatten[t]], Axes \[Rule] True, BoxRatios \[Rule] {1, 1, 1/2}, ViewPoint \[Rule] {3, 1, 1}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showyslices]\), "\n", \(\(\(showyslices[expr_, {x_Symbol, a_, b_}, {y_Symbol, c_, d_}, n_Integer] := Module[{g, dx}, dx = \((b - a)\)/n; \[IndentingNewLine]g = Table[dzdydxplot[{z, 0, Evaluate[expr /. x \[Rule] a + i*dx]}, {y, c, d}, {x, a + i*dx, a + \((i + 1)\)*dx}, DisplayFunction \[Rule] Identity, PlotPoints \[Rule] {2, 12, 2}], {i, 0, n - 1}]; \[IndentingNewLine]Show[g, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] {1, 1, 1}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[showxslices]\), "\n", \(\(\(showxslices[expr_, {x_Symbol, a_, b_}, {y_Symbol, c_, d_}, n_Integer] := Module[{g, dy}, dy = \((d - c)\)/n; \[IndentingNewLine]g = Table[dzdxdyplot[{z, 0, Evaluate[expr /. y \[Rule] c + i*dy]}, {x, a, b}, {y, c + i*dy, c + \((i + 1)\)*dy}, DisplayFunction \[Rule] Identity, PlotPoints \[Rule] {2, 2, 12}], {i, 0, n - 1}]; \[IndentingNewLine]Show[g, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] {1, 1, 1}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(ClearAll[dxdyplot]\), "\n", \(SetAttributes[dxdyplot, HoldAll]\), "\n", \(\(Options[dxdyplot] = {DisplayFunction \[Rule] $DisplayFunction, AspectRatio \[Rule] 1/GoldenRatio};\)\), "\n", \(dxdyplot::notNum := "\"\ \), "\n", \(dxdyplot::wrongOrder1 := "\"\), "\n", \(dxdyplot::wrongOrder2 := "\"\), "\n", \(\(\(dxdyplot[{x, expr1_, expr2_}, {y, a_, b_}, opts___] := Module[{g1, g2, g3, testvalues, disoption, aroption}, If[\(! NumberQ[N[a]]\) || \(! NumberQ[N[b]]\), Return[Message[dxdyplot::notNum]]]; \[IndentingNewLine]If[ N[a] > N[b], Return[Message[ dxdyplot::wrongOrder1]]]; \[IndentingNewLine]testvalues = Table[N[expr2 - expr1], {y, a, b, \((b - a)\)/20}]; \[IndentingNewLine]If[ Apply[Or, Map[Negative, Chop[testvalues, 0.000001]]], Return[Message[ dxdyplot::wrongOrder2]]]; \[IndentingNewLine]disoption = \ \(DisplayFunction /. List[opts]\) /. Options[dxdyplot]; \[IndentingNewLine]aroption = \(AspectRatio /. List[opts]\) /. Options[dxdyplot]; \[IndentingNewLine]g1 = ParametricPlot[{expr1, y}, {y, a, b}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ParametricPlot[{expr2, y}, {y, a, b}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g3 = Table[Line[{{expr1, y}, {expr2, y}}], {y, a, b, \((b - a)\)/20}]; \[IndentingNewLine]Show[g1, g2, Graphics[g3], DisplayFunction \[Rule] disoption, AspectRatio \[Rule] aroption]]\)\(\[IndentingNewLine]\) \)\), "\n", \(dxdyplot::wrongOrder3 := "\"\), "\n", \(\(\(dxdyplot[{y, expr1_, expr2_}, {x, a_, b_}] := Message[dxdyplot::wrongOrder3]\)\(\[IndentingNewLine]\) \)\), "\n", \(ClearAll[dydxplot]\), "\n", \(SetAttributes[dydxplot, HoldAll]\), "\n", \(\(Options[dydxplot] = {DisplayFunction \[Rule] $DisplayFunction, AspectRatio \[Rule] 1/GoldenRatio};\)\), "\n", \(dydxplot::notNum := "\"\ \), "\n", \(dydxplot::wrongOrder1 := "\"\), "\n", \(dydxplot::wrongOrder2 := "\"\), "\n", \(\(\(dydxplot[{y, expr1_, expr2_}, {x, a_, b_}, opts___] := Module[{g1, g2, g3, testvalues, disoption, aroption}, If[\(! NumberQ[N[a]]\) || \(! NumberQ[N[b]]\), Return[Message[dydxplot::notNum]]]; \[IndentingNewLine]If[ N[a] > N[b], Return[Message[ dydxplot::wrongOrder1]]]; \[IndentingNewLine]testvalues = Table[N[expr2 - expr1], {x, a, b, \((b - a)\)/20}]; \[IndentingNewLine]If[ Apply[Or, Map[Negative, Chop[testvalues, 0.000001]]], Return[Message[ dydxplot::wrongOrder2]]]; \[IndentingNewLine]disoption = \ \(DisplayFunction /. List[opts]\) /. Options[dydxplot]; \[IndentingNewLine]aroption = \(AspectRatio /. List[opts]\) /. Options[dydxplot]; \[IndentingNewLine]g1 = Plot[expr1, {x, a, b}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = Plot[expr2, {x, a, b}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g3 = Table[Line[{{x, expr1}, {x, expr2}}], {x, a, b, \((b - a)\)/20}]; \[IndentingNewLine]Show[g1, g2, Graphics[g3], DisplayFunction \[Rule] disoption, AspectRatio \[Rule] aroption]]\)\(\[IndentingNewLine]\) \)\), "\n", \(dydxplot::wrongOrder3 := "\"\), "\n", \(\(\(dydxplot[{x, expr1_, expr2_}, {y, a_, b_}, opts___] := Message[dydxplot::wrongOrder3]\)\(\n\)\(\[IndentingNewLine]\)\( \ (*\(--\(--\(--\(--\(--\(--\(--\(-a\)\)\)\)\)\)\)\)\ generic\ 3\ variable\ \ plotting\ \(\(\(\(\(\(\(\(\(\(\(routine--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[generic3variableplot]\), "\n", \(\(Options[generic3variableplot] = {PlotPoints \[Rule] {8, 8, 8}, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] Automatic};\)\), "\n", \(\(\(generic3variableplot[{z_Symbol, z1_, z2_}, {y_Symbol, y1_, y2_}, {x_Symbol, x1_, x2_}, xyzpoint_, opts___] := Module[{vec1, vec2, ptsoption, disoption, boxoption, g1, g2, g3}, disoption = \(DisplayFunction /. List[opts]\) /. Options[generic3variableplot]; \[IndentingNewLine]ptsoption = \ \(PlotPoints /. List[opts]\) /. Options[generic3variableplot]; \[IndentingNewLine]If[ Head[ptsoption] \[NotEqual] List, ptsoption = {ptsoption, ptsoption, ptsoption}]; \[IndentingNewLine]boxoption = \(BoxRatios /. List[opts]\) /. Options[generic3variableplot]; \[IndentingNewLine]Off[ ParametricPlot3D::pplr]; \[IndentingNewLine]vec1 = \(xyzpoint /. z \[Rule] z2\) /. y \[Rule] s*y2 + \((1 - s)\)*y1; \[IndentingNewLine]vec2 = \(xyzpoint /. z \[Rule] z1\) /. y \[Rule] s*y2 + \((1 - s)\)*y1; \[IndentingNewLine]g1 = ParametricPlot3D[Evaluate[{vec1, vec2}], {s, 0, 1}, {x, x1, x2}, PlotPoints \[Rule] {ptsoption[\([2]\)], ptsoption[\([3]\)]}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]vec1 = \(xyzpoint /. z \[Rule] s*z2 + \((1 - s)\)*z1\) /. y \[Rule] y2; \[IndentingNewLine]vec2 = \(xyzpoint /. z \[Rule] s*z2 + \((1 - s)\)*z1\) /. y \[Rule] y1; \[IndentingNewLine]g2 = ParametricPlot3D[Evaluate[{vec1, vec2}], {s, 0, 1}, {x, x1, x2}, PlotPoints \[Rule] {ptsoption[\([1]\)], ptsoption[\([3]\)]}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]vec1 = \(\(xyzpoint /. z \[Rule] s*z2 + \((1 - s)\)*z1\) /. y \[Rule] w*y2 + \((1 - w)\)*y1\) /. x \[Rule] x2; \[IndentingNewLine]vec2 = \(\(xyzpoint /. z \[Rule] s*z2 + \((1 - s)\)*z1\) /. y \[Rule] w*y2 + \((1 - w)\)*y1\) /. x \[Rule] x1; \[IndentingNewLine]g3 = ParametricPlot3D[Evaluate[{vec1, vec2}], {s, 0, 1}, {w, 0, 1}, PlotPoints \[Rule] {ptsoption[\([1]\)], ptsoption[\([2]\)]}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]On[ ParametricPlot3D::pplr]; \[IndentingNewLine]Show[g1, g2, g3, PlotRange \[Rule] All, BoxRatios \[Rule] boxoption, DisplayFunction \[Rule] disoption]]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ \ 15\ \(\(\(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[dzdydxplot]\), "\n", \(\(Options[dzdydxplot] = {PlotPoints \[Rule] {8, 8, 8}, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] Automatic};\)\), "\n", \(\(\(dzdydxplot[{z_Symbol, z1_, z2_}, {y_Symbol, y1_, y2_}, {x_Symbol, x1_, x2_}, opts___] := generic3variableplot[{z, z1, z2}, {y, y1, y2}, {x, x1, x2}, {x, y, z}, DisplayFunction \[Rule] \((\(DisplayFunction /. List[opts]\) /. Options[dzdydxplot])\), PlotPoints \[Rule] \((\(PlotPoints /. List[opts]\) /. Options[dzdydxplot])\), BoxRatios \[Rule] \((\(BoxRatios /. List[opts]\) /. Options[dzdydxplot])\)]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[dzdxdyplot]\), "\n", \(\(Options[dzdxdyplot] = {PlotPoints \[Rule] {8, 8, 8}, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] Automatic};\)\), "\n", \(\(\(dzdxdyplot[{z_Symbol, z1_, z2_}, {x_Symbol, x1_, x2_}, {y_Symbol, y1_, y2_}, opts___] := generic3variableplot[{z, z1, z2}, {x, x1, x2}, {y, y1, y2}, {x, y, z}, DisplayFunction \[Rule] \((\(DisplayFunction /. List[opts]\) /. Options[dzdxdyplot])\), PlotPoints \[Rule] \((\(PlotPoints /. List[opts]\) /. Options[dzdxdyplot])\), BoxRatios \[Rule] \((\(BoxRatios /. List[opts]\) /. Options[dzdxdyplot])\)]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(\ --\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\ \)\)\)\)\)\ 15\ \(\(\(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[15, 1] := dzdydxplot[{z, 0, x^2 + y^2 + 2}, {y, 0, \((6 - 3 x)\)/2}, {x, 0, 2}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[15, 2] := dzdydxplot[{z, 0, \((1 - 2 x - 3 y)\)/4}, {y, 0, \((1 - 2 x)\)/3}, {x, 0, 1/2}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[15, 3.1] := dzdydxplot[{z, 0, \((1 - x - 2 y)\)/3}, {y, 0, \((1 - x)\)/2}, {x, 0, 1}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[15, 3.2] := dzdydxplot[{z, 0, \((2 - x)\)/2}, {y, 0, 2}, {x, 0, 2}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[15, 3.3] := dzdydxplot[{z, 0, 4 - x^2 - y^2}, {y, 0, Sqrt[4 - x^2]}, {x, 0, 2}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[15, 3.4] := dzdydxplot[{z, 4 - x^2 - y^2, \(-Sqrt[\((2)\)^2 - x^2 - \((y - 1)\)^2]\) + 6}, {y, 1, 2}, {x, \(-1\), 1}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 16\ \(\(\(\(\ \(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[monte1]\), "\n", \(\(\(monte1[expr_, {x, a_, b_}, {y, c_, d_}, n_] := Module[{t}, t = Table[\((expr /. {x \[Rule] Random[Real, {a, b}]})\) \[GreaterEqual] Random[Real, {c, d}], {n}]; \[IndentingNewLine]N[ Count[t, True]/n*\((b - a)\)*\((d - c)\)]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[monte2]\), "\n", \(\(\(monte2[expr_, {x, a_, b_}, {y, c_, d_}, {z, e_, f_}, n_] := Module[{t}, t = Table[\((expr /. {x \[Rule] Random[Real, {a, b}], y \[Rule] Random[Real, {c, d}]})\) \[GreaterEqual] Random[Real, {e, f}], {n}]; \[IndentingNewLine]N[ Count[t, True]/ n*\((b - a)\)*\((d - c)\)*\((f - e)\)]]\)\(\n\)\(\[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 17\ \(\(\(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[drdtplot]\), "\n", \(\(\(drdtplot[{r, expr1_, expr2_}, {t, t1_, t2_}] := Module[{g1, g2, g3, g4, g5, testvalues}, If[\(! NumberQ[N[t1]]\) || \(! NumberQ[N[t2]]\), Return["\"]]; \ \[IndentingNewLine]If[N[t1] > N[t2], Return["\"]]; \ \[IndentingNewLine]testvalues = Chop[Table[N[expr2 - expr1], {t, t1, t2, \((t2 - t1)\)/10}], 0.000001]; \[IndentingNewLine]If[\(! Apply[And, Map[NumberQ, N[testvalues]]]\), Return["\"]]; \[IndentingNewLine]If[Apply[Or, Map[Negative, testvalues]], Return["\"]]; \[IndentingNewLine]g1 = ParametricPlot[N[{expr1*Cos[t], expr1*Sin[t]}], {t, N[t1], N[t2]}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ParametricPlot[N[{expr2*Cos[t], expr2*Sin[t]}], {t, N[t1], N[t2]}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g3 = Graphics[ Table[Line[{N[{expr1*Cos[t], expr1*Sin[t]}], N[{expr2*Cos[t], expr2*Sin[t]}]}], {t, N[t1], N[t2], Min[N[\((t2 - t1)\)/10], N[Pi/10]]}]]; \[IndentingNewLine]g4 = Graphics[{Point[{0, 0}], Line[{N[{expr1*Cos[t], expr1*Sin[t]} /. t \[Rule] t2], N[{expr2*Cos[t], expr2*Sin[t]} /. t \[Rule] t2]}]}]; \[IndentingNewLine]g5 = Show[g4, g1, g2, g3, DisplayFunction \[Rule] $DisplayFunction, AspectRatio \[Rule] Automatic, PlotRange \[Rule] All, Axes \[Rule] True]; \[IndentingNewLine]Return[ g5]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(drdtplot[{r, expr1_, expr2_}, {theta, t1_, t2_}] := drdtplot[{r, expr1 /. {theta \[Rule] t}, expr2 /. {theta \[Rule] t}}, {t, t1, t2}]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[dtdrplot]\), "\n", \(\(\(dtdrplot[{t, expr1_, expr2_}, {r, r1_, r2_}] := Module[{g1, g2, g3, testvalues}, If[\(! NumberQ[N[r1]]\) || \(! NumberQ[N[r2]]\), Return["\"]]; \ \[IndentingNewLine]If[N[r1] > N[r2], Return["\"]]; \ \[IndentingNewLine]testvalues = Chop[Table[N[expr2 - expr1], {r, r1, r2, \((r2 - r1)\)/10}], 0.000001]; \[IndentingNewLine]If[\(! Apply[And, Map[NumberQ, N[testvalues]]]\), Return["\"]]; \[IndentingNewLine]If[Apply[Or, Map[Negative, testvalues]], Return["\"]]; \[IndentingNewLine]g1 = ParametricPlot[{r*Cos[expr1], r*Sin[expr1]}, {r, r1, r2}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ParametricPlot[{r*Cos[expr2], r*Sin[expr2]}, {r, r1, r2}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g3 = Graphics[ Table[Circle[{0, 0}, r, {expr1, expr2}], {r, r1, r2, \((r2 - r1)\)/10}]]; \[IndentingNewLine]g4 = Graphics[{GrayLevel[1], Point[{0, 0}]}]; \[IndentingNewLine]Show[ g4, g1, g2, g3, DisplayFunction \[Rule] $DisplayFunction, AspectRatio \[Rule] Automatic, PlotRange \[Rule] All, Axes \[Rule] True]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(dtdrplot[{theta, expr1_, expr2_}, {r, r1_, r2_}] := dtdrplot[{t, expr1, expr2}, {r, r1, r2}]\)\(\n\)\(\[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 17\ \(\(\(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[17, 2.1] := drdtplot[{r, 1, 2}, {theta, Pi/4, 7 Pi/4}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[17, 2.2] := drdtplot[{r, 0, 2}, {theta, Pi/4, 3 Pi/4}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[17, 2.3] := drdtplot[{r, 0, \(-1\)/Cos[theta]}, {theta, 3 Pi/4, 5 Pi/4}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 18\ \ \(\(\(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[dzdrdtplot]\), "\n", \(\(Options[dzdrdtplot] = {PlotPoints \[Rule] {10, 6, 12}, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] Automatic};\)\), "\n", \(\(\(dzdrdtplot[{z_Symbol, y1_, y2_}, {r_Symbol, z1_, z2_}, {t_Symbol, x1_, x2_}, opts___] := generic3variableplot[{z, y1, y2}, {r, z1, z2}, {t, x1, x2}, {r*Cos[t], r*Sin[t], z}, DisplayFunction \[Rule] \((\(DisplayFunction /. List[opts]\) /. Options[dzdrdtplot])\), PlotPoints \[Rule] \((\(PlotPoints /. List[opts]\) /. Options[dzdrdtplot])\), BoxRatios \[Rule] \((\(BoxRatios /. List[opts]\) /. Options[dzdrdtplot])\)]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[drdzdtplot]\), "\n", \(\(Options[drdzdtplot] = {PlotPoints \[Rule] {6, 10, 12}, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] Automatic};\)\), "\n", \(\(\(drdzdtplot[{r_Symbol, z1_, z2_}, {z_Symbol, y1_, y2_}, {t_Symbol, x1_, x2_}, opts___] := generic3variableplot[{r, z1, z2}, {z, y1, y2}, {t, x1, x2}, {r*Cos[t], r*Sin[t], z}, DisplayFunction \[Rule] \((\(DisplayFunction /. List[opts]\) /. Options[drdzdtplot])\), PlotPoints \[Rule] \((\(PlotPoints /. List[opts]\) /. Options[drdzdtplot])\), BoxRatios \[Rule] \((\(BoxRatios /. List[opts]\) /. Options[drdzdtplot])\)]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[drhodphidtplot]\), "\n", \(\(Options[drhodphidtplot] = {PlotPoints \[Rule] {6, 14, 12}, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] Automatic};\)\), "\n", \(\(\(drhodphidtplot[{r_Symbol, z1_, z2_}, {p_Symbol, y1_, y2_}, {t_Symbol, x1_, x2_}, opts___] := generic3variableplot[{r, z1, z2}, {p, y1, y2}, {t, x1, x2}, {r*Cos[t]*Sin[p], r*Sin[t]*Sin[p], r*Cos[p]}, DisplayFunction \[Rule] \((\(DisplayFunction /. List[opts]\) /. Options[drhodphidtplot])\), PlotPoints \[Rule] \((\(PlotPoints /. List[opts]\) /. Options[drhodphidtplot])\), BoxRatios \[Rule] \((\(BoxRatios /. List[opts]\) /. Options[drhodphidtplot])\)]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[dzdtdrplot]\), "\n", \(\(Options[dzdtdrplot] = {PlotPoints \[Rule] {10, 14, 7}, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] Automatic};\)\), "\n", \(\(\(dzdtdrplot[{z_Symbol, z1_, z2_}, {t_Symbol, y1_, y2_}, {r_Symbol, x1_, x2_}, opts___] := generic3variableplot[{z, z1, z2}, {t, y1, y2}, {r, x1, x2}, {r*Cos[t], r*Sin[t], z}, DisplayFunction \[Rule] \((\(DisplayFunction /. List[opts]\) /. Options[dzdtdrplot])\), PlotPoints \[Rule] \((\(PlotPoints /. List[opts]\) /. Options[dzdtdrplot])\), BoxRatios \[Rule] \((\(BoxRatios /. List[opts]\) /. Options[dzdtdrplot])\)]\)\(\n\)\(\[IndentingNewLine]\)\( \ (*DEMOS\ for\ Module\ 18*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(demo[18, 1] := Module[{g1, g2}, g1 = ParametricPlot3D[ Evaluate[{2*Cos[t], 2*Sin[t], z}], {t, 0, 2 Pi}, {z, \(-2\), 2}, PlotPoints \[Rule] 15, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], 2}], {t, 0, 2 Pi}, {r, 0, 2}, PlotPoints \[Rule] {15, 6}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, g2, DisplayFunction \[Rule] $DisplayFunction, ViewPoint \[Rule] {3, 1, 1}, PlotRange \[Rule] {Automatic, Automatic, {\(-2\), 2.05}}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 2] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], z}], {t, 0, 2 Pi}, {z, \(-2\), 2}, ViewPoint \[Rule] {3, 1, 1}, PlotPoints \[Rule] {15, 3}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2}}], {r, 0.1, 2}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 3] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], z}], {r, 0, 2}, {z, \(-2\), 2}, ViewPoint \[Rule] {3, 1, 1}, PlotPoints \[Rule] {3, 3}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2}}], {t, 0, 2 Pi}, Frames \[Rule] 12, Closed \[Rule] True]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 4] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], z}], {r, 0, 2}, {t, 0, 2 Pi}, ViewPoint \[Rule] {3, 1, 1}, PlotPoints \[Rule] {3, 15}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2.02}}], {z, \(-2\), 2}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 5] := Module[{g1, g2, g3}, g1 = ParametricPlot3D[ Evaluate[{2*Cos[t], 2*Sin[t], z}], {t, 0, 2 Pi}, {z, \(-2\), 2}, PlotPoints \[Rule] 15, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ParametricPlot3D[ Evaluate[{1*Cos[t], 1*Sin[t], z}], {t, 0, 2 Pi}, {z, \(-2\), 2}, PlotPoints \[Rule] 15, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g3 = ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], 2}], {t, 0, 2 Pi}, {r, 1, 2}, PlotPoints \[Rule] {15, 6}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, g2, g3, DisplayFunction \[Rule] $DisplayFunction, ViewPoint \[Rule] {3, 1, 1}, PlotRange \[Rule] {Automatic, Automatic, {\(-2\), 2.05}}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 6] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], z}], {t, 0, 2 Pi}, {z, \(-2\), 2}, ViewPoint \[Rule] {3, 1, 1}, PlotPoints \[Rule] {15, 3}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2}}], {r, 1, 2}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 7] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], z}], {r, 1, 2}, {z, \(-2\), 2}, ViewPoint \[Rule] {3, 1, 1}, PlotPoints \[Rule] {3, 3}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2}}], {t, 0, 2 Pi}, Frames \[Rule] 12, Closed \[Rule] True]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 8] := Module[{g1, g2, g3, g4}, g1 = ParametricPlot3D[ Evaluate[{2*Cos[t], 2*Sin[t], z}], {t, Pi/4, Pi}, {z, \(-2\), 2}, PlotPoints \[Rule] 15, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ParametricPlot3D[ Evaluate[{1*Cos[t], 1*Sin[t], z}], {t, Pi/4, Pi}, {z, \(-2\), 2}, PlotPoints \[Rule] 15, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g3 = ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], 2}], {t, Pi/4, Pi}, {r, 0, 2}, PlotPoints \[Rule] {15, 6}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g4 = ParametricPlot3D[ Evaluate[{r*Cos[Pi/4], r*Sin[Pi/4], z}], {z, \(-2\), 2}, {r, 0, 2}, PlotPoints \[Rule] {15, 6}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, g2, g3, g4, DisplayFunction \[Rule] $DisplayFunction, ViewPoint \[Rule] {3, 1, 1}, PlotRange \[Rule] {Automatic, {\(-2\), 2}, {\(-2\), 2.05}}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 9] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], z}], {t, Pi/4, Pi}, {z, \(-2\), 2}, PlotPoints \[Rule] {15, 3}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2}}], {r, 0, 2}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 10] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], z}], {r, 0, 2}, {z, \(-2\), 2}, ViewPoint \[Rule] {3, 1, 1}, PlotPoints \[Rule] {3, 3}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2}}], {t, Pi/4, Pi}, Frames \[Rule] 12, Closed \[Rule] True]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 11] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t], r*Sin[t], z}], {r, 0, 2}, {t, Pi/4, Pi}, PlotPoints \[Rule] {3, 15}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2.02}}], {z, \(-2\), 2}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 12] := drhodphidtplot[{r, 1, 2}, {p, 0, Pi}, {t, 0, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 13] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t]*Sin[p], r*Sin[t]*Sin[p], r*Cos[p]}], {p, 0, Pi}, {t, 0, 2 Pi}, PlotPoints \[Rule] {12, 12}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2.02}}], {r, 1, 2}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 14] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t]*Sin[p], r*Sin[t]*Sin[p], r*Cos[p]}], {r, 1, 2}, {t, 0, 2 Pi}, PlotPoints \[Rule] {5, 12}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2.02}}], {p, 0.2, Pi - 0.2}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 15] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t]*Sin[p], r*Sin[t]*Sin[p], r*Cos[p]}], {r, 1, 2}, {p, 0, Pi}, PlotPoints \[Rule] {5, 12}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2.02}}], {t, 0, 2 Pi}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 16] := drhodphidtplot[{r, 0, 2}, {p, 0, Pi/4}, {t, 0, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 17] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t]*Sin[p], r*Sin[t]*Sin[p], r*Cos[p]}], {r, 0, 2}, {t, 0, 2 Pi}, PlotPoints \[Rule] {5, 12}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {0, 2}}], {p, 0.1, Pi/4}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 18] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t]*Sin[p], r*Sin[t]*Sin[p], r*Cos[p]}], {r, 0, 2}, {p, 0, Pi/4}, PlotPoints \[Rule] {5, 6}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {0, 2}}], {t, 0, 2 Pi}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 19] := drhodphidtplot[{r, 0, 2}, {p, Pi/3, 2 Pi/3}, {t, Pi/2, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 20] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t]*Sin[p], r*Sin[t]*Sin[p], r*Cos[p]}], {t, Pi/2, 2 Pi}, {p, Pi/3, 2 Pi/3}, PlotPoints \[Rule] {12, 6}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2}}], {r, 0.2, 2}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 21] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t]*Sin[p], r*Sin[t]*Sin[p], r*Cos[p]}], {t, Pi/2, 2 Pi}, {r, 0, 2}, PlotPoints \[Rule] {12, 6}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2}}], {p, Pi/3, 2 Pi/3}, Frames \[Rule] 12]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[18, 22] := Animate[ParametricPlot3D[ Evaluate[{r*Cos[t]*Sin[p], r*Sin[t]*Sin[p], r*Cos[p]}], {p, Pi/3, 2 Pi/3}, {r, 0, 2}, PlotPoints \[Rule] {6, 6}, PlotRange \[Rule] {{\(-2\), 2}, {\(-2\), 2}, {\(-2\), 2}}], {t, Pi/2, 2 Pi}, Frames \[Rule] 12]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 18\ \(\(\(\(\ \(\(\(\(\(\(\(\(\(\(EXAMPLES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(example[18, 4.1] := Module[{g1, g2}, g1 = Plot3D[2, {x, \(-2.5\), 2.5}, {y, \(-2.5\), 2.5}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ParametricPlot3D[{rho*Sin[Pi/4]*Cos[t], rho*Sin[Pi/4]*Sin[t], rho*Cos[Pi/4]}, {rho, 0, 4}, {t, 0, 2 Pi}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, g2, BoxRatios \[Rule] {1, 1, 1}, DisplayFunction \[Rule] $DisplayFunction]]\)\(\n\)\(\ \[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 18\ \(\(\(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[18, 1] := dzdrdtplot[{z, r^2, Sqrt[5]*r}, {r, 0, Sqrt[5]}, {theta, 0, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[18, 2.1] := dzdrdtplot[{z, 0, 5}, {r, 0, Sqrt[3]}, {theta, 0, Pi/2}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[18, 2.2] := drhodphidtplot[{rho, 1, 2}, {phi, 0, Pi}, {theta, Pi/2, 3 Pi/2}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[18, 2.3] := drhodphidtplot[{rho, 0, 4}, {phi, 0, Pi}, {theta, Pi/4, Pi/3}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[18, 2.4] := drdzdtplot[{r, 0, Sqrt[9 - z^2]}, {z, 1/2, 3/2}, {theta, 0, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[18, 2.5] := drhodphidtplot[{rho, 3/\((2 Cos[phi])\), 3}, {phi, 0, Pi/3}, {theta, 0, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[18, 2.6] := drhodphidtplot[{rho, 0, Sqrt[8]}, {phi, 0, Pi/4}, {theta, 0, 2 Pi}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 19\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[regionplot]\), "\n", \(\(\(regionplot[{var1_Symbol, expr1_, expr2_}, {var2_Symbol, const1_, const2_}, subrules_List] := Module[{t1, g1, g2, g3}, t1 = Table[\({x, y} /. subrules\) /. var1 \[Rule] t*expr1 + \((1 - t)\)*expr2, {t, 0, 1, .1}]; \[IndentingNewLine]g1 = ParametricPlot[Evaluate[t1], {var2, const1, const2}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = If[N[expr1 \[NotEqual] expr2 /. var2 \[Rule] const1], ParametricPlot[ Evaluate[\({x, y} /. subrules\) /. var2 \[Rule] const1], {var1, expr1 /. var2 \[Rule] const1, expr2 /. var2 \[Rule] const1}, DisplayFunction \[Rule] Identity], Graphics[{}]]; \[IndentingNewLine]g3 = If[N[expr1 \[NotEqual] expr2 /. var2 \[Rule] const2], ParametricPlot[ Evaluate[\({x, y} /. subrules\) /. var2 \[Rule] const2], {var1, expr1 /. var2 \[Rule] const2, expr2 /. var2 \[Rule] const2}, DisplayFunction \[Rule] Identity], Graphics[{}]]; \[IndentingNewLine]Show[g1, g2, g3, AspectRatio \[Rule] Automatic, DisplayFunction \[Rule] $DisplayFunction, PlotRange \[Rule] All, AxesLabel \[Rule] {"\", "\"}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(regionplot[{var1_Symbol, expr11_, expr12_}, {var2_Symbol, expr21_, expr22_}, {var3_Symbol, const1_, const2_}, subrules_List] := Module[{vec, g1, g2, g3, g4, g5, g6, t}, vec = \(\({x, y, z} /. subrules\) /. var1 \[Rule] expr11\) /. var2 \[Rule] s*expr21 + \((1 - s)\)*expr22; \[IndentingNewLine]g1 = ParametricPlot3D[Evaluate[vec], {s, 0, 1}, {var3, const1, const2}, DisplayFunction \[Rule] Identity, PlotPoints \[Rule] 10]; \[IndentingNewLine]vec = \(\({x, y, z} /. subrules\) /. var1 \[Rule] expr12\) /. var2 \[Rule] s*expr21 + \((1 - s)\)*expr22; \[IndentingNewLine]g2 = ParametricPlot3D[Evaluate[vec], {s, 0, 1}, {var3, const1, const2}, DisplayFunction \[Rule] Identity, PlotPoints \[Rule] 10]; \[IndentingNewLine]vec = \(\(\({x, y, z} /. subrules\) /. var1 \[Rule] t*expr11 + \((1 - t)\)*expr12\) /. var2 \[Rule] s*expr21 + \((1 - s)\)*expr22\) /. var3 \[Rule] const1; \[IndentingNewLine]g3 = ParametricPlot3D[Evaluate[vec], {s, 0, 1}, {t, 0, 1}, DisplayFunction \[Rule] Identity, PlotPoints \[Rule] 10]; \[IndentingNewLine]vec = \(\(\({x, y, z} /. subrules\) /. var1 \[Rule] t*expr11 + \((1 - t)\)*expr12\) /. var2 \[Rule] s*expr21 + \((1 - s)\)*expr22\) /. var3 \[Rule] const2; \[IndentingNewLine]g4 = ParametricPlot3D[Evaluate[vec], {s, 0, 1}, {t, 0, 1}, DisplayFunction \[Rule] Identity, PlotPoints \[Rule] 10]; \[IndentingNewLine]vec = \(\({x, y, z} /. subrules\) /. var1 \[Rule] t*expr11 + \((1 - t)\)*expr12\) /. var2 \[Rule] expr21; \[IndentingNewLine]g5 = ParametricPlot3D[Evaluate[vec], {var3, const1, const2}, {t, 0, 1}, DisplayFunction \[Rule] Identity, PlotPoints \[Rule] 10]; \[IndentingNewLine]vec = \(\({x, y, z} /. subrules\) /. var1 \[Rule] t*expr11 + \((1 - t)\)*expr12\) /. var2 \[Rule] expr22; \[IndentingNewLine]g6 = ParametricPlot3D[Evaluate[vec], {var3, const1, const2}, {t, 0, 1}, DisplayFunction \[Rule] Identity, PlotPoints \[Rule] 10]; \[IndentingNewLine]Show[g1, g2, g3, g4, g5, g6, DisplayFunction \[Rule] $DisplayFunction, AxesLabel \[Rule] {"\", "\", "\"}]]\)\(\n\)\(\ \[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 19\ \(\(\(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[19, 3] := regionplot[{z, 0, 2*r*Cos[theta] - r*Sin[theta] + 5}, {r, 0, 1/2}, {theta, 0, 2 Pi}, {x \[Rule] 2*r*Cos[theta], y \[Rule] r*Sin[theta], z \[Rule] z}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 20\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[tracecurve]\), "\n", \(SetAttributes[tracecurve, {HoldAll}]\), "\n", \(\(Options[tracecurve] = {DisplayFunction \[Rule] $DisplayFunction, AspectRatio \[Rule] 1/GoldenRatio, PlotPoints \[Rule] 50};\)\), "\n", \(\(\(tracecurve[paramPoint_List, {var_Symbol, const1_, const2_}, opts___] := Module[{g1, t1, disoption, aroption, ppoption}, disoption = \(DisplayFunction /. Cases[List[opts], _Rule]\) /. Options[tracecurve]; \[IndentingNewLine]aroption = \(AspectRatio /. Cases[List[opts], _Rule]\) /. Options[tracecurve]; \[IndentingNewLine]ppoption = \(PlotPoints /. Cases[List[opts], _Rule]\) /. Options[tracecurve]; \[IndentingNewLine]g1 = ParametricPlot[paramPoint, {var, const1, const2}, DisplayFunction \[Rule] Identity, PlotPoints \[Rule] ppoption]; \[IndentingNewLine]t1 = Table[{PointSize[0.015 + s*0.025], Point[paramPoint /. {var \[Rule] \((1 - s)\)*const1 + s*const2}]}, {s, 0, 1, 0.1}]; \[IndentingNewLine]Show[ g1, Graphics[Flatten[t1]], DisplayFunction \[Rule] disoption, AspectRatio \[Rule] aroption, PlotRange \[Rule] All]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[tracecurve3d]\), "\n", \(SetAttributes[tracecurve3d, {HoldAll}]\), "\n", \(\(Options[tracecurve3d] = {DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] Automatic, PlotPoints \[Rule] 100};\)\), "\n", \(\(\(tracecurve3d[paramPoint_List, {var_Symbol, const1_, const2_}, opts___] := Module[{g1, t1, disoption, boxoption, ppoption}, disoption = \(DisplayFunction /. Cases[List[opts], _Rule]\) /. Options[tracecurve3d]; \[IndentingNewLine]boxoption = \(BoxRatios \ /. Cases[List[opts], _Rule]\) /. Options[tracecurve3d]; \[IndentingNewLine]ppoption = \(PlotPoints \ /. Cases[List[opts], _Rule]\) /. Options[tracecurve3d]; \[IndentingNewLine]g1 = ParametricPlot3D[paramPoint, {var, const1, const2}, DisplayFunction \[Rule] Identity, PlotPoints \[Rule] ppoption]; \[IndentingNewLine]t1 = Table[{PointSize[0.015 + s*0.025], Point[Evaluate[ paramPoint /. {var \[Rule] \((1 - s)\)*const1 + s*const2}]]}, {s, 0, 1, 0.1}]; \[IndentingNewLine]Show[g1, Graphics3D[Flatten[t1]], DisplayFunction \[Rule] disoption, BoxRatios \[Rule] boxoption, PlotRange \[Rule] All]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[velocitydemo]\), "\n", \(\(\(velocitydemo[expr_List, {var_Symbol, const1_, const2_}] := Module[{g1, g2, t, curve, pt = Append[expr, {Thickness[0.007], GrayLevel[0.5]}]}, curve[t_] := expr /. var \[Rule] t; \[IndentingNewLine]g1 = ParametricPlot3D[Evaluate[pt], {var, const1, const2}, PlotPoints \[Rule] 50, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = Table[showvectors[\(curve'\)[t], initialpoint \[Rule] curve[t], DisplayFunction \[Rule] Identity], {t, const1, const2, \((const2 - const1)\)/10}]; \[IndentingNewLine]Show[g1, g2, DisplayFunction \[Rule] $DisplayFunction, BoxRatios \[Rule] {1, 1, 1}]]\)\(\n\)\(\[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 20\ \(\(\(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[20, 2.1] := ParametricPlot3D[{3 Cos[t], 3 Sin[t], 0}, {t, 0, 2 Pi}, PlotPoints \[Rule] 20]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[20, 2.2] := ParametricPlot3D[{2, 2 Cos[t], 2 Sin[t]}, {t, 0, 2 Pi}, PlotPoints \[Rule] 20]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[20, 2.3] := ParametricPlot3D[{1 + 2*t, \(-t\), \(-1\) + t}, {t, 0, 1}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[20, 4] := tracecurve[{\((3 - t)\)/2, \((\((3 - t)\)/2)\)^3 - 2*\((\((3 - t)\)/2)\)^2 + \((3 - t)\)/2}, {t, 0, 3}]\)\(\n\)\(\[IndentingNewLine]\)\( (*NOTE : the\ text\ on\ page\ 175 - 176\ uses\ "\"\ instead\ of\ "\", so\ we' ll\ alias\ these\ typos\ \(\(here\)\(.\)\)*) \)\(\ \[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(example[20, 2.1] := exercise[20, 2.1]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(example[20, 2.2] := exercise[20, 2.2]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(example[20, 2.3] := exercise[20, 2.3]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(example[20, 4] := exercise[20, 4]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(--\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 21\ \(\(\(\(\(\(\ \(\(\(\(\(\(\(\(EXAMPLES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(example[21, 1.1] := Module[{pict1, pict2, pict3}, pict1 = ParametricPlot3D[{2 + 2*p + q, \(-1\) + 3*p - 4*q, 3 - p + 5*q}, {p, \(-5\), 5}, {q, \(-5\), 5}, PlotPoints \[Rule] 4, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]pict2 = showvectors[3*{2, 3, \(-1\)}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]pict3 = showvectors[5*{1, \(-4\), 5}, initialpoint \[Rule] {6, 9, \(-3\)}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[pict1, pict2, ViewPoint \[Rule] {2, 4, 1}, DisplayFunction \[Rule] $DisplayFunction]]\)\(\n\)\(\ \[IndentingNewLine]\)\( \ (*\(\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\ \)\)\)\)\)\)\)\)\ 21\ \(\(\(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)--\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[21, 1.1] := ParametricPlot3D[{p, q, p^3 + 2 q^2}, {p, \(-2\), 2}, {q, \(-2\), 2}, BoxRatios \[Rule] {1, 1, 1}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 1.2] := ParametricPlot3D[{p, q, 1 - 2 p + q}, {p, \(-2\), 2}, {q, \(-2\), 2}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 1.3] := ParametricPlot3D[{1 + Sin[p]*Cos[q], 2 + 2 Sin[p]*Sin[q], 1 + 2*Cos[p]}, {p, 0, Pi}, {q, 0, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 1.4] := ParametricPlot3D[{p*Cos[theta], p*Sin[theta], p}, {p, \(-2\), 2}, {theta, 0, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 1.5] := ParametricPlot3D[{Cos[y]*Cos[theta], y, Cos[y]*Sin[theta]}, {y, \(-Pi\)/4, Pi/4}, {theta, 0, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 2.2] := ParametricPlot3D[{x*Cos[theta], x*Sin[theta], \(-x\) + 2}, {x, 1, 3}, {theta, 0, 2 Pi}, PlotPoints \[Rule] {10, 20}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 4.1] := ParametricPlot3D[{{Sin[phi]*Cos[theta], Sin[phi]*Sin[theta], Cos[phi]}, {0, 0, 0}}, {phi, 0, Pi/2}, {theta, 0, 2 Pi}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 4.2] := ParametricPlot3D[{{Sin[phi]*Cos[theta], Sin[phi]*Sin[theta], Cos[phi]}, {0, 0, 0}}, {phi, 0, Pi/3}, {theta, 0, 2 Pi}, PlotRange \[Rule] All]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 4.3] := ParametricPlot3D[{{Sin[phi]*Cos[theta], Sin[phi]*Sin[theta], Cos[phi]}, {0, 0, 0}}, {phi, 2*Pi/3, Pi}, {theta, 0, 2 Pi}, PlotRange \[Rule] All]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 4.4] := ParametricPlot3D[{{Cos[phi], Sin[phi]*Sin[theta], Sin[phi]*Cos[theta]}, {0, 0, 0}}, {phi, 0, Pi/3}, {theta, 0, 2 Pi}, PlotRange \[Rule] All]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 5.2] := ParametricPlot3D[{u*Cos[v], u*Sin[v], 3 u*Cos[v] + u*Sin[v] + 2}, {u, 0, 1}, {v, 0, 2 Pi}, AspectRatio \[Rule] Automatic]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[21, 5.3] := ParametricPlot3D[{u*Cos[v], u*Sin[v], Sqrt[\((4 - \((u*Cos[v])\)^2 - \((u*Sin[v])\)^2)\)/2]}, {u, 0, 1}, {v, 0, 2 Pi}, AspectRatio \[Rule] Automatic, PlotPoints \[Rule] {5, 15}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 22\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[showvectorfield]\), "\n", \(\(Options[showvectorfield] = {plotpoints \[Rule] 6, AspectRatio \[Rule] Automatic, DisplayFunction \[Rule] $DisplayFunction};\)\), "\n", \(\(\(showvectorfield[{vx_, vy_}, {x, a_, b_}, {y, c_, d_}, v___] := Module[{vects, npoints, aratio, dispfunc, opts = Cases[{v}, _Rule]}, npoints = \(plotpoints /. opts\) /. Options[showvectorfield]; \[IndentingNewLine]aratio = \ \(AspectRatio /. opts\) /. Options[showvectorfield]; \[IndentingNewLine]dispfunc = \ \(DisplayFunction /. opts\) /. Options[showvectorfield]; \[IndentingNewLine]vects = Table[showvectors2d[{vx, vy}, initialpoint \[Rule] {x, y}, DisplayFunction \[Rule] Identity], {x, a, b, \((b - a)\)/\((npoints - 1)\)}, {y, c, d, \((d - c)\)/\((npoints - 1)\)}]; \[IndentingNewLine]Show[ Flatten[vects, 1], DisplayFunction \[Rule] dispfunc, AspectRatio \[Rule] aratio]]\)\(\[IndentingNewLine]\) \)\), "\n", \(Clear[euler]\), "\n", \(\(\(euler[{expr1_, expr2_}, {x0_, y0_}, deltat_, n_] := Module[{t}, t[{a_, b_}] := N[{a, b} + deltat*{expr1, expr2} /. {x \[Rule] a, y \[Rule] b}]; \[IndentingNewLine]NestList[t, {x0, y0}, n]]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 22\ \(\(\(\(\ \(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[22, 1.1] := showvectorfield[{x, 0}, {x, \(-2\), 2}, {y, \(-2\), 2}, plotpoints \[Rule] 8]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[22, 1.2] := showvectorfield[{x, y}, {x, \(-2\), 2}, {y, \(-2\), 2}, plotpoints \[Rule] 8]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[22, 1.3] := showvectorfield[{1, 1}, {x, \(-2\), 2}, {y, \(-2\), 2}, plotpoints \[Rule] 8]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[22, 2] := ContourPlot[ 3*x*y - 0.113*y^2 + 0.21*x - 3.12*x^2, {x, \(-2\), 2}, {y, \(-2\), 2}, Contours \[Rule] 15]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[22, 3.1] := Module[{g1, g2}, g1 = showvectorfield[{x, x + y}/5, {x, 1, 4.5}, {y, 0, 3}, plotpoints \[Rule] 8, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ParametricPlot[{Exp[t], t^2}, {t, 0, 1.5}, PlotPoints \[Rule] 25, PlotStyle \[Rule] {{GrayLevel[0.5], Thickness[0.01]}}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, g2, DisplayFunction \[Rule] $DisplayFunction, PlotRange \[Rule] {{0, 6}, {0, 5}}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[22, 3.2] := Module[{g1, g2}, g1 = showvectorfield[{x, x + y}/5, {x, 0, 3}, {y, 0, 3}, plotpoints \[Rule] 8, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = ParametricPlot[{Exp[t], t*Exp[t]}, {t, 0, 1}, PlotPoints \[Rule] 25, PlotStyle \[Rule] {{GrayLevel[0.5], Thickness[0.01]}}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, g2, DisplayFunction \[Rule] $DisplayFunction]]\)\(\ \[IndentingNewLine]\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ \ \(\(\(\(\(\(\(\(\(\(\(\(\(\(\(\(23--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)--\)--\)--\)\)\(-\)*) \)\(\n\)\(\[IndentingNewLine]\)\( (*demos\ for\ \ Module\ 23*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(demo[23, 1] := Module[{g1, g2}, g1 = showvectorfield[{\((y + x)\)^2/8, y^2/4}/3, {x, \(-1\), 2}, {y, \(-2\), 3}, plotpoints \[Rule] 12, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = Plot[Cos[Pi*x] + x, {x, \(-1\), 2}, PlotStyle \[Rule] {{Thickness[0.01]}}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g2, g1, Axes \[Rule] True, DisplayFunction \[Rule] $DisplayFunction, AspectRatio \[Rule] Automatic]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[23, 2] := Module[{g1, g2, field, curve}, field[{x_, y_}] := {\((y + x)\)^2/8, y^2/4}; \[IndentingNewLine]curve[ x_] := {x, Cos[Pi*x] + x}; \[IndentingNewLine]g1 = ParametricPlot[curve[x], {x, \(-1\), 2}, PlotStyle \[Rule] {{Thickness[0.01], GrayLevel[0.5]}}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2[t_] = showvectors[ field[curve[ t]], \((field[curve[t]] . \(curve'\)[t])\)/\((\(curve'\)[ t] . \(curve'\)[t])\)\ \(curve'\)[t], initialpoint \[Rule] curve[t], DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Animate[ Show[g1, g2[t], PlotRange \[Rule] {{\(-1\), 5}, {\(-2\), 6}}, AspectRatio \[Rule] Automatic], {t, \(-1\), 2}, Frames \[Rule] 16]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[23, 3] := Module[{g1, g2}, g1 = showvectorfield[{\(-x\)/4, \((y + 2 x)\)/4}, {x, 0, 2}, {y, 0, 2}, plotpoints \[Rule] 10, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = Plot[Cos[Pi*x/2] + 1, {x, 0, 2}, PlotStyle \[Rule] {{Thickness[0.012]}}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g2, g1, Axes \[Rule] True, DisplayFunction \[Rule] $DisplayFunction, AspectRatio \[Rule] Automatic]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[23, 4] := Module[{g1, g2, field, curve}, field[{x_, y_}] := {\(-x\)/4, \((y + 2 x)\)/ 4}; \[IndentingNewLine]curve[x_] := {x, Cos[Pi*x/2] + 1}; \[IndentingNewLine]g1 = ParametricPlot[curve[x], {x, 0, 2}, PlotStyle \[Rule] {{Thickness[0.012], GrayLevel[0.5]}}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2[t_] = showvectors[ field[curve[ t]], \((field[curve[t]] . \(curve'\)[t])\)/\((\(curve'\)[ t] . \(curve'\)[t])\)\ \(curve'\)[t], initialpoint \[Rule] curve[t], DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Animate[ Show[g1, g2[t], PlotRange \[Rule] {{0, 3}, {\(-1\), 2.5}}, AspectRatio \[Rule] Automatic, Ticks \[Rule] {{0, 1, 2, 3}, Automatic}], {t, 0, 2}, Frames \[Rule] 16]]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 24\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[24, 1.1] := showvectorfield[{0.3, 0}, {x, \(-2\), 2}, {y, \(-2\), 2}, plotpoints \[Rule] 8]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[24, 1.2] := showvectorfield[{0, \((x + y)\)/3}, {x, \(-2\), 2}, {y, \(-2\), 2}, plotpoints \[Rule] 8]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[24, 1.3] := showvectorfield[{\((1 - y^2)\)/3, \((x^2 - 1)\)/3}, {x, \(-1.5\), 1.5}, {y, \(-1.5\), 1.5}, plotpoints \[Rule] 10]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 25\ \(\(\(\(\ \(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(showsurfacefield[expr_, vf_, {var1_Symbol, a_, b_}, {var2_Symbol, c_, d_}] := Module[{n = 10, x1, y1, g1, g2}, g1 = Table[Line[{expr /. {var1 \[Rule] x1, var2 \[Rule] y1}, \((expr /. {var1 \[Rule] x1, var2 \[Rule] y1})\) + vf[expr /. {var1 \[Rule] x1, var2 \[Rule] y1}]}], {x1, a, b, \((b - a)\)/n}, {y1, c, d, \((d - c)\)/n}]; \[IndentingNewLine]g1 = Graphics3D[Flatten[g1, 1]]; \[IndentingNewLine]g2 = ParametricPlot3D[expr, {var1, a, b}, {var2, c, d}, PlotPoints \[Rule] 10, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]Show[g1, g2, BoxRatios \[Rule] {1, 1, 1}, Axes \[Rule] True]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(showgraphfield[z \[Equal] expr_, vf_, {x, a_, b_}, {y, c_, d_}] := showsurfacefield[{u, v, expr /. {x \[Rule] u, y \[Rule] v}}, vf, {u, a, b}, {v, c, d}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 25\ \(\(\(\(\ \(\(\(\(\(\(\(\(\(\(EXAMPLES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(example[25, 1.11] := Module[{g1, g2}, g1 = ParametricPlot3D[{s, 0, t}, {s, \(-2\), 2}, {t, \(-2\), 2}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = {showvectors[{1, \(-1\), 1}, initialpoint \[Rule] {1, 0, 1}, DisplayFunction \[Rule] Identity], showvectors[{1, \(-1\), 1}, initialpoint \[Rule] {1, 0, \(-1\)}, DisplayFunction \[Rule] Identity], showvectors[{1, \(-1\), 1}, initialpoint \[Rule] {1, 0, 0}, DisplayFunction \[Rule] Identity], showvectors[{1, \(-1\), 1}, initialpoint \[Rule] {0, 0, 1}, DisplayFunction \[Rule] Identity], showvectors[{1, \(-1\), 1}, initialpoint \[Rule] {0, 0, 0}, DisplayFunction \[Rule] Identity], showvectors[{1, \(-1\), 1}, initialpoint \[Rule] {0, 0, \(-1\)}, DisplayFunction \[Rule] Identity], showvectors[{1, \(-1\), 1}, initialpoint \[Rule] {\(-1\), 0, 1}, DisplayFunction \[Rule] Identity], showvectors[{1, \(-1\), 1}, initialpoint \[Rule] {\(-1\), 0, 0}, DisplayFunction \[Rule] Identity], showvectors[{1, \(-1\), 1}, initialpoint \[Rule] {\(-1\), 0, \(-1\)}, DisplayFunction \[Rule] Identity]}; \[IndentingNewLine]Show[g1, g2, Ticks \[Rule] {Automatic, {\(-1\), \(-0.5\), 0}, Automatic}, DisplayFunction \[Rule] $DisplayFunction]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(example[25, 1.12] := Module[{g1, g2}, g1 = ParametricPlot3D[{s, 0, t}, {s, \(-2\), 2}, {t, \(-2\), 2}, DisplayFunction \[Rule] Identity]; \[IndentingNewLine]g2 = {showvectors[{1, 1, 1}, initialpoint \[Rule] {1, 0, 1}, DisplayFunction \[Rule] Identity], showvectors[{1, 1, 1}, initialpoint \[Rule] {1, 0, \(-1\)}, DisplayFunction \[Rule] Identity], showvectors[{1, 1, 1}, initialpoint \[Rule] {1, 0, 0}, DisplayFunction \[Rule] Identity], showvectors[{1, 1, 1}, initialpoint \[Rule] {0, 0, 1}, DisplayFunction \[Rule] Identity], showvectors[{1, 1, 1}, initialpoint \[Rule] {0, 0, 0}, DisplayFunction \[Rule] Identity], showvectors[{1, 1, 1}, initialpoint \[Rule] {0, 0, \(-1\)}, DisplayFunction \[Rule] Identity], showvectors[{1, 1, 1}, initialpoint \[Rule] {\(-1\), 0, 1}, DisplayFunction \[Rule] Identity], showvectors[{1, 1, 1}, initialpoint \[Rule] {\(-1\), 0, 0}, DisplayFunction \[Rule] Identity], showvectors[{1, 1, 1}, initialpoint \[Rule] {\(-1\), 0, \(-1\)}, DisplayFunction \[Rule] Identity]}; \[IndentingNewLine]Show[g1, g2, Ticks \[Rule] {Automatic, {\(-1\), \(-0.5\), 0}, Automatic}, DisplayFunction \[Rule] $DisplayFunction]]\)\(\n\)\(\ \[IndentingNewLine]\)\( (*\(OOPS--\)\ fake\ \(exercises--\)\ there' s\ a\ typo\ on\ the\ first\ page\ of\ the\ text\ which\ asks\ for\ \ "\"\ and\ "\", but\ these\ should\ really\ have\ been\ EXAMPLEs . thus, we' ll\ alias\ what' s\ in\ the\ printed\ text\ to\ the\ proper\ example\ \(\(references\)\ \(.\)\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(exercise[25, 1.11] := example[25, 1.11]\), "\n", \(\(\(exercise[25, 1.12] := example[25, 1.12]\)\(\n\)\(\[IndentingNewLine]\)\( (*DEMOS\ for\ Module\ \ 25*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(demo[25, 1] := ParametricPlot3D[{{u, v, 4*v^2}, {u, v, 0}}, {u, 0, 2}, {v, \(-2\), 2}, BoxRatios \[Rule] {1, 1, 0.5}, ViewPoint \[Rule] {2, 1, 1}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[25, 2] := ParametricPlot3D[{{r*Cos[t], r*Sin[t], 4 - 2 r}, {r*Cos[t], r*Sin[t], 0}}, {r, 1, 1.5}, {t, 0, 2*Pi}, PlotPoints \[Rule] {10, 25}, ViewPoint \[Rule] {2, 1, 0.7}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(demo[25, 3] := ParametricPlot3D[{{t, s*\((3 - t)\) + \((1 - s)\)*\((2*t)\), 3*Cos[6*t]}, {t, s*\((3 - t)\) + \((1 - s)\)*\((2*t)\), 0}}, {s, 0, 1}, {t, 0, 1}, ViewPoint \[Rule] {2, \(-1\), 0.8}, BoxRatios \[Rule] {1, 1, 0.8}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 25\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[25, 1.1] := Module[{vf}, vf[{x_, y_, z_}] := {x, y, 1}; \[IndentingNewLine]showsurfacefield[{p*Cos[q], p*Sin[q], p}, vf, {p, 1, 2}, {q, Pi/2, Pi}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[25, 1.2] := Module[{vf}, vf[{x_, y_, z_}] := {x, y, 1}; \[IndentingNewLine]showsurfacefield[{p, q, p^2 + q^2}, vf, {p, 0, 2}, {q, 0, 2}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[25, 1.3] := Module[{vf}, vf[{x_, y_, z_}] := {x, y, z}; \[IndentingNewLine]showsurfacefield[{p^2 + q^2 + 2, p, q}, vf, {p, 0, 1}, {q, 0, 1}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[25, 1.4] := Module[{vf}, vf[{x_, y_, z_}] := {x*y/4, y, z}; \[IndentingNewLine]showsurfacefield[{p*Cos[q], 2, p*Sin[q]}, vf, {p, 0, 1}, {q, 0, 2 Pi}]]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(exercise[25, 1.5] := Module[{vf}, vf[{x_, y_, z_}] := {x, 2 y, 3 z}; \[IndentingNewLine]showsurfacefield[{Sin[p]*Cos[q], Sin[p]*Sin[q], Cos[p]}, vf, {p, 0, Pi}, {q, 0, 2 Pi}]]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 26\ \ \(\(\(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[fluxintegral]\), "\n", \(\(\(fluxintegral[vfield_, pqparam_List, {varp_Symbol, a_, b_}, {varq_Symbol, c_, d_}] := Module[{norm, vp, vq, integrand}, vp = D[pqparam, varp]; \[IndentingNewLine]vq = D[pqparam, varq]; \[IndentingNewLine]norm = crossproduct[vp, vq]; \[IndentingNewLine]integrand = \((vfield /. {x \[Rule] pqparam[\([1]\)], y \[Rule] pqparam[\([2]\)], z \[Rule] pqparam[\([3]\)]})\) . \((norm)\); \ \[IndentingNewLine]Integrate[ integrand, {varp, a, b}, {varq, c, d}]]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 27\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(OPERATORS--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(Clear[curl]\), "\n", \(\(\(curl[ expr_List] := {D[expr[\([3]\)], y] - D[expr[\([2]\)], z], \(-D[expr[\([3]\)], x]\) + D[expr[\([1]\)], z], D[expr[\([2]\)], x] - D[expr[\([1]\)], y]}\)\(\n\)\(\[IndentingNewLine]\)\( (*\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 27\ \(\(\(\(\ \(\(\(\(\(\(\(\(\(\(EXAMPLES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(example[27, 2.2] := ParametricPlot3D[{s*\((2 - Cos[4 t])\)*Cos[t], s*\((2 - Cos[4 t])\)*Sin[t], s^2}, {t, 0, 2 Pi}, {s, 0, 2}, BoxRatios \[Rule] {1, 1, 1}, PlotPoints \[Rule] {30, 10}]\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(example[27, 2.3] := tracecurve3d[{3, 5 Cos[t], \(-5\) Sin[t]}, {t, 0, 2 Pi}]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--\(-Module\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ 27\ \(\(\ \(\(\(\(\(\(\(\(\(\(\(EXERCISES--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)--\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(\(exercise[27, 1.1] := showvectorfield[{\((y^2/2 - 1/2)\), \((x^2/4 - 1)\)}, {x, \(-2.5\), 2.5}, {y, \(-1.5\), 1.5}, plotpoints \[Rule] 10]\)\(\n\)\(\[IndentingNewLine]\)\( (*\(\(--\(--\(--\(--\(--\(--\(\ --\(--\(--\(--\(--\(--\(--\(--Cleanup\)\)\)\)\)\)\)\)\)\)\)\)\)\)\ \(\(\(\(\(\ \(\(\(\(\(\(\(\(\(Sequence--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)--\)\ --\)\)\(-\)*) \)\(\[IndentingNewLine]\) \)\), "\[IndentingNewLine]", \(\(On[General::spell, General::spell1];\)\), "\n", \(\($Line = 0;\)\ \)}], "Input", CellOpen->False, InitializationCell->True], Cell[CellGroupData[{ Cell[TextData[StyleBox["Instructions!", FontColor->RGBColor[1, 0, 0]]], "Section"], Cell[TextData[{ "Work in ", StyleBox["groups of 2 or 3", FontWeight->"Bold"], " today, using this notebook to help you answer the questions on the \ accompanying Lab Handout and Lab Worksheet. If you have questions, flag me \ down. Your lab report will be due on ", StyleBox["Monday (10 November) and should include the Lab Worksheet and a \ summary of the lab.", FontWeight->"Bold"], "\n\n", StyleBox["What I'm looking for in the summary: I'm really looking for your \ experiences in the lab written from a journal sort of fashion. What worked \ as expected, what didn't, what are you found to be most surprising, was it \ worth your time or not. Reflect on what you have seen in each section. \n\n", FontWeight->"Bold"] }], "Subsubtitle"] }, Closed]], Cell[CellGroupData[{ Cell["Introduction", "Section"], Cell[TextData[{ "Today we'll focus on working with some very simple ", StyleBox["Mathematica", FontSlant->"Italic"], " commands that will help you visualize what we are doing with the double \ integrals in Chapter 16. We'll take a new approach: I'm using some modules \ (contained in the initialization cell at the top of this notebook) that were \ written by ", StyleBox["G. Keough", FontWeight->"Bold"], " of Boston College. The accompanying lab handout is from \"Exploring \ Multivariable Calculus with ", StyleBox["Mathematica,", FontSlant->"Italic"], "\" written by Cheung, Keough, and Murdoch.\nHope you like it!\n\t" }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["The Workspace", "Section"], Cell[TextData[{ "Just to get you started, here is the first function that you are supposed \ to define from the Module 14 Handout. ", StyleBox["When prompted, say \"yes\" to executing the initalization cells \ of the notebook!", FontWeight->"Bold"] }], "Text"], Cell[BoxData[{ \(f[x_, y_] := 3 x^2 + \((y - 2)\)^2 + 2\), "\[IndentingNewLine]", \(showsolid[f[x, y], {x, 0, 1}, {y, 0, 3}]\)}], "Input"], Cell["good job... now... you are on your own! Good Luck!", "Text"] }, Closed]] }, FrontEndVersion->"4.1 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 677}}, AutoGeneratedPackage->None, WindowToolbars->{"RulerBar", "EditBar"}, CellGrouping->Manual, WindowSize->{1016, 644}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, StyleDefinitions -> "DemoText.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[1705, 50, 69, 1, 70, "Title"], Cell[1777, 53, 206, 9, 41, "Subtitle"], Cell[1986, 64, 126729, 2392, 19, "Input", CellOpen->False, InitializationCell->True], Cell[CellGroupData[{ Cell[128740, 2460, 84, 1, 54, "Section"], Cell[128827, 2463, 774, 17, 184, "Subsubtitle"] }, Closed]], Cell[CellGroupData[{ Cell[129638, 2485, 31, 0, 34, "Section"], Cell[129672, 2487, 664, 15, 129, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[130373, 2507, 32, 0, 34, "Section"], Cell[130408, 2509, 269, 6, 48, "Text"], Cell[130680, 2517, 148, 2, 60, "Input"], Cell[130831, 2521, 67, 0, 29, "Text"] }, Closed]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)