(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 9.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 157, 7] NotebookDataLength[ 7606, 211] NotebookOptionsPosition[ 7247, 194] NotebookOutlinePosition[ 7592, 209] CellTagsIndexPosition[ 7549, 206] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ RowBox[{ RowBox[{"explicitEulerLogistic", "[", "n_", "]"}], ":=", RowBox[{"(", "\[IndentingNewLine]", RowBox[{ RowBox[{"h", "=", RowBox[{"1", "/", "n"}]}], ";", "\[IndentingNewLine]", RowBox[{"y", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"n", "+", "1"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"y", "[", RowBox[{"[", "1", "]"}], "]"}], "=", "0.01"}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "<", RowBox[{"n", "+", "1"}]}], ",", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"y", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"y", "[", RowBox[{"[", "i", "]"}], "]"}], "+", RowBox[{"10", "h", " ", RowBox[{"y", "[", RowBox[{"[", "i", "]"}], "]"}], RowBox[{"(", RowBox[{"1", "-", RowBox[{"y", "[", RowBox[{"[", "i", "]"}], "]"}]}], ")"}]}]}]}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", "y"}], "\[IndentingNewLine]", ")"}]}]], "Input", CellChangeTimes->{{3.6650422017309637`*^9, 3.6650422362093906`*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Manipulate", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"y", "=", RowBox[{"explicitEulerLogistic", "[", "n", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"plotAppr", "=", RowBox[{"ListPlot", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"i", " ", "h"}], ",", " ", RowBox[{"y", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "0", ",", "n"}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"plotExact", "=", RowBox[{"Plot", "[", RowBox[{ FractionBox["0.01", RowBox[{"0.01", "+", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "0.01"}], ")"}], RowBox[{"E", "^", RowBox[{"(", RowBox[{ RowBox[{"-", "10"}], "t"}], ")"}]}]}]}]], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "1"}], "}"}], ",", RowBox[{"PlotStyle", "\[Rule]", "Red"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"GraphicsRow", "[", RowBox[{"{", RowBox[{ RowBox[{"Show", "[", RowBox[{"plotAppr", ",", "plotExact", ",", RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"i", " ", "h"}], ",", RowBox[{"Abs", "[", RowBox[{ RowBox[{"y", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "-", FractionBox["0.01", RowBox[{"0.01", "+", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "0.01"}], ")"}], RowBox[{"E", "^", RowBox[{"(", RowBox[{ RowBox[{"-", "10"}], "i", " ", "h"}], ")"}]}]}]}]]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "0", ",", "n"}], "}"}]}], "]"}], ",", RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}]}], "}"}], "]"}]}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"n", ",", "4", ",", "800", ",", "10"}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.6647340662923274`*^9, 3.664734125098843*^9}, { 3.664883673960988*^9, 3.664883681809555*^9}, {3.664883714255452*^9, 3.6648837149009047`*^9}, {3.665042232220541*^9, 3.6650422642642193`*^9}, { 3.666265157109153*^9, 3.6662651793438435`*^9}, 3.666265286599527*^9, { 3.666265318323913*^9, 3.6662653215682025`*^9}}], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`n$$ = 4, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{ Hold[$CellContext`n$$], 4, 800, 10}}, Typeset`size$$ = { 360., {57., 62.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`n$7368$$ = 0}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`n$$ = 4}, "ControllerVariables" :> { Hold[$CellContext`n$$, $CellContext`n$7368$$, 0]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> ($CellContext`y = \ $CellContext`explicitEulerLogistic[$CellContext`n$$]; $CellContext`plotAppr = ListPlot[ Table[{$CellContext`i $CellContext`h, Part[$CellContext`y, $CellContext`i + 1]}, {$CellContext`i, 0, $CellContext`n$$}]]; $CellContext`plotExact = Plot[0.01/( 0.01 + (1 - 0.01) E^((-10) $CellContext`t)), {$CellContext`t, 0, 1}, PlotStyle -> Red]; GraphicsRow[{ Show[$CellContext`plotAppr, $CellContext`plotExact, PlotRange -> All], ListPlot[ Table[{$CellContext`i $CellContext`h, Abs[ Part[$CellContext`y, $CellContext`i + 1] - 0.01/( 0.01 + (1 - 0.01) E^((-10) $CellContext`i $CellContext`h))]}, {$CellContext`i, 0, $CellContext`n$$}], PlotRange -> All]}]), "Specifications" :> {{$CellContext`n$$, 4, 800, 10}}, "Options" :> {}, "DefaultOptions" :> {}], ImageSizeCache->{409., {103., 108.}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellChangeTimes->{ 3.6650422711741085`*^9, 3.6662651177694006`*^9, 3.6662651632915177`*^9, { 3.6662652668596044`*^9, 3.66626528892817*^9}, 3.666265323299424*^9}] }, Open ]] }, WindowSize->{1292, 598}, WindowMargins->{{11, Automatic}, {Automatic, 14}}, FrontEndVersion->"8.0 for Microsoft Windows (64-bit) (November 7, 2010)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[557, 20, 1357, 38, 192, "Input"], Cell[CellGroupData[{ Cell[1939, 62, 2823, 75, 208, "Input"], Cell[4765, 139, 2466, 52, 228, "Output"] }, Open ]] } ] *) (* End of internal cache information *)