(***********************************************************************

                    Mathematica-Compatible Notebook

This notebook can be used on any computer system with Mathematica 4.0,
MathReader 4.0, or any compatible application. 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[      8629,        249]*)
(*NotebookOutlinePosition[     11680,        347]*)
(*  CellTagsIndexPosition[     11401,        332]*)
(*WindowFrame->Normal*)



Notebook[{
Cell[TextData[{
  "NumericalMath",
  StyleBox["`", "MB"],
  "NIntegrateInterpolatingFunct",
  StyleBox["`", "MB"]
}], "Subsection",
  CellTags->{"S5.85.1", "1.1"}],

Cell[TextData[{
  "The ",
  StyleBox["Mathematica", "TI"],
  " function ",
  StyleBox["NIntegrate", "MR"],
  " uses algorithms that assume that the integrand is smooth to at least \
several orders. ",
  StyleBox["InterpolatingFunction", "MR"],
  " objects typically do not satisfy this assumption; they are continuous, \
but only piecewise smooth. The algorithms used by ",
  StyleBox["NIntegrate", "MR"],
  " converge very slowly when applied to ",
  StyleBox["InterpolatingFunction", "MR"],
  " objects, especially in several dimensions. ",
  StyleBox["NIntegrate", "MR"],
  " allows the domain of integration to be broken up into several pieces and \
the integral evaluated over each piece. If the pieces of the domain \
correspond to the pieces over which the ",
  StyleBox["InterpolatingFunction", "MR"],
  " is smooth, ",
  StyleBox["NIntegrate", "MR"],
  " will converge much more rapidly. ",
  StyleBox["NIntegrateInterpolatingFunction", "MR"],
  " automatically breaks up the domain of integration. "
}], "Text",
  CellTags->{"S5.85.1", "1.2"}],

Cell[BoxData[
    FormBox[
      StyleBox[
        FrameBox[
          StyleBox[GridBox[{
                {
                  
                  RowBox[{"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"\
NIntegrateInterpolatingFunction[\\\\\\\"\\\", \
\\\"MR\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\"expr\\\\\\\"\\\", \
\\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \
\"\>", 
                    StyleBox["{",
                      
                      "InlineFormula"], \
"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"x\\\\\\\"\\\", \
\\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \\!\
\\(\\*StyleBox[\\\"\\\\\\\"xmin\\\\\\\"\\\", \\\"TI\\\"]\\)\\!\\(\\*StyleBox[\
\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \
\\!\\(\\*StyleBox[\\\"\\\\\\\"xmax\\\\\\\"\\\", \\\"TI\\\"]\\)\"\>", 
                    StyleBox["}",
                      
                      "InlineFormula"], \
"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"]\\\\\\\"\\\", \\\"MR\\\"]\\) \"\>"}], "\<\
\"find a numerical approximation to an integral with \\!\\(\\*StyleBox[\\\"\\\
\\\\\"InterpolatingFunction\\\\\\\"\\\", \\\"MR\\\"]\\) objects in the \
integrand\"\>"},
                {
                  
                  RowBox[{"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"\
NIntegrateInterpolatingFunction[\\\\\\\"\\\", \
\\\"MR\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\"expr\\\\\\\"\\\", \
\\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \
\"\>", 
                    StyleBox["{",
                      
                      "InlineFormula"], \
"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"x\\\\\\\"\\\", \
\\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \\!\
\\(\\*StyleBox[\\\"\\\\\\\"xmin\\\\\\\"\\\", \\\"TI\\\"]\\)\\!\\(\\*StyleBox[\
\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \
\\!\\(\\*StyleBox[\\\"\\\\\\\"xmax\\\\\\\"\\\", \\\"TI\\\"]\\)\"\>", 
                    StyleBox["}",
                      
                      "InlineFormula"], \
"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \"\>", 
                    StyleBox["{",
                      
                      "InlineFormula"], \
"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"y\\\\\\\"\\\", \
\\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \\!\
\\(\\*StyleBox[\\\"\\\\\\\"ymin\\\\\\\"\\\", \\\"TI\\\"]\\)\\!\\(\\*StyleBox[\
\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \
\\!\\(\\*StyleBox[\\\"\\\\\\\"ymax\\\\\\\"\\\", \\\"TI\\\"]\\)\"\>", 
                    StyleBox["}",
                      
                      "InlineFormula"], \
"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \[Ellipsis] \
\\!\\(\\*StyleBox[\\\"\\\\\\\"]\\\\\\\"\\\", \\\"MR\\\"]\\) \"\>"}], \
"\<\"find a numerical approximation to a multidimensional integral with \
\\!\\(\\*StyleBox[\\\"\\\\\\\"InterpolatingFunction\\\\\\\"\\\", \
\\\"MR\\\"]\\) objects in the integrand\"\>"}
                },
              ColumnAlignments->{Right, Left}],
            GridBoxOptions->{RowLines->False}]],
        "2ColumnBox"], TraditionalForm]], "Text",
  CellTags->{"S5.85.1", "1.3"}],

Cell[TextData[{
  "Numerical approximations to integrals with ",
  StyleBox["InterpolatingFunction", "MR"],
  " objects in the integrand. "
}], "Caption",
  CellTags->"S5.85.1"],

Cell[TextData[{
  StyleBox["NIntegrateInterpolatingFunction", "MR"],
  " uses the function ",
  StyleBox["NIntegrate", "MR"],
  ", but it breaks up the domain into sections where the ",
  StyleBox["InterpolatingFunction", "MR"],
  " object is smooth. "
}], "Text",
  CellTags->{"S5.85.1", "1.4"}],

Cell["This loads the package. ", "MathCaption",
  CellTags->{"S5.85.1", "1.5"}],

Cell["<<NumericalMath`NIntegrateInterpolatingFunct`", "Input",
  CellLabel->"In[1]:= ",
  CellTags->"S5.85.1"],

Cell[TextData[{
  "This creates an ",
  StyleBox["InterpolatingFunction", "MR"],
  " object approximating the sine function. "
}], "MathCaption",
  CellTags->{"S5.85.1", "1.6"}],

Cell[CellGroupData[{

Cell["sin = Interpolation[Table[{x,Sin[x]},{x,0,4,.5}]]", "Input",
  CellLabel->"In[2]:= ",
  CellTags->"S5.85.1"],

Cell[BoxData[
    TagBox[\(InterpolatingFunction[{{0.`, 4.`}}, "<>"]\),
      False,
      Editable->False]], "Output",
  CellLabel->"Out[2]= ",
  CellTags->"S5.85.1"]
}, Open  ]],

Cell["\<\
This list gives the time used to evaluate the integral plus the \
result of the integral. \
\>", "MathCaption",
  CellTags->{"S5.85.1", "1.7"}],

Cell[CellGroupData[{

Cell["\<\
NIntegrateInterpolatingFunction[sin[x^2]^2,
 {x,0,2}] // Timing\
\>", "Input",
  CellLabel->"In[3]:= ",
  CellTags->"S5.85.1"],

Cell[BoxData[
    \({0.050000000000000044`\ Second, 0.7157917129566476`}\)], "Output",
  CellLabel->"Out[3]= ",
  CellTags->"S5.85.1"]
}, Open  ]],

Cell[TextData[{
  StyleBox["NIntegrate", "MR"],
  " produces almost exactly the same result, but takes much longer because \
the convergence is poor if the domain is not properly broken up. "
}], "MathCaption",
  CellTags->{"S5.85.1", "1.8"}],

Cell[CellGroupData[{

Cell["NIntegrate[sin[x^2]^2, {x,0,2}] // Timing", "Input",
  CellLabel->"In[4]:= ",
  CellTags->"S5.85.1"],

Cell[BoxData[
    \({0.030000000000000027`\ Second, 0.7157915564454694`}\)], "Output",
  CellLabel->"Out[4]= ",
  CellTags->"S5.85.1"]
}, Open  ]],

Cell[TextData[{
  "If you simply need to find the integral of an ",
  StyleBox["InterpolatingFunction", "MR"],
  " object (as opposed to a function of one), it is better to use ",
  StyleBox["Integrate", "MR"],
  " because this gives you the result which is exact for the polynomial \
approximation used in the ",
  StyleBox["InterpolatingFunction", "MR"],
  " object. "
}], "Text",
  CellTags->{"S5.85.1", "1.9"}]
},
FrontEndVersion->"4.0 for X",
ScreenRectangle->{{0, 800}, {0, 600}},
WindowSize->{520, 455},
WindowMargins->{{140, Automatic}, {Automatic, 72}},
StyleDefinitions -> "HelpBrowser.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->{
  "S5.85.1"->{
    Cell[1717, 49, 163, 6, 70, "Subsection",
      CellTags->{"S5.85.1", "1.1"}],
    Cell[1883, 57, 1053, 25, 70, "Text",
      CellTags->{"S5.85.1", "1.2"}],
    Cell[2939, 84, 3103, 66, 70, "Text",
      CellTags->{"S5.85.1", "1.3"}],
    Cell[6045, 152, 177, 5, 70, "Caption",
      CellTags->"S5.85.1"],
    Cell[6225, 159, 296, 8, 70, "Text",
      CellTags->{"S5.85.1", "1.4"}],
    Cell[6524, 169, 79, 1, 70, "MathCaption",
      CellTags->{"S5.85.1", "1.5"}],
    Cell[6606, 172, 110, 2, 70, "Input",
      CellTags->"S5.85.1"],
    Cell[6719, 176, 177, 5, 70, "MathCaption",
      CellTags->{"S5.85.1", "1.6"}],
    Cell[6921, 185, 114, 2, 70, "Input",
      CellTags->"S5.85.1"],
    Cell[7038, 189, 167, 5, 70, "Output",
      CellTags->"S5.85.1"],
    Cell[7220, 197, 153, 4, 70, "MathCaption",
      CellTags->{"S5.85.1", "1.7"}],
    Cell[7398, 205, 136, 5, 70, "Input",
      CellTags->"S5.85.1"],
    Cell[7537, 212, 134, 3, 70, "Output",
      CellTags->"S5.85.1"],
    Cell[7686, 218, 242, 5, 70, "MathCaption",
      CellTags->{"S5.85.1", "1.8"}],
    Cell[7953, 227, 106, 2, 70, "Input",
      CellTags->"S5.85.1"],
    Cell[8062, 231, 134, 3, 70, "Output",
      CellTags->"S5.85.1"],
    Cell[8211, 237, 414, 10, 70, "Text",
      CellTags->{"S5.85.1", "1.9"}]},
  "1.1"->{
    Cell[1717, 49, 163, 6, 70, "Subsection",
      CellTags->{"S5.85.1", "1.1"}]},
  "1.2"->{
    Cell[1883, 57, 1053, 25, 70, "Text",
      CellTags->{"S5.85.1", "1.2"}]},
  "1.3"->{
    Cell[2939, 84, 3103, 66, 70, "Text",
      CellTags->{"S5.85.1", "1.3"}]},
  "1.4"->{
    Cell[6225, 159, 296, 8, 70, "Text",
      CellTags->{"S5.85.1", "1.4"}]},
  "1.5"->{
    Cell[6524, 169, 79, 1, 70, "MathCaption",
      CellTags->{"S5.85.1", "1.5"}]},
  "1.6"->{
    Cell[6719, 176, 177, 5, 70, "MathCaption",
      CellTags->{"S5.85.1", "1.6"}]},
  "1.7"->{
    Cell[7220, 197, 153, 4, 70, "MathCaption",
      CellTags->{"S5.85.1", "1.7"}]},
  "1.8"->{
    Cell[7686, 218, 242, 5, 70, "MathCaption",
      CellTags->{"S5.85.1", "1.8"}]},
  "1.9"->{
    Cell[8211, 237, 414, 10, 70, "Text",
      CellTags->{"S5.85.1", "1.9"}]}
  }
*)

(*CellTagsIndex
CellTagsIndex->{
  {"S5.85.1", 9254, 266},
  {"1.1", 10551, 301},
  {"1.2", 10645, 304},
  {"1.3", 10735, 307},
  {"1.4", 10825, 310},
  {"1.5", 10914, 313},
  {"1.6", 11009, 316},
  {"1.7", 11105, 319},
  {"1.8", 11201, 322},
  {"1.9", 11297, 325}
  }
*)

(*NotebookFileOutline
Notebook[{
Cell[1717, 49, 163, 6, 70, "Subsection",
  CellTags->{"S5.85.1", "1.1"}],
Cell[1883, 57, 1053, 25, 70, "Text",
  CellTags->{"S5.85.1", "1.2"}],
Cell[2939, 84, 3103, 66, 70, "Text",
  CellTags->{"S5.85.1", "1.3"}],
Cell[6045, 152, 177, 5, 70, "Caption",
  CellTags->"S5.85.1"],
Cell[6225, 159, 296, 8, 70, "Text",
  CellTags->{"S5.85.1", "1.4"}],
Cell[6524, 169, 79, 1, 70, "MathCaption",
  CellTags->{"S5.85.1", "1.5"}],
Cell[6606, 172, 110, 2, 70, "Input",
  CellTags->"S5.85.1"],
Cell[6719, 176, 177, 5, 70, "MathCaption",
  CellTags->{"S5.85.1", "1.6"}],

Cell[CellGroupData[{
Cell[6921, 185, 114, 2, 70, "Input",
  CellTags->"S5.85.1"],
Cell[7038, 189, 167, 5, 70, "Output",
  CellTags->"S5.85.1"]
}, Open  ]],
Cell[7220, 197, 153, 4, 70, "MathCaption",
  CellTags->{"S5.85.1", "1.7"}],

Cell[CellGroupData[{
Cell[7398, 205, 136, 5, 70, "Input",
  CellTags->"S5.85.1"],
Cell[7537, 212, 134, 3, 70, "Output",
  CellTags->"S5.85.1"]
}, Open  ]],
Cell[7686, 218, 242, 5, 70, "MathCaption",
  CellTags->{"S5.85.1", "1.8"}],

Cell[CellGroupData[{
Cell[7953, 227, 106, 2, 70, "Input",
  CellTags->"S5.85.1"],
Cell[8062, 231, 134, 3, 70, "Output",
  CellTags->"S5.85.1"]
}, Open  ]],
Cell[8211, 237, 414, 10, 70, "Text",
  CellTags->{"S5.85.1", "1.9"}]
}
]
*)




(***********************************************************************
End of Mathematica Notebook file.
***********************************************************************)

