(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 7013, 217]*) (*NotebookOutlinePosition[ 7758, 243]*) (* CellTagsIndexPosition[ 7714, 239]*) (*WindowFrame->Normal*) Notebook[{ Cell[TextData[{ StyleBox["\n28 Sept. 2006\n\n", FontWeight->"Bold"], StyleBox["Using Mathematica: some common, powerful tools\n\nD. D gives the \ first partial derivative. For Example D[Wi, ai] gives the first partial \ derivative of Wi (fitness) with respect to ai (allocation to male function). \ \n\nIf you write: firstder = D[Wi, ai]\n\nYou will define \ \[OpenCurlyDoubleQuote]firstder\[CloseCurlyDoubleQuote] as the first partial \ derivative of Wi with respect to ai\n\nReduce. Reduce is used to solve \ equalities (you can also use Solve). I use it often for solving for the case \ where the first derivative is equal to zero. For example,\n\n\ Reduce[firstder==0, ai]\n\ngives the solution(s) for when the first \ derivative is equal to zero. \n\n(Note the use of the \"==\" when using \ reduce. you need to type in the double equal signs of mathematica will beep \ at you.)\nAlso note the use of brackets [ ] for mathematical functions. \ You can't use them for anything else. they must be used for all operations.\n\ \nFullSimplify. FullSimplify simplifies complex algebraic expressions. For \ example\nFullSimplify[Wi] simplifies Wi (e.g. cancels out terms). \n\nonce I \ define a variable, such as Wi, mathematica will remember it. But you can set \ it back to an underfined state by typing\n\nWi=.\n\nPlot. Plot[Wi, {ai, 0, \ 1}] gives a plot of fitness against allocation. But remember, all variables \ other than ai will need to be defined. \n\nLimit. Let z be defined in terms \ of n. \n\nLimit[z, n->\[Infinity]] gives the limit of the value for z as n \ goes to infinity.\n\nNote, to convert a cell to a non-executable note to \ yourself (like this cell), go to \"format, style, text\" To change back to \ an imput cell, go to \"format, style, input\"\n", FontSize->14, FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell["\<\ The color blocks below are called cells. To execute a cell, but \ the cursor in the cell, and press \"shift-return\"\ \>", "Text", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(y\ = \ c\ x\^2\)], "Input"], Cell[TextData[{ "Now we ask ", StyleBox["Mathematica", FontSlant->"Italic"], " to take the first partial derivative of y with respect to x. by taking \ the partial derivative, all variable other than x are considered to be \ constants. " }], "Text", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(firstder = D[y, \ x]\)], "Input"], Cell["\<\ below we simplify the first derivative. (but nothing happens as it \ is in its simplest form.) \ \>", "Text", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(FullSimplify[firstder]\)], "Input"], Cell["\<\ Now we take the derivative of the first derivative to get the \ second derivative.\ \>", "Text", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(secondder = \ D[firstder, \ x]\)], "Input"], Cell[TextData[{ "Now we solve for the case where the first derivative is equal to 1. \ check to see if ", StyleBox["Mathematica", FontSlant->"Italic"], " go it right." }], "Text", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(Reduce[firstder \[Equal] \ 1]\)], "Input"], Cell["\<\ Reduce can also deal with inequalities. below we solve for \ conditions from which the second derivative is negative. \ \>", "Text", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(Reduce[secondder < 0]\)], "Input"], Cell["\<\ Here is an example of how to plot a graph of x against y\ \>", \ "Text", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[{ \(\(c = 2;\)\), "\[IndentingNewLine]", \(Plot[y, \ {x, \ 0, \ 10}]\)}], "Input"], Cell[BoxData[ \(Now\ set\ c\ back\ to\ a\ variable\ by\ type\ c =. \)], "Text", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(\(\(c =. \)\(\[IndentingNewLine]\) \)\)], "Input"], Cell[BoxData[ \(Now\ lets\ plot\ y\ as\ a\ function\ of\ both\ x\ and\ \(\(c\)\(.\)\(\ \ \ \)\)\)], "Text", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(Plot3D[y, \ {x, \ 0, \ 100}, \ {c, \ 0, \ 5}]\)], "Input"], Cell[BoxData[ \(Okay, \ let' s\ \ set\ y, \ firstder\ and\ secondder\ back\ to\ \(\(variables\)\(.\)\(\ \ \)\)\)], \ "Text", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[{ \(y =. \), "\[IndentingNewLine]", \(firstder =. \), "\[IndentingNewLine]", \(secondder =. \)}], "Input"], Cell[BoxData[ \(y = c\ x\^2\)], "Input"], Cell[TextData[StyleBox["the below gives the total derivative, where c is not \ a constant.", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]]], "Text"], Cell[BoxData[ \(totfirstder = Dt[y, x]\)], "Input"], Cell[TextData[StyleBox["Below is an example of using Limits in Mathematica", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]]], "Text"], Cell[BoxData[ \(z = \ \((1\ - \ 1\/n)\)\^n\)], "Input"], Cell[BoxData[ \(Limit[z, \ n \[Rule] \[Infinity]]\)], "Input"], Cell[BoxData[ \(z = \ \((1\ - \ s)\)\^\(1/s\)\)], "Input"], Cell[BoxData[ \(Limit[z, \ s \[Rule] 0]\)], "Input"] }, FrontEndVersion->"5.2 for Macintosh", ScreenRectangle->{{4, 1280}, {0, 832}}, WindowSize->{1123, 747}, WindowMargins->{{60, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, Magnification->2, StyleDefinitions -> "Classroom.nb" ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1754, 51, 1894, 29, 1856, "Text"], Cell[3651, 82, 195, 5, 88, "Text"], Cell[3849, 89, 48, 1, 95, "Input"], Cell[3900, 92, 315, 9, 88, "Text"], Cell[4218, 103, 53, 1, 93, "Input"], Cell[4274, 106, 175, 5, 54, "Text"], Cell[4452, 113, 55, 1, 93, "Input"], Cell[4510, 116, 160, 5, 54, "Text"], Cell[4673, 123, 63, 1, 93, "Input"], Cell[4739, 126, 245, 8, 88, "Text"], Cell[4987, 136, 62, 1, 93, "Input"], Cell[5052, 139, 198, 5, 88, "Text"], Cell[5253, 146, 54, 1, 93, "Input"], Cell[5310, 149, 136, 5, 54, "Text"], Cell[5449, 156, 104, 2, 124, "Input"], Cell[5556, 160, 137, 3, 49, "Text"], Cell[5696, 165, 74, 2, 124, "Input"], Cell[5773, 169, 165, 4, 49, "Text"], Cell[5941, 175, 78, 1, 93, "Input"], Cell[6022, 178, 187, 5, 49, "Text"], Cell[6212, 185, 133, 3, 155, "Input"], Cell[6348, 190, 44, 1, 95, "Input"], Cell[6395, 193, 156, 3, 54, "Text"], Cell[6554, 198, 55, 1, 93, "Input"], Cell[6612, 201, 140, 2, 54, "Text"], Cell[6755, 205, 60, 1, 122, "Input"], Cell[6818, 208, 66, 1, 93, "Input"], Cell[6887, 211, 63, 1, 95, "Input"], Cell[6953, 214, 56, 1, 93, "Input"] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)