📄 romeoandjuliet-source.nb
字号:
(* Content-type: application/mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 6.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 145, 7]
NotebookDataLength[ 33424, 769]
NotebookOptionsPosition[ 32383, 730]
NotebookOutlinePosition[ 32988, 754]
CellTagsIndexPosition[ 32945, 751]
WindowFrame->Normal
ContainsDynamic->True *)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell["Romeo and Juliet", "Section",
CellFrameColor->RGBColor[
0.6449835965514611, 0.758632791638056, 0.2516823071641108],
FontColor->RGBColor[
0.6449835965514611, 0.758632791638056, 0.2516823071641108]],
Cell[BoxData[
RowBox[{"Manipulate", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"R", ",", " ", "J", ",", " ", "nds"}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"nds", " ", "=", " ",
RowBox[{
RowBox[{"NDSolve", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"R", "'"}], "[", "t", "]"}], " ", "\[Equal]", " ",
RowBox[{
RowBox[{"a", " ",
RowBox[{"R", "[", "t", "]"}]}], " ", "+", " ",
RowBox[{"b", " ",
RowBox[{"J", "[", "t", "]"}], " ",
RowBox[{"If", "[",
RowBox[{"includeNonlinearTerms", ",",
RowBox[{"JM", "-",
RowBox[{"Abs", "[",
RowBox[{"J", "[", "t", "]"}], "]"}]}], " ", ",", " ",
"1"}], "]"}]}]}]}], ",", "\[IndentingNewLine]",
" ",
RowBox[{
RowBox[{
RowBox[{"J", "'"}], "[", "t", "]"}], " ", "\[Equal]", " ",
RowBox[{
RowBox[{"c", " ",
RowBox[{"R", "[", "t", "]"}], " ",
RowBox[{"If", "[",
RowBox[{"includeNonlinearTerms", ",",
RowBox[{"RM", "-",
RowBox[{"Abs", "[",
RowBox[{"R", "[", "t", "]"}], "]"}]}], " ", ",", " ",
"1"}], "]"}]}], "+", " ",
RowBox[{"d", " ",
RowBox[{"J", "[", "t", "]"}]}]}]}], ",", "\[IndentingNewLine]",
" ",
RowBox[{
RowBox[{"R", "[", "0", "]"}], "\[Equal]", "R0"}], ",", " ",
RowBox[{
RowBox[{"J", "[", "0", "]"}], "\[Equal]", "J0"}]}], "}"}], ",",
" ",
RowBox[{"{",
RowBox[{"R", ",", " ", "J"}], "}"}], ",", " ",
RowBox[{"{",
RowBox[{"t", ",", " ", "0", ",", " ", "T"}], "}"}], ",", " ",
RowBox[{"PrecisionGoal", " ", "\[Rule]", " ", "3"}]}], "]"}], " ", "//",
" ", "Quiet"}]}], ";", "\[IndentingNewLine]",
RowBox[{"Column", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"Text", " ", "@", " ", "\[IndentingNewLine]",
RowBox[{"Which", "[",
RowBox[{
RowBox[{
RowBox[{"a", "\[Equal]", "0"}], "&&",
RowBox[{"b", "\[Equal]", "0"}]}], ",", " ",
"\"\<Romeo is apathetic with respect to his own feelings \\nand \
Juliet is not influencing him.\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"a", "\[Equal]", "0"}], "&&",
RowBox[{"b", "<", "0"}]}], ",", " ",
"\"\<Romeo is apathetic with respect to his own feelings \\nand \
Juliet discourages him.\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"a", "\[Equal]", "0"}], "&&",
RowBox[{"b", ">", "0"}]}], ",", " ",
"\"\<Romeo is apathetic with respect to his own feelings \\nand \
Juliet encourages him.\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"a", ">", "0"}], "&&",
RowBox[{"b", "\[Equal]", "0"}]}], ",", " ",
"\"\<Romeo is attracted to Juliet \\nand Juliet is not \
influencing him.\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"a", ">", "0"}], "&&",
RowBox[{"b", "<", "0"}]}], ",", " ",
"\"\<Romeo is attracted to Juliet \\nand Juliet discourages him \
(he is a narcissistic nerd).\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"a", ">", "0"}], "&&",
RowBox[{"b", ">", "0"}]}], ",", " ",
"\"\<Romeo is attracted to Juliet \\nand Juliet encourages him \
(he is an eager beaver).\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"a", "<", "0"}], "&&",
RowBox[{"b", "\[Equal]", "0"}]}], ",", " ",
"\"\<Romeo retreats from his feelings toward Juliet \\nand \
Juliet is not influencing him.\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"a", "<", "0"}], "&&",
RowBox[{"b", "<", "0"}]}], ",", " ",
"\"\<Romeo retreats from his feelings toward Juliet \\nand \
Juliet discourages him (he is a hermit).\>\"", ",", "\[IndentingNewLine]",
" ",
RowBox[{
RowBox[{"a", "<", "0"}], "&&",
RowBox[{"b", ">", "0"}]}], ",", " ",
"\"\<Romeo retreats from his feelings toward Juliet \\nand \
Juliet encourages him (he is a cautious lover).\>\""}], "]"}]}], ",",
"\[IndentingNewLine]",
RowBox[{"Text", " ", "@", " ", "\[IndentingNewLine]", " ",
RowBox[{"Which", "[",
RowBox[{
RowBox[{
RowBox[{"c", "\[Equal]", "0"}], "&&",
RowBox[{"d", "\[Equal]", "0"}]}], ",", " ",
"\"\<Juliet is apathetic with respect to her own feelings \\nand \
Romeo is not influencing her.\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"c", "\[Equal]", "0"}], "&&",
RowBox[{"d", "<", "0"}]}], ",", " ",
"\"\<Juliet is apathetic with respect to her own feelings \\nand \
Romeo discourages her.\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"c", "\[Equal]", "0"}], "&&",
RowBox[{"d", ">", "0"}]}], ",", " ",
"\"\<Juliet is apathetic with respect to her own feelings \\nand \
Romeo encourages her.\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"c", ">", "0"}], "&&",
RowBox[{"d", "\[Equal]", "0"}]}], ",", " ",
"\"\<Juliet is attracted to Romeo \\nand Romeo is not \
influencing her.\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"c", ">", "0"}], "&&",
RowBox[{"d", "<", "0"}]}], ",", " ",
"\"\<Juliet is attracted to Romeo \\nand Romeo discourages her \
(she is a narcissistic nerd).\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"c", ">", "0"}], "&&",
RowBox[{"d", ">", "0"}]}], ",", " ",
"\"\<Juliet is attracted to Romeo \\nand Romeo encourages her \
(she is an eager beaver).\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"c", "<", "0"}], "&&",
RowBox[{"d", "\[Equal]", "0"}]}], ",", " ",
"\"\<Juliet retreats from her feelings toward Romeo \\nand Romeo \
is not influencing her.\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"c", "<", "0"}], "&&",
RowBox[{"d", "<", "0"}]}], ",", " ",
"\"\<Juliet retreats from her feelings toward Romeo \\nand Romeo \
discourages her (she is a hermit).\>\"", ",", "\[IndentingNewLine]", " ",
RowBox[{
RowBox[{"c", "<", "0"}], "&&",
RowBox[{"d", ">", "0"}]}], ",", " ",
"\"\<Juliet retreats from her feelings toward Romeo \\nand Romeo \
encourages her (she is a cautious lover).\>\""}], "]"}]}], ",",
"\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"c", "\[Equal]",
RowBox[{"-", "b"}]}], " ", "&&", " ",
RowBox[{"d", " ", "\[Equal]", " ",
RowBox[{"-", "a"}]}]}], ",", " ",
RowBox[{"Text", "[", "\"\<fire and ice\>\"", "]"}], ",", " ",
RowBox[{"Sequence", " ", "@@", " ",
RowBox[{"{", "}"}]}]}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"c", "\[Equal]", "b"}], " ", "&&", " ",
RowBox[{"d", " ", "\[Equal]", " ", "a"}]}], ",", " ",
RowBox[{"Text", "[", "\"\<peas in a pod\>\"", "]"}], ",", " ",
RowBox[{"Sequence", " ", "@@", " ",
RowBox[{"{", "}"}]}]}], "]"}], ",", " ", "\[IndentingNewLine]",
RowBox[{"ParametricPlot", "[",
RowBox[{
RowBox[{"Evaluate", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"R", "[", "t", "]"}], ",", " ",
RowBox[{"J", "[", "t", "]"}]}], "}"}], "/.",
RowBox[{"nds", "[",
RowBox[{"[", "1", "]"}], "]"}]}], " ", "]"}], ",", " ",
RowBox[{"{",
RowBox[{"t", ",", " ", "0", ",", " ",
RowBox[{"nds", "[",
RowBox[{"[",
RowBox[{
"1", ",", " ", "1", ",", " ", "2", ",", " ", "1", ",", " ",
"1", ",", " ", "2"}], "]"}], "]"}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"PlotRange", " ", "\[Rule]", " ", "All"}], ",",
RowBox[{"Frame", " ", "\[Rule]", " ", "True"}], ",", " ",
RowBox[{"FrameLabel", " ", "\[Rule]", " ",
RowBox[{"{",
RowBox[{"\"\<Romeo\>\"", ",", " ", "\"\<Juliet\>\""}], "}"}]}],
",", "\[IndentingNewLine]",
RowBox[{"AspectRatio", " ", "\[Rule]", " ", "1"}], ",",
RowBox[{"ImagePadding", " ", "\[Rule]", " ", "20"}], ",",
RowBox[{"ImageSize", " ", "\[Rule]", " ",
RowBox[{"{",
RowBox[{"350", ",", "350"}], "}"}]}], ",",
"\[IndentingNewLine]",
RowBox[{"MaxRecursion", " ", "\[Rule]", " ",
RowBox[{"ControlActive", "[",
RowBox[{"Automatic", ",", " ", "8"}], "]"}]}], ",",
RowBox[{"FrameTicks", " ", "\[Rule]", " ", "None"}], ",",
"\[IndentingNewLine]",
RowBox[{"ColorFunction", " ", "\[Rule]", " ",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"ColorData", "[", "\"\<DarkRainbow\>\"", "]"}], "[",
"#", "]"}], "&"}], ")"}]}]}], "]"}]}], "\[IndentingNewLine]",
"}"}], ",",
RowBox[{"ItemSize", "\[Rule]",
RowBox[{"{",
RowBox[{"32", ",", "Automatic"}], "}"}]}]}], "]"}]}]}], "]"}], ",",
"\[IndentingNewLine]", "\"\<Romeo's own feeling\>\"", ",",
"\[IndentingNewLine]",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"a", ",", " ", "0.51", ",", " ", "\"\<\>\""}], "}"}], ",",
RowBox[{"-", "1"}], ",", " ", "1", ",", " ",
RowBox[{"ImageSize", " ", "\[Rule]", " ", "Small"}]}], "}"}], ",",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -