PredatorPrey - (* Content-type: application/mathematica *)...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 7.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 21583, 576] NotebookOptionsPosition[ 21141, 556] NotebookOutlinePosition[ 21484, 571] CellTagsIndexPosition[ 21441, 568] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Fish - Shark - Model", "Section", CellChangeTimes->{{3.466301560046875*^9, 3.46630156459375*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"f", "[", RowBox[{"x_", ",", "y_"}], "]"}], "=", RowBox[{"x", "-", RowBox[{"x", " ", "y"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"g", "[", RowBox[{"x_", ",", "y_"}], "]"}], "=", RowBox[{"0.5", RowBox[{"(", RowBox[{ RowBox[{"x", " ", "y"}], "-", "y"}], ")"}]}]}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"PlotSol", "[", RowBox[{"w0_", ",", "imagesize_"}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{"xsol", ",", "ysol"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"xsol", "[", "t_", "]"}], ",", RowBox[{"ysol", "[", "t_", "]"}]}], "}"}], "=", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"x", "[", "t", "]"}], ",", RowBox[{"y", "[", "t", "]"}]}], "}"}], "/.", RowBox[{ RowBox[{"NDSolve", "[", "\[IndentingNewLine]", RowBox[{
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"x", "'"}], "[", "t", "]"}], "\[Equal]", RowBox[{"f", "[", RowBox[{ RowBox[{"x", "[", "t", "]"}], ",", RowBox[{"y", "[", "t", "]"}]}], "]"}]}], ",", RowBox[{ RowBox[{ RowBox[{"y", "'"}], "[", "t", "]"}], "\[Equal]", RowBox[{"g", "[", RowBox[{ RowBox[{"x", "[", "t", "]"}], ",", RowBox[{"y", "[", "t", "]"}]}], "]"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"x", "[", "0", "]"}], "\[Equal]", RowBox[{ "w0", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}], ",", RowBox[{ RowBox[{"y", "[", "0", "]"}], "\[Equal]", RowBox[{ "w0", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"x", "[", "t", "]"}], ",", RowBox[{"y", "[", "t", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "15"}], "}"}]}], "]"}], "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"Plot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Tooltip", "[", RowBox[{ RowBox[{"xsol", "[", "t", "]"}], ",", "\"\<fish\>\""}], "]"}], ",", RowBox[{"Tooltip", "[", RowBox[{ RowBox[{"ysol", "[", "t", "]"}], ",", "\"\<sharks\>\""}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "15"}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "15"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "Automatic"}], "}"}]}], "}"}]}], ",", RowBox[{"PlotStyle", "\[Rule]", "Thick"}], ",", RowBox[{"Frame", "\[Rule]", "True"}], ",",
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

PredatorPrey - (* Content-type: application/mathematica *)...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online