(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 4.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[ 4414, 118]*) (*NotebookOutlinePosition[ 5090, 141]*) (* CellTagsIndexPosition[ 5046, 137]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Plotting with big numbers", "Title"], Cell["\<\ In many cases if you try to plot functions where very large numbers \ or very small numbers are involved Plot will not give a good plot of the \ function due to lack of precision. Here is an example.\ \>", "Text"], Cell[BoxData[ \(f[x_]\ := \ \(\(-\[ExponentialE]\^\(\(-4\)\ x\)\) + 3\ \[ExponentialE]\ \^\(-x\)\)\/\(\[ExponentialE]\^\(-x\) + \[ExponentialE]\^\(\(-2\)\ x\)\ \ Cos[x]\^2\)\)], "Input"], Cell[BoxData[ \(Plot[f[x], {x, 50000, 10000000}, PlotRange\ \[Rule] \ All, PlotPoints\ \[Rule] \ 60]\)], "Input"], Cell[CellGroupData[{ Cell["High precision plots", "Section"], Cell["\<\ The following function allows the points in the plot to be \ calculated with high precision. This means the rendering of the plot will be \ smooth and give a good representation of the function. The function will \ accept any of the options associated with ListPlot except PlotJoined. \ Although it might seem that increasing the number of points will give a \ better plot, there is an upper limit to this. In some cases there will be a \ maximal number of points that will work. Points which are too close together \ along the horizontal axis will not be distinguished from one another. Setting \ the value of precision to a very high number will cause the function to take \ much longer to evaluate without giving any appreciable increase in the \ accuracy of the plot.\ \>", "Text"], Cell[BoxData[ \(PrecisionPlot[func_, {var_, varmin_, varmax_}, pts_, precision_, opts___?OptionQ] := \ Module[{inc, f1, pltpts, plt}, \[IndentingNewLine]inc\ = \ \((varmax - varmin)\)/ pts; \[IndentingNewLine]f1[tt_] = If[Head[func] === Symbol, func[tt], func /. var \[Rule] tt]; \[IndentingNewLine]$MaxExtraPrecision\ = \ 2\ precision; \[IndentingNewLine]pltpts\ = \ Table[{tt, SetPrecision[f1[tt], precision]}, {tt, varmin, varmax, inc}]; \[IndentingNewLine]plt\ = If[{opts\ } =!= \ {}, ListPlot[pltpts, PlotJoined\ \[Rule] \ True, opts]\ , ListPlot[pltpts, PlotJoined\ \[Rule] \ True]]\[IndentingNewLine]]\)], "Input"], Cell[BoxData[ \(PrecisionPlot[f[x], {x, 50000, 10000000}, 60, 40, PlotRange\ \[Rule] \ All]\)], "Input"], Cell["Here we add some plot options.", "Text"], Cell[BoxData[ \(PrecisionPlot[f[x], {x, 50000, 10000000}, 800, 50, PlotRange\ \[Rule] \ All, PlotStyle\ \[Rule] \ Hue[ .7], AspectRatio\ \[Rule] \ 1]\)], "Input"] }, Open ]] }, Open ]] }, FrontEndVersion->"4.2 for Macintosh", ScreenRectangle->{{0, 1020}, {0, 746}}, ScreenStyleEnvironment->"Presentation", WindowSize->{665, 724}, WindowMargins->{{65, Automatic}, {Automatic, 0}} ] (******************************************************************* 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[CellGroupData[{ Cell[1776, 53, 42, 0, 104, "Title"], Cell[1821, 55, 223, 4, 86, "Text"], Cell[2047, 61, 191, 3, 67, "Input"], Cell[2241, 66, 126, 2, 56, "Input"], Cell[CellGroupData[{ Cell[2392, 72, 39, 0, 72, "Section"], Cell[2434, 74, 795, 12, 218, "Text"], Cell[3232, 88, 800, 15, 296, "Input"], Cell[4035, 105, 116, 2, 56, "Input"], Cell[4154, 109, 46, 0, 42, "Text"], Cell[4203, 111, 183, 3, 76, "Input"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)