Skip to content

Instantly share code, notes, and snippets.

@hyrodium
Created June 2, 2018 12:48
Show Gist options
  • Save hyrodium/d08b49cbf7c4376b64c35d9476e1bd2f to your computer and use it in GitHub Desktop.
Save hyrodium/d08b49cbf7c4376b64c35d9476e1bd2f to your computer and use it in GitHub Desktop.
(* 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[ 11520, 287]
NotebookOptionsPosition[ 11130, 268]
NotebookOutlinePosition[ 11505, 285]
CellTagsIndexPosition[ 11462, 282]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"f", "[", "t_", "]"}], "=",
RowBox[{"3",
RowBox[{"Cos", "[",
RowBox[{"2", "\[Pi]", " ", "t"}], "]"}]}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"g", "[", "t_", "]"}], "=", " ",
RowBox[{"2",
RowBox[{"Sin", "[", " ",
RowBox[{"2", "\[Pi]", " ", "t"}], "]"}]}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"pr", "=",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"-", "4"}], ",", "4"}], "}"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"-", "4"}], ",", "4"}], "}"}]}], "}"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"tmax", "=", "1"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"tmin", "=", "0"}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"r", "[", "t_", "]"}], "=",
RowBox[{
SuperscriptBox[
RowBox[{"(",
RowBox[{
SuperscriptBox[
RowBox[{"(",
RowBox[{"D", "[",
RowBox[{
RowBox[{"f", "[", "t", "]"}], ",", "t"}], "]"}], ")"}], "2"], "+",
SuperscriptBox[
RowBox[{"(",
RowBox[{"D", "[",
RowBox[{
RowBox[{"g", "[", "t", "]"}], ",", "t"}], "]"}], ")"}], "2"]}],
")"}],
FractionBox["3", "2"]], "/",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"D", "[",
RowBox[{
RowBox[{"f", "[", "t", "]"}], ",", "t"}], "]"}], ")"}],
RowBox[{"(",
RowBox[{"D", "[",
RowBox[{
RowBox[{"g", "[", "t", "]"}], ",",
RowBox[{"{",
RowBox[{"t", ",", "2"}], "}"}]}], "]"}], ")"}]}], "-",
RowBox[{
RowBox[{"(",
RowBox[{"D", "[",
RowBox[{
RowBox[{"f", "[", "t", "]"}], ",",
RowBox[{"{",
RowBox[{"t", ",", "2"}], "}"}]}], "]"}], ")"}],
RowBox[{"(",
RowBox[{"D", "[",
RowBox[{
RowBox[{"g", "[", "t", "]"}], ",", "t"}], "]"}], ")"}]}]}],
")"}]}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"c", "[", "t_", "]"}], "=",
RowBox[{"(",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"f", "[", "t", "]"}], ",",
RowBox[{"g", "[", "t", "]"}]}], "}"}], "+",
RowBox[{
RowBox[{"r", "[", "t", "]"}], "*",
RowBox[{"Normalize", "[",
RowBox[{"{",
RowBox[{
RowBox[{"D", "[",
RowBox[{
RowBox[{"-",
RowBox[{"g", "[", "t", "]"}]}], ",", "t"}], "]"}], ",",
RowBox[{"D", "[",
RowBox[{
RowBox[{"f", "[", "t", "]"}], ",", "t"}], "]"}]}], "}"}],
"]"}]}]}], ")"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"s", "[", "u_", "]"}], "=",
RowBox[{"Show", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"ParametricPlot", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"f", "[", "t", "]"}], ",",
RowBox[{"g", "[", "t", "]"}]}], "}"}], ",",
RowBox[{"c", "[", "t", "]"}]}], "}"}], ",",
RowBox[{"{",
RowBox[{"t", ",", "tmin", ",", "tmax"}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"PlotRange", "\[Rule]", "pr"}]}], "\[IndentingNewLine]", "]"}],
",", "\[IndentingNewLine]",
RowBox[{"Graphics", "[", "\[IndentingNewLine]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"PointSize", "[", "Large", "]"}], ",", "Red", ",",
RowBox[{"Point", "[",
RowBox[{"{",
RowBox[{
RowBox[{"f", "[", "u", "]"}], ",",
RowBox[{"g", "[", "u", "]"}]}], "}"}], "]"}], ",",
"\[IndentingNewLine]",
RowBox[{"Point", "[",
RowBox[{"c", "[", "u", "]"}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"Circle", "[",
RowBox[{
RowBox[{"c", "[", "u", "]"}], ",",
RowBox[{"Abs", "[",
RowBox[{"r", "[", "u", "]"}], "]"}]}], "]"}]}],
"\[IndentingNewLine]", "}"}], "\[IndentingNewLine]", "]"}]}],
"\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"Manipulate", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"s", "[", "u", "]"}], ",",
RowBox[{"{",
RowBox[{"u", ",", "tmin", ",", "tmax"}], "}"}]}], "\[IndentingNewLine]",
"]"}]}], "Input",
CellChangeTimes->{{3.620429556233406*^9, 3.620429844159875*^9}, {
3.6204298970669007`*^9, 3.6204299490178723`*^9}, {3.6204358572688046`*^9,
3.6204359446028*^9}, {3.6204359877602687`*^9, 3.6204360770093737`*^9}, {
3.6204361326685567`*^9, 3.6204361388849125`*^9}, {3.620436194037067*^9,
3.620436346929812*^9}, {3.6204367125257225`*^9, 3.6204368096422777`*^9}, {
3.6204368426051626`*^9, 3.620436951844411*^9}, {3.6204386851025476`*^9,
3.620438723659753*^9}, {3.62043880245226*^9, 3.620438811650786*^9}, {
3.6204388451587024`*^9, 3.6204388573463993`*^9}, {3.6204391417426662`*^9,
3.6204391930806026`*^9}, {3.620439337203846*^9, 3.6204393584420605`*^9}, {
3.6204393922809963`*^9, 3.6204394543395452`*^9}, {3.620439575904499*^9,
3.6204396378630424`*^9}, {3.620439688919963*^9, 3.620439704096831*^9}, {
3.62043985356638*^9, 3.6204398567805643`*^9}, {3.620440584815205*^9,
3.6204406808056955`*^9}, {3.6204410502668276`*^9, 3.620441119982815*^9}, {
3.620441158166999*^9, 3.620441273505596*^9}, {3.620441483003578*^9,
3.620441538700764*^9}, {3.6204416778937254`*^9, 3.620441697512848*^9}, {
3.620441766333784*^9, 3.6204417697509794`*^9}, {3.620441822856017*^9,
3.6204419653051643`*^9}, {3.620442000351169*^9, 3.620442026821683*^9}, {
3.620442805022194*^9, 3.6204428176259146`*^9}, {3.620442862798498*^9,
3.6204428775573425`*^9}, 3.620442941131979*^9, {3.6204468022348213`*^9,
3.620446894609105*^9}, {3.6204735843515844`*^9, 3.6204736633841047`*^9}, {
3.6204737386664104`*^9, 3.620473923765998*^9}, 3.620474229187467*^9, {
3.6204746726948338`*^9, 3.620474694690092*^9}, {3.620474748460168*^9,
3.620474812783847*^9}, {3.620474895486577*^9, 3.6204749404111466`*^9}, {
3.6204749899389796`*^9, 3.620475190501451*^9}, {3.620475255067144*^9,
3.62047539294403*^9}, {3.6204754256769023`*^9, 3.6204755241685357`*^9}, {
3.6204761521174526`*^9, 3.6204762200753393`*^9}, 3.6204774429282827`*^9,
3.621047874826488*^9}],
Cell[BoxData[
TagBox[
StyleBox[
DynamicModuleBox[{$CellContext`u$$ = 0, Typeset`show$$ = True,
Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu",
Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ =
"\"\:540d\:79f0\:672a\:5b9a\:7fa9\"", Typeset`specs$$ = {{
Hold[$CellContext`u$$], 0, 1}}, Typeset`size$$ = {360., {177., 182.}},
Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ =
True, $CellContext`u$1446$$ = 0},
DynamicBox[Manipulate`ManipulateBoxes[
1, StandardForm, "Variables" :> {$CellContext`u$$ = 0},
"ControllerVariables" :> {
Hold[$CellContext`u$$, $CellContext`u$1446$$, 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`s[$CellContext`u$$],
"Specifications" :> {{$CellContext`u$$, 0, 1}}, "Options" :> {},
"DefaultOptions" :> {}],
ImageSizeCache->{411., {224., 229.}},
SingleEvaluation->True],
Deinitialization:>None,
DynamicModuleValues:>{},
SynchronousInitialization->True,
UnsavedVariables:>{Typeset`initDone$$},
UntrackedVariables:>{Typeset`size$$}], "Manipulate",
Deployed->True,
StripOnInput->False],
Manipulate`InterpretManipulate[1]]], "Output",
CellChangeTimes->{{3.6204736003174973`*^9, 3.620473611601143*^9}, {
3.620473654767612*^9, 3.6204736637041235`*^9}, {3.6204737676030655`*^9,
3.6204738223261957`*^9}, 3.6204738524689198`*^9, {3.6204739059559793`*^9,
3.6204739240550146`*^9}, 3.620474682023368*^9, 3.6204747848062468`*^9,
3.620474815972029*^9, {3.6204749100674114`*^9, 3.620474942637274*^9}, {
3.620475037026673*^9, 3.6204751910144806`*^9}, {3.620475257248269*^9,
3.620475281308645*^9}, 3.620475394468117*^9, 3.6204762207093754`*^9,
3.620566588362345*^9, 3.621047671034832*^9, 3.621054549857278*^9}]
}, Open ]],
Cell[BoxData[
RowBox[{"Export", "[",
RowBox[{"\"\<name.gif\>\"", ",", "\[IndentingNewLine]",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"s", "[", "u", "]"}], ",",
RowBox[{"{",
RowBox[{"u", ",", "tmin", ",", "tmax", ",",
RowBox[{
RowBox[{"(",
RowBox[{"tmax", "-", "tmin"}], ")"}], "/", "100"}]}], "}"}]}],
"]"}]}], "\[IndentingNewLine]", "]"}]], "Input",
CellChangeTimes->{{3.6204389552650003`*^9, 3.6204389667826586`*^9}, {
3.6204390186376247`*^9, 3.620439040614882*^9}, {3.620439112718006*^9,
3.6204391370153956`*^9}, {3.6204392187670717`*^9, 3.620439224437396*^9}, {
3.6204392769654007`*^9, 3.6204392770504055`*^9}, {3.6204394641101046`*^9,
3.6204394702474556`*^9}, {3.620439531615966*^9, 3.6204395674600153`*^9},
3.620439620126028*^9, {3.620439673274068*^9, 3.6204396733830743`*^9}, {
3.6204397351296062`*^9, 3.6204397470812893`*^9}, {3.6204398037185287`*^9,
3.6204398414746885`*^9}, {3.6204399080234947`*^9,
3.6204399712231092`*^9}, {3.6204400288104033`*^9, 3.620440058402096*^9}, {
3.6204400965362773`*^9, 3.6204400984123845`*^9}, {3.6204401652502074`*^9,
3.620440180723092*^9}, {3.620440238702409*^9, 3.620440259763613*^9}, {
3.6204404464402905`*^9, 3.6204405214365797`*^9}, {3.6204406985007076`*^9,
3.6204407102983823`*^9}, {3.6204407745330563`*^9,
3.6204407783652754`*^9}, {3.620440849691355*^9, 3.62044084996037*^9}, {
3.6204412906655774`*^9, 3.620441314426936*^9}, {3.6204414133815966`*^9,
3.6204414732310195`*^9}, {3.620441625764744*^9, 3.620441653423326*^9}, {
3.620442043861658*^9, 3.6204420770445557`*^9}, {3.620442146399523*^9,
3.6204421600883055`*^9}, {3.6204427868351536`*^9,
3.6204427992328625`*^9}, {3.6204429622821884`*^9, 3.620442983499402*^9},
3.62044936949166*^9, {3.620475649325694*^9, 3.620475649669714*^9}, {
3.6204761161523952`*^9, 3.6204761292691455`*^9}, {3.6205666057623405`*^9,
3.6205666332689133`*^9}}]
},
WindowSize->{1350, 632},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
ShowSelection->True,
FrontEndVersion->"9.0 for Microsoft Windows (64-bit) (2013\:5e741\:670828\
\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[579, 22, 6501, 168, 509, "Input"],
Cell[7083, 192, 2059, 38, 470, "Output"]
}, Open ]],
Cell[9157, 233, 1969, 33, 72, "Input"]
}
]
*)
(* End of internal cache information *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment