(******************************************************************* This file was generated automatically by the Mathematica front end. It contains Initialization cells from a Notebook file, which typically will have the same name as this file except ending in ".nb" instead of ".m". This file is intended to be loaded into the Mathematica kernel using the package loading commands Get or Needs. Doing so is equivalent to using the Evaluate Initialization Cells menu command in the front end. DO NOT EDIT THIS FILE. This entire file is regenerated automatically each time the parent Notebook file is saved in the Mathematica front end. Any changes you make to this file will be overwritten. ***********************************************************************) $TextStyle={FontFamily\[Rule]"Courier New",FontSize\[Rule]11}; (*Some steps can be needed at various alternative input points; these definitions avoid having to enter them in all those points.*) GetIPick:=Module[{},{LegalIpick="false"; While[LegalIpick\[Equal]"false",{LegalIpick="true"; IPick=Input[ "Enter a 1 if you wish to select your own coefficients, 0 \ if you want Mathematica to select them."], If[IPick\[NotEqual]1&&IPick\[NotEqual]0, LegalIpick="false";]}]};]; (*This short module gives directions at the end of GetValueOfa[g_], which follows.*) DirectionsToPurple:=Module[{},OtherWords=Graphics[Text["If you are not satisfied, execute this cell again.\nIf you are satisfied, go to the bracket cell.", {-1,-.5}, {0,0}]]; Purple=Graphics[{RGBColor[1,0,1],Text["purple", {315,-2.2}, {0,0}]}]; Show[Purple,OtherWords, ImageSize->{500,25}, PlotRange->{{-100,100},{-3,2}}];]; (*This next one is longer. We use it to select 'a' and MaxDelta.*) GetValueOfa[g_]:= Module[{},{Finished=0; While[Finished==0, Print["We have g[x]="<>ToString[g[HoldForm[x]], StandardForm]<> ". We will consider the limit at x=a."<> If[Opt>1, "\nChoose 'a' so that there is a visible interval centered on \ x=a where g[x] is continuous \nand some g[x] values are more than 2 units \ away from g[a].(If no value of 'a' makes \nthis happen, enter ANY 'a', but \ then re-execute this cell for another g[x].)",""]]; Pause[3]; Legala="false"; While[Legala\[Equal]"false",Legala="true"; a=Input["We will evaluate the limit at x=a; type your choice of a \ (avoid decimals) and click on OK or hit Keypad Enter to continue."]; If[IntegerPart[a]\[NotEqual]a&&Denominator[a]\[Equal]1, Legala="false"]]; If[Opt\[Equal]3||Opt\[Equal]4, While[Denom[a]\[Equal]0, a=Input["Please try again;your previous choice of a="<> ToString[a,InputForm]<> " resulted in a vertical asymptote at x=a."];]]; Print["We will evaluate the limit at x=a=",a, ". You will later need the value of g[a] below."]; mapprox=(g[a+.001]-g[a-.001])/.002; aGridLine={a,{Thickness[.00250],Dashing[{.05,.05}]}}; TextAta=Graphics[ Text["x=a="<>ToString[a,StandardForm],Scaled[{.5,.1}]]]; LabelForPoint= Graphics[ Text["["<>ToString[a,StandardForm]<>","<> ToString[g[a],StandardForm]<>"]",{a,g[a]},{-1,0}]]; CircleAta=Graphics[Circle[{a,g[a]},Scaled[{.008,.006}]]]; MaxDeltaGuideLines={Graphics[{If[Opt>1,RGBColor[0,.5,1],RGBColor[1,1,1]], Dashing[{.01,.01}] , Line[{ {LeftEnd,g[a]-2},{RightEnd,g[a]-2}}], Line[ { {LeftEnd,g[a]+2},{RightEnd,g[a]+2}}]}]}; If[Opt\[Equal]1, Supplement={LabelForPoint}, Supplement={LabelForPoint,MaxDeltaGuideLines}]; If[Opt>1,Show[OptPlot,CircleAta,Supplement,ImageSize\[Rule]450, PlotRange\[Rule]{If[ mapprox\[Equal]0,{LeftEnd, RightEnd},{Max[LeftEnd,a-4/Abs[mapprox]], Min[RightEnd,a+4/Abs[mapprox]]}],{g[a]-4,g[a]+4}}, Axes\[Rule]{True,False}];]; If[Opt\[Equal]3||Opt\[Equal]4, DistToAsym= Min[Abs[Asymptotes-a]]]; If [Opt\[Equal]1, {MaxDelta=4/Abs[K[2]];},{MaxDelta=-1; While[MaxDelta\[LessEqual]0 ||( IntegerPart[MaxDelta]\[NotEqual]MaxDelta&& Denominator[MaxDelta]\[Equal]1), Print["For nonlinear functions, the mathematical procedure \ begins by setting an upper \nlimit on \[Delta], independent of what \ \[Epsilon]'s might later be given. Call the limit MaxDelta."<> If[Opt>2, "\nIf keeping 0<|x-a|<\[Delta]\[LessEqual]MaxDelta is to \ force |f(x)-L| to be small, clearly we need to make \nsure that the interval \ [a-MaxDelta,a+MaxDelta] must not reach to a vertical asymptote. \nThere is no \ other mathematical restriction on MaxDelta.",""]<> "\nFor tutorial reasons, we want to make sure the first \ admissible \[Delta] interval can not fill \nthe graphing window. The \ instructions you will see involving the blue lines come from \nthis \ restriction."] ; Pause[3]; MaxDelta= Input["Enter a positive value of MaxDelta (avoid decimals) as \ described in the instructions on the screen."<> If[Opt\[Equal]3||Opt\[Equal]4||Opt==5, "Avoid any vertical asymptote of g[x]: keep MaxDelta<"<> ToString[DistToAsym,InputForm]<> If[Opt==5," if there IS a vertical asymptote.","."], "."]<>"\n\nChoose MaxDelta large enough that some x's \ in the interval ["<> ToString[a,InputForm]<>"-MaxDelta,"<> ToString[a,InputForm]<> "+MaxDelta] give a g[x] outside the blue lines. If no \ satisfactory MaxDelta is available, enter a MaxDelta "<> If[Opt\[Equal]3||Opt\[Equal]4||Opt==5, "under "<>ToString[DistToAsym,InputForm],""]<> ", but then re-execute this cell with a new g[x] or \ 'a'."]]; If[Opt==3||Opt==4, While[DistToAsym\[LessEqual]MaxDelta, MaxDelta= Input["Try again;your previous choice of MaxDelta="<> ToString[MaxDelta,InputForm]<> " resulted in a vertical asymptote in the interval ["<> ToString[a,InputForm]<>"-MaxDelta,"<> ToString[a,InputForm]<> "+MaxDelta]. To avoid an asymptote, keep MaxDelta<"<> ToString[DistToAsym,InputForm]<>"."];]];}]; MaxDeltaBoxLines= Graphics[{If[Opt>1,RGBColor[0,.5,1], RGBColor[1,1,1]], Dashing[{.01,.01}] , Line[{ {a-MaxDelta,g[a]-4},{a-MaxDelta,g[a]+4}}], Line[ { {a+MaxDelta,g[a]-4},{a+MaxDelta,g[a]+4}}]}]; ShowChoices= Show[OptPlot,CircleAta,Supplement,MaxDeltaBoxLines, ImageSize\[Rule]450, PlotRange->{{a-2*MaxDelta,a+2*MaxDelta},{g[a]-4,g[a]+4}}, Axes->True]; If[Opt>1,Print[ "Your current choices are a="<>ToString[a,StandardForm]<> " and MaxDelta="<>ToString[MaxDelta,StandardForm]<> "; The function g[x]="<>ToString[g[HoldForm[x]],StandardForm]<> ". \nFor some x between the vertical blue lines, g[x] should \ be outside the band between \nthe horizontal blue lines. If this does NOT \ occur above, re-execute this cell with \nnew choices. If it does occur, then \ go down to the cell with the purple bracket."];, If[Opt>1, Print["Regardless of the \[Epsilon] which the notebook give you \ later, the notebook will not let you \nchoose a \[Delta] above MaxDelta="<> ToString[MaxDelta,StandardForm]<> ", corresponding to the two blue lines. Staying under that \ \nvalue will not be hard: any time a \[Delta] works, every smaller \[Delta] \ also works!"]];]; ValidFinished=False; While[ValidFinished==False, Finished= Input["Enter 1 if you want to go on to the purple bracket or if \ you plan to re-execute this cell for a new g[x] and new 'a'; \nEnter a 0 if \ you want to change 'a' while keeping g[x]."]; If[Finished==0||Finished==1, ValidFinished=True, ValidFinished=False]]; If[Finished==0,Show[OptPlot],DirectionsToPurple]]}; ]; (****This module checks each \[Delta] generated in the multi-epsilon testing, to make sure it's positive and not above MaxDelta*****) TestForLegal\[Delta]:=Module[{},\[Delta]Legal=1; If[\[Delta]\[LessEqual]0,{Print[ "Your formula has given \[Delta]="<> ToString[\[Delta],StandardForm]<> " which is not positive. Go back and\nrevise your formula, then \ execute this cell again."];\[Delta]Legal=0;}, If[\[Delta]> MaxDelta,{Print[ "Your formula has given \[Delta]="<> ToString[\[Delta],StandardForm]<> " which is larger than MaxDelta="<> ToString[MaxDelta,InputForm]<> ". Our procedure won't allow this.\nPlease go back and revise \ your formula, then execute this cell again."];\[Delta]Legal=0;}];];]; (**The next two lines are used in the proof at the end, to avoid notation like --5**) StringForL:= If[L>0,ToString[L,StandardForm],"("<>ToString[L,StandardForm]<>")"]; stringfora:= If[a >= 0, ToString[a, StandardForm], "(" <> ToString[a, StandardForm] <> ")"]; (****This next module gives the optional explanation of the geometry of the \ \[Delta] calculation***) ExplainGeometry:= Module[{},EnvelopeFunc1[x_]:=L+UpperBoundOnSecantSlope*(x-a); EnvelopeFunc2[x_]:=L-UpperBoundOnSecantSlope*(x-a); Print["\n\nTo understand better how the shape of f[x] lets our procedure \ for finding \[Delta] succeed,\nrewrite the above inequality,|f(x)-"<> StringForL<>"|\[LessEqual]"<> ToString[ UpperBoundOnSecantSlope,StandardForm]<>"Abs[x-"<>stringfora<> "], using two cases:\n"<>"If x>"<>ToString[a,StandardForm]<> ", then the inequality simplifies to "<>"|f(x)-"<>StringForL<> "|\[LessEqual]"<>ToString[ UpperBoundOnSecantSlope,StandardForm]<>"("<> ToString[HoldForm[x]-a,StandardForm]<>"); rewriting gives\n-"<> ToString[ UpperBoundOnSecantSlope,StandardForm]<>"("<> ToString[HoldForm[x]-a,StandardForm]<>")\[LessEqual]f(x)-"<> StringForL<>"\[LessEqual]"<> ToString[ UpperBoundOnSecantSlope,StandardForm]<>"("<> ToString[HoldForm[x]-a,StandardForm]<>"), so "<> ToString[EnvelopeFunc2[HoldForm[x]],StandardForm]<> "\[LessEqual]f(x)\[LessEqual]"<> ToString[EnvelopeFunc1[HoldForm[x]],StandardForm]<> ".\nIn the second case, where x<"<>ToString[a,StandardForm]<> ", the initial inequality instead simplifies to \n"<>"|f(x)-"<> StringForL<>"|\[LessEqual]-"<> ToString[ UpperBoundOnSecantSlope,StandardForm]<>"("<> ToString[HoldForm[x]-a,StandardForm]<>"); rewriting gives "<> StringForL<>"+"<>ToString[ UpperBoundOnSecantSlope,StandardForm]<>"("<> ToString[HoldForm[x]-a,StandardForm]<>")\[LessEqual]f(x)\[LessEqual]"<> StringForL<>"-"<>ToString[ UpperBoundOnSecantSlope,StandardForm]<>"("<> ToString[HoldForm[x]-a,StandardForm]<>")."];Pause[3]; Print["\nCombine the two cases: "<>" if 0<|x-"<>stringfora<>"|\[LessEqual]"<> "MaxDelta"<>"="<>ToString[MaxDelta ,StandardForm]<> " and we define K="<>ToString[UpperBoundOnSecantSlope,StandardForm]<> ", then \n(x,f[x]) is trapped in a bow tie shaped region between two \ linear functions with \nslopes \[PlusMinus]K."<> " (See the picture below.) For any (x,y) in that region, the rise \ (or fall) \nfrom a height of "<>ToString[L,StandardForm]<> " can not exceed K times the size of the run from x="<> ToString[a,StandardForm]<>". Keeping "<>"\n|f(x)-"<>StringForL<> "| under "<>ToString[HoldForm[\[Epsilon] ]]<> " thus only requires that we keep "<>"Abs[x-"<>stringfora<>"] under "<> ToString[HoldForm[\[Epsilon]]/HoldForm[K] ,StandardForm]<> ". If \nf(x) were instead vertical at x="<>ToString[a,StandardForm]<> ", the bow tie would become two half planes and \nno such K would \ exist. We would have to find another method to construct a recipe for \ \[Delta].\n\nThe picture will follow in 4 seconds.\n\n"];]; ExplainLinearGeometry:=Module[{}, Print["\n\nTo understand better how the linearity of f[x] makes it simple to find the \[Delta] recipe, \ninterpret the above equality,|f(x)-"<>StringForL<>"|="<> ToString[ UpperBoundOnSecantSlope,StandardForm]<>"Abs[x-"<>stringfora<>"]: as x moves away from x=a="<>ToString[a]<>" the distance \nbetween f(x)and "<>ToString[L,StandardForm]<>" is always EXACTLY "<> ToString[ UpperBoundOnSecantSlope,StandardForm]<>" times as much as the distance from x to "<>ToString[a,StandardForm]<>". \nSo to keep f(x) within \[Epsilon] of "<>ToString[L, StandardForm]<>", just keep x within "<>ToString[1/ UpperBoundOnSecantSlope,StandardForm]<>"\[Epsilon] of a="<>ToString[a]<>"."]] (****This next module shows the optional graphs related to the geometry of \ the \[Delta] calculation***) ShowGeometry:= Module[{}, GFuncPlot= Plot[g[x],{x,a-MaxDelta,a+MaxDelta},PlotStyle\[Rule]{Thickness[.015]}, DisplayFunction\[Rule]Identity]; Triangles= Graphics[{Hue[.5], Polygon[{{a-MaxDelta,EnvelopeFunc1[a-MaxDelta]},{a-MaxDelta, EnvelopeFunc2[a-MaxDelta]},{a,L},{a+MaxDelta, EnvelopeFunc1[a+MaxDelta]},{a+MaxDelta, EnvelopeFunc2[a+MaxDelta]},{a,L}}]}]; Envelope= Graphics[{Hue[.8],Thickness[.0050],Dashing[{.05,.05}], Line[{{a-1.5*MaxDelta, EnvelopeFunc1[a-1.5*MaxDelta]},{a+1.5*MaxDelta, EnvelopeFunc1[a+1.5*MaxDelta]}}], Line[{{a-1.5*MaxDelta, EnvelopeFunc2[a-1.5*MaxDelta]},{a+1.5*MaxDelta, EnvelopeFunc2[a+1.5*MaxDelta]}}]}]; EnvelopeGraph= Show[Triangles,GFuncPlot,YatL,Envelope,FAta, Graphics[{Text[ "x="<>ToString[a,StandardForm]<>"-"<>"MaxDelta",{a-MaxDelta, EnvelopeFunc2[a+MaxDelta]},{1,1},{1,0}], Text["x=a="<>ToString[a,StandardForm],Scaled[{.5,.1}]], Text["y="<> ToString[EnvelopeFunc1[HoldForm[x]], StandardForm],{a+1.5*MaxDelta, EnvelopeFunc1[a+1.5*MaxDelta]},{1,+2},{1,0}], Text["y="<> ToString[EnvelopeFunc2[HoldForm[x]], StandardForm],{a-1.5*MaxDelta, EnvelopeFunc2[a-1.5*MaxDelta]},{-1,+2},{1,0}], Text["x="<>ToString[a,StandardForm]<>"+"<> "MaxDelta",{a+MaxDelta,EnvelopeFunc1[a-MaxDelta]},{-1,1},{1, 0}]}],DisplayFunction\[Rule]$DisplayFunction, GridLines\[Rule]{{{a-MaxDelta,{Thickness[.0050], Dashing[{.05,.05}]}}, aGridLine,{a+MaxDelta,{Thickness[.0050],Dashing[{.05,.05}]}}}, None},ImageSize\[Rule]550, PlotLabel\[Rule] "This bow tie shaped trap on f(x) leads to our formula \[Delta]="<> ToString[BiggerAuto\[Delta][HoldForm[\[Epsilon]]],StandardForm]<> ":"<>"\nIf 0<|x-"<>stringfora<>"|\[LessEqual]"<>"MaxDelta"<>"="<> ToString[MaxDelta,StandardForm]<>", |f(x)-"<>StringForL<> "|\[LessEqual]"<>ToString[UpperBoundOnSecantSlope,StandardForm]<> "Abs[x-"<>stringfora<>"].",Axes\[Rule]True];]; (****This next module rates a successful \[Delta] against the Auto\[Delta]****) CompareThe\[Delta]s:= Module[{}, If[This\[Delta]Ok\[Equal]1&&\[Delta]Ratio >1, "But the notebook's automated \[Delta] was "<> ToString[N[IntegerPart[A\[Delta]*100000000]/100000000], StandardForm]<>", "<> ToString[N[IntegerPart[100*\[Delta]Ratio]/100]]<> " times as large as yours.\nTo win our game, you want YOUR \[Delta] \ not only to work; you want IT to be the largest."<> If[NumOfEpsilons>1, "", "\nGo back to the red bracket for another \[Epsilon] and try \ Option A again. Beat the Auto\[Delta]!"], If[This\[Delta]Ok\[Equal]1, If[\[Delta]Ratio ==1, "The notebook's automated \[Delta] was the same as yours, \ \ so we have a tie for this round.", "The notebook's automated \[Delta] was "<> ToString[ N[IntegerPart[A\[Delta]*100000000]/100000000], StandardForm]<>", "<> ToString[ N[IntegerPart[1000000\[Delta]Ratio]/1000000]]<> " times as large as yours.\nYour \[Delta] is the larger one, so \ you WIN this trial! Congratulations!"], "Try Again, You'll get it!"]]] \!\(\* RowBox[{ StyleBox[\( (*\(**\)\(\(*\)\(This\)\(\ \)\(module\)\(\ \)\(gives\)\(\ \ \)\(a\)\(\ \)\(mathematical\)\(\ \)\(derivation\)\(\ \)\(of\)\(\ \)\(the\)\(\ \ \)\(\(Auto\[Delta]\)\(.\)\)\)****) \), FontColor->RGBColor[1, 0, 0]], "\n", RowBox[{ RowBox[{ StyleBox["ExplainTheAuto\[Delta]", FontColor->RGBColor[0, 0.501961, 0]], ":=", RowBox[{"Module", StyleBox["[", FontSize->24, FontColor->RGBColor[1, 0.501961, 0]], StyleBox[" ", FontSize->24, FontColor->RGBColor[1, 0, 1]], RowBox[{\({}\), ",", " ", RowBox[{"{", RowBox[{\(Print["\<\n\nIf x\[NotEqual]a=\>" <> ToString[a, StandardForm] <> "\< our f[x]=\>" <> ToString[g[HoldForm[x]], StandardForm] <> "\<. (Recall that with the jump you \n\ selected, f[a]=f[\>" <> ToString[a, StandardForm] <> "\<]=\>" <> ToString[f[a], StandardForm] <> "\<, not \>" <> ToString[g[HoldForm[a]], StandardForm] <> "\<.)\n\>" <> "\", ToString[L, StandardForm] <> If[Opt > 1, "\<, and the MaxDelta you chose is \>" <> ToString[MaxDelta, StandardForm] <> "\<.\>", "\<.\>"]]\), ";", "\n", \(Print["\" <> StringForL <> "\<| = Abs[\>", FactoredDifference, "\<].\>"]\), ";", "\n", RowBox[{"If", StyleBox["[", FontColor->RGBColor[1, 0.501961, 0]], \(Opt > 1, Print["\", Abs[HoldForm[x] - a], "\<, which is Abs[\>", SecantSlope[HoldForm[x]], "\<]:\>"]; \n BoundToUse = If[Opt \[NotEqual] 2, UpperBoundOnNum, UpperBoundOnSecantSlope]; \n Print["\" <> stringfora <> "\<|\[LessEqual]\>" <> "\" <> \ "\<=\>", MaxDelta, "\<, Abs[\>", If[Opt \[NotEqual] 2, SecSlopeNum[HoldForm[x]], SecantSlope[HoldForm[x]]], "\<]\[LessEqual]\>", If[IntegerPart[BoundToUse] \[NotEqual] BoundToUse, ToString[BoundToUse, StandardForm] <> "\<=\>" <> ToString[ N[IntegerPart[100000*BoundToUse]/ 100000]] <> "\<.\>", ToString[BoundToUse, StandardForm] <> "\<.\>"]]\), StyleBox["]", FontColor->RGBColor[1, 0.501961, 0]]}], ";", "\[IndentingNewLine]", RowBox[{"If", StyleBox["[", FontColor->RGBColor[1, 0.501961, 0]], \(Opt \[Equal] 4, {Show[ Plot[SecSlopeNumFunc[x], {x, a - 1.5*MaxDelta, a + 1.5*MaxDelta}, GridLines \[Rule] {{{a - MaxDelta, {Thickness[ .0050], Dashing[{ .05, .05}]}}, {a + MaxDelta, {Thickness[ .0050], Dashing[{ .05, .05}]}}}, None}, AxesOrigin \[Rule] {a - 1.5*MaxDelta, Automatic}, PlotLabel \[Rule] ToString[SecSlopeNum[HoldForm[x]]], DisplayFunction \[Rule] Identity], Graphics[{Text["\" <> ToString[a, StandardForm] <> "\<-\>" <> \ "\", {a - MaxDelta, SecSlopeNumFunc[a]}, {1, \(-1\)}, {0, 1}], Text["\" <> ToString[a, StandardForm] <> "\<+\>" <> \ "\", {a + MaxDelta, SecSlopeNumFunc[a]}, {\(-1\), \(-1\)}, {0, 1}]}], DisplayFunction \[Rule] $DisplayFunction, ImageSize \[Rule] 250], Pause[3]}\), StyleBox["]", FontColor->RGBColor[1, 0.501961, 0]]}], ";", "\[IndentingNewLine]", RowBox[{"If", StyleBox["[", FontColor->RGBColor[1, 0.501961, 0]], \(Opt \[Equal] 2, {Show[ Plot[SecantSlope[x], {x, a - 1.5*MaxDelta, a - .0001}, DisplayFunction \[Rule] Identity], Plot[SecantSlope[x], {x, a + .0001, a + 1.5*MaxDelta}, DisplayFunction \[Rule] Identity], Graphics[{Text["\" <> ToString[a, StandardForm] <> "\<-\>" <> \ "\", {a - MaxDelta, SecantSlope[a + .0001]}, {1, \(-1\)}, {0, 1}], Text["\" <> ToString[a, StandardForm] <> "\<+\>" <> \ "\", {a + MaxDelta, SecantSlope[a + .0001]}, {\(-1\), \(-1\)}, {0, 1}]}], DisplayFunction \[Rule] $DisplayFunction, GridLines \[Rule] {{{a - MaxDelta, {Thickness[ .0050], Dashing[{ .05, .05}]}}, {a + MaxDelta, {Thickness[ .0050], Dashing[{ .05, .05}]}}}, None}, AxesOrigin \[Rule] {a - 1.5*MaxDelta, Automatic}, PlotLabel \[Rule] ToString[SecantSlope[HoldForm[x]], StandardForm], DisplayFunction \[Rule] Identity, ImageSize \[Rule] 250], Pause[3]}\), StyleBox["]", FontColor->RGBColor[1, 0.501961, 0]]}], ";", "\[IndentingNewLine]", RowBox[{"If", StyleBox["[", FontColor->RGBColor[1, 0.501961, 0]], \(Opt > 2, \n{Print["\", \ Factor[SecSlopeDen[HoldForm[x]]], "\<.\>"]; \ Map[Print[#] &, ExplList]; \[IndentingNewLine]\ Duo = If[ FactorsCount < 3, \ {DenomPics[\([1]\)], DenomPics[\([2]\)]}, {DenomPics[\([2]\)], DenomPics[\([3]\)]}]; \n Show[GraphicsArray[Duo], \ DisplayFunction \[Rule] $DisplayFunction, \ ImageSize \[Rule] 550]; \[IndentingNewLine]Print["\" \ <> stringfora <> "\<|\[LessEqual]\>" <> "\" <> "\<=\>", MaxDelta\ , "\<, the magnitude of the denominator is \ always at least \>", \ LowerBoundOnDen, If[Opt \[Equal] 4, "\<.\n(Perhaps the denominator stays even \ further from zero, but this bound is valid.)\>", "\<.\>"]]; \ \[IndentingNewLine]Pause[3]; \n Print["\" <> ToString[SecantSlope[HoldForm[x]], StandardForm] <> "\<]:\nif 0<|x-\>" <> stringfora <> "\<|\[LessEqual]\>" <> "\" <> \ "\<=\>" <> ToString[MaxDelta\ , StandardForm] <> "\<, |f(x)-\>" <> StringForL <> "\<|\[LessEqual]\>" <> ToString[\ ToString[UpperBoundOnNum, \ InputForm]\/ToString[LowerBoundOnDen, InputForm], StandardForm] <> "\" <> stringfora <> "\<]\>"\ <> \[IndentingNewLine]If[ Denominator[UpperBoundOnSecantSlope] \[NotEqual] LowerBoundOnDen, "\<=\>" <> ToString[\ UpperBoundOnSecantSlope, StandardForm] <> "\" <> stringfora <> "\<].\>", "\<.\>"]]; If[Length[DenomFactors[x]] > 0, \(Print[ If[Opt \[Equal] 4, "\<(Perhaps the coefficient of (x-a) never \ gets this large, but the bound is valid.)\>", "\<\>"]];\)]; \nPause[3];}\), StyleBox["]", FontColor->RGBColor[1, 0.501961, 0]]}], ";", "\[IndentingNewLine]", RowBox[{\(Print["\"]\), "\n", RowBox[{"Print", "[", RowBox[{ "\"\0, we choose \ \[Delta][\[Epsilon]]=\>\"", ",", \(If[ Opt > 1, "\" <> "\<\>" <> "\" <> \ "\<,\>", "\<\>"]\), " ", ",", \(1/UpperBoundOnSecantSlope\), ",", \("\<*\[Epsilon]\>" <> If[Opt > 1, "\<]\>", "\<\>"] <> "\<>0. If\n0<|x-a|=\>"\), ",", \(Abs[HoldForm[x] - a]\), ",", \("\<<\[Delta], then\>" <> If[Opt > 1, "\<|x-\>" <> stringfora <> "\<|<\[Delta]\[LessEqual]\>" <> \ "\" <> "\<=\>" <> ToString[MaxDelta, StandardForm] <> "\<. This implies\>", \ "\<\>"]\), " ", ",", \("\<\n|f(x)-\>" <> StringForL <> If[Opt > 1, "\<|\[LessEqual]\>", "\<|=\>"]\), ",", " ", \(Abs[HoldForm[x] - a]*UpperBoundOnSecantSlope\), ",", "\"\< <\>\"", ",", "UpperBoundOnSecantSlope", ",", \(If[ Opt > 1, "\<*\[Delta]\[LessEqual]\>", \ "\<*\[Delta]=\>"]\), ",", RowBox[{\(ToString[UpperBoundOnSecantSlope, StandardForm]\), "<>", RowBox[{"ToString", "[", RowBox[{ RowBox[{"1", /, "UpperBoundOnSecantSlope"}], ",", "StandardForm"}], "]"}], "<>", "\"\<\[Epsilon]=\[Epsilon].\\nTherefore |f(x)-\>\"", "<>", "StringForL", "<>", "\"\<|<\[Epsilon] as required and the limit is indeed \ \>\""}], ",", " ", "L", ",", "\"\<.\\n\\n\\nThe procedures we use do not always give \ the largest possible \[Delta], but they do \\ngive it in some cases. To make \ sure the notebook's auto\[Delta] can always\\nbe beaten, the auto\[Delta] \ used in the graphing is actually 4/5 of the one you see\\nabove. Thus, if \ you learn how to use the above argument, your \[Delta] will always\\nbe \ 5/4=1.25 times as large as the notebook's. So you will win!\\n\\nIn 5 \ seconds, you will have a chance to opt for still more explanation.\>\""}], "]"}]}], ";", " ", \(Pause[5]\), ";"}], "}"}]}], StyleBox["]", FontSize->24, FontColor->RGBColor[1, 0.501961, 0]]}]}], ";"}]}]\) (****This next module tests one delta which is already verified as legal.****) \ TestOneLegal\[Delta]:= Module[{},{If[ Opt\[Equal]5(**Auto\[Delta] by experimentation only**),{J= 1;\[Delta]Up=0;ThisXOK=1; While[ThisXOK\[Equal]1&&J\[LessEqual]2*NumOfSteps,{x=a+J*step; If[Abs[f[x]-L]<\[Epsilon],\[Delta]Up=x-a,ThisXOK=0];J=J+1}]; J=1;\[Delta]Down=0;ThisXOK=1; While[ThisXOK\[Equal]1&&J\[LessEqual]2*NumOfSteps,{x=a-J*step; If[Abs[f[x]-L]<\[Epsilon],\[Delta]Down=a-x,ThisXOK=0];J=J+1}]; A\[Delta]=.8*Min[{\[Delta]Up,\[Delta]Down}]/2},(** Formula for Auto\[Delta] has already been found.**) A\[Delta]=Auto\[Delta][\[Epsilon]];]; \[Delta]Ratio=A\[Delta]/\[Delta]; This\[Delta]Ok=1;If[\[Delta]Ratio\[GreaterEqual]1,BeatAuto\[Delta]=0]; StepExt=2*A\[Delta]/NumOfSteps; Closetoa= Graphics[{PointSize[ If[Abs[f[#1]-L]\[GreaterEqual]\[Epsilon],.024,.016]], Hue[If[Abs[f[#1]-L]\[GreaterEqual]\[Epsilon],1,.3]], Point/@{{#1,L-2*\[Epsilon]},{#1,f[#1]}}}&/@ Append[Range[a-\[Delta]+step,a+\[Delta]-step,step], a+\[Delta]-step]]; J=1; While[This\[Delta]Ok\[Equal]1&&J\[LessEqual]NumOfSteps-1, x=a-\[Delta]+J*step; If[Abs[f[x]-L]\[GreaterEqual]\[Epsilon]&&x\[NotEqual]a, This\[Delta]Ok=0];J=J+1]; Farfroma= Graphics[{Point/@ Table[{x,f[x]},{x,a-\[Delta], Max[{a-2*\[Delta],a-MaxDelta}],-step}], Point/@Table[{x,f[x]},{x,a+\[Delta], Min[{a+2*\[Delta],a+MaxDelta}],step}]}]; If[A\[Delta]>\[Delta], Extend=Graphics[{Point/@ Table[{x,f[x]},{x,a-2*\[Delta], Max[{a-2*A\[Delta],a-MaxDelta}],-StepExt}], Point/@Table[{x,f[x]},{x,a+2*\[Delta], Min[{a+2*A\[Delta],a+MaxDelta}],StepExt}]}], Extend=Graphics[Text["",{a,L-2*\[Epsilon]}]]]; Irrelevant= Graphics[{PointSize[.024],RGBColor[0,0,0],Point[{a,L-2*\[Epsilon]}]}]; Bigger\[Delta]=Max[\[Delta],A\[Delta]]; RightSide=Min[{a+2*Bigger\[Delta],a+MaxDelta}]; LeftSide=Max[{a-2*Bigger\[Delta],a-MaxDelta}]; Descript= Graphics[{Text[ "x=a-your \[Delta]",{a-\[Delta],L+2*\[Epsilon]},{1,1},{1,0}], Text["x=a+your \[Delta]",{a+\[Delta],L+2*\[Epsilon]},{-1,1},{1, 0}],Text[ StyleForm["x=a+auto \[Delta]", FontColor\[Rule]RGBColor[0,0,1]],{a+A\[Delta], L-2*\[Epsilon]},{-1,-5},{1,0}], Text[StyleForm["x=a-auto \[Delta]", FontColor\[Rule]RGBColor[0,0,1]],{a-A\[Delta], L-2*\[Epsilon]},{1,-5},{1,0}], Text["y=L+\[Epsilon]",{RightSide,L+\[Epsilon]},{1,-1},{1,0}], Text["y=L",{RightSide,L},{1,-1},{1,0}], Text["y=L-\[Epsilon]",{RightSide,L-\[Epsilon]},{1,-1},{1,0}]}]; FinishedPic= Show[Closetoa,Farfroma,FAta,Irrelevant,Descript,Extend, GridLines\[Rule]{{{a-\[Delta],{Thickness[.0050], Dashing[{.05,.05}]}},{a+\[Delta],{Thickness[.0050], Dashing[{.05,.05}]}},{a-A\[Delta],{RGBColor[0,0,1], Dashing[{.01,.02}]}},{a+A\[Delta],{RGBColor[0,0,1], Dashing[{.01,.02}]}}},{{L-\[Epsilon],{Dashing[{.05,.05}]}}\ ,{L+\[Epsilon],{Dashing[{.05,.05}]}},{L,{Thickness[.005], Dashing[{.05,.05}]}}}}, AxesOrigin\[Rule]{LeftSide,L-2*\[Epsilon]},Axes\[Rule]True, PlotRange\[Rule]{{LeftSide,RightSide},{L-2*\[Epsilon], L+2*\[Epsilon]}}, PlotLabel\[Rule]ColumnForm[{"a="<>ToString[a,InputForm]<> "; Proposed L="<>ToString[L,InputForm]<>";", "f[x]="<>ToString[g[HoldForm[x]],FortranForm]<> " if x\[NotEqual]"<>ToString[a,InputForm]<>"; f["<>ToString[a,InputForm]<>"]="<> ToString[f[a],StandardForm]<>".", "Trial "<>ToString[EpsNumber]<>". Given \[Epsilon]= "<> ToString[N[IntegerPart[10000000*\[Epsilon]]/10000000], InputForm]<>", You choose \[Delta]="<> If[NumOfEpsilons>1, ToString[Delta[HoldForm[\[Epsilon]]],FortranForm]<>"=", ""]<>ToString[N[IntegerPart[10000000*\[Delta]]/10000000], InputForm], "That \[Delta] "<> If[This\[Delta]Ok\[Equal]1, "appears to succeed: for each tested x with 0<|x-a|<\ \[Delta], |f(x)-L|<\[Epsilon] holds.", "fails: for at least one x with 0<|x-a|<\[Delta], \ |f(x)-L|<\[Epsilon] is false."],CompareThe\[Delta]s},Center], ImageSize\[Rule]550]; If[This\[Delta]Ok\[NotEqual]1,All\[Delta]Ok=0];Pause[2];}]; (****The next module gives a summary at the end of the testing****) SummaryAtEnd:= Module[{}, If[NumOfEpsilons\[Equal]1, If[This\[Delta]Ok\[Equal]1, If[\[Delta]Ratio<1, Print["Good job! Perhaps it's time for you to go to Option B and \ enter a general\nrecipe for \[Delta]!"]], Print["You'll get it yet! Go back to the Option A cell and try \ another \[Delta] for this \[Epsilon]. Remember, you want to\nchoose \[Delta] \ so that for all x satisfying 0<|x-a|<\[Delta], |f(x)-L|<\[Epsilon] always \ follows."]],{BigEpsilonChosen=0; If[All\[Delta]Ok\[Equal]0, Print["The limit of L is not established: for at least one of the \ tested \[Epsilon]'s, the \[Delta]\nproposed for that \[Epsilon] failed to \ work. Either the limit is not L, or your \[Delta] recipe\nneeds some \ adjustment. Try again, you'll get it!"], Print["Our testing suggests that the Limit is L and that you have \ found a valid \[Delta] recipe: for each\ntested \[Epsilon], your \[Delta]'s \ worked for all tested x's."<> If[BeatAuto\[Delta]\[Equal]1, " Even better, you beat the Auto\[Delta] every single time! \ \nThis is a strong indication that you have mastered the construction of the \ \[Delta] recipes. \nCONGRATULATIONS! Do make sure you can write up your work \ to PROVE that your recipe would work \nfor ALL \[Epsilon]'s and ALL relevant \ x's."," But your \[Delta]'s were not consistently larger \nthan the \ notebook's Auto\[Delta]'s, and that suggests you may need further study of \ the notes on how \nto construct the recipes. "]]]; Print[ "To continue testing on the same problem with other \[Epsilon]'s, \ execute the Red \nBracket cell again, then come back here. (Revisit Option A \ or Option B \nto change \[Delta], if you wish.)"];};];]; CheerEmOn:=Module[{},ColorsOriginal={RGBColor[0,0,1],RGBColor[1,.5,0],RGBColor[0,.5,0]}; NewColors={}; Do[ {NextPick= Random[Integer, {1,Length[ColorsOriginal]}], B=Extract[ColorsOriginal, {NextPick}], NewColors=Append[NewColors,ColorsOriginal[[NextPick]] ], ColorsOriginal=Drop[ColorsOriginal, {NextPick}];},{3}]; Ending={"This is the end;","go back and", "play some more!"}; Locations={1,595,1190}; Lastwords={}; Do[Lastwords=Append[Lastwords, Graphics[{NewColors[[j]],Text[Ending[[j]], {Locations[[j]],0},{0,0}]}]],{j,3}]; Show[Lastwords,ImageSize->{450,25},PlotRange->{{0,250},Automatic}]] DirectionsToPink:=Module[{}, OtherWords= Graphics[ Text["AFTER you read the following text (at least the first \ time!),\nGo down to the bracket to test your \[Delta] recipe." \ ,{-1,-.5},{0,0}]]; Pink=Graphics[{RGBColor[1,0,.5],Text["pink",{-2800,-1.4},{0,0}]}]; Show[Pink, OtherWords,ImageSize\[Rule]{500,40}, PlotRange\[Rule]{{-1000,1000},{-3,2}}];];