0
|
8477 Views
|
10 Replies
|
6 Total Likes
View groups...
Share
GROUPS:

# What is the default rule of Integration for Mathematica?

Posted 9 years ago
 Hello all, I was using RungeKutta 4th Order Method for my equation. So, if I just integrate without specifying the rule or method, what is the default rule that Mathematica use?
10 Replies
Sort By:
Posted 9 years ago
 Yes, Michael Rogers, that is what I did. I cannot find the function for integrate the InterpolatingFunction, so I just copy the command give by the "Automatic Options". I'm able to find the area under the graph of the InterpolatingFunction, but unable to choose specific method or rule. My predecessor used the Simpson's Rule for the rules of definite integrals. So, now I need to know which rule that Mathematica choose from the rules of definite integrals (there's quiet a few, searched in Wikipedia).
Posted 9 years ago
 Integrate integrates the polynomials symbolically and evaluates them at the endpoints of their subintervals; the result of integrating a standard order-3 InterpolatingFunction will be an order-4 InterpolatingFunction, with the degree-4 polynomials being the integrals of the degree-3 polynomials satisfying the appropriate initial conditions. It does not use a numerical method at all.
Posted 9 years ago
 I apologize if I misunderstand some points.The first integration will be the of the piecewise polynomial equation. Then produces InterpolatingFunction, which is also a symbolic function. I am able to obtain the numerical value with the options given, from the option "Evaluate at point 3"Then the InterpolatingFunction is an order-4 InterpolatingFunction?, the integration will be an order-5?The Integration of the InterpolatingFunction is use to find the area under the graph for the InterpolatingFunction, which was similar to Simpson's Rule or Riemann Integral or others.Or do you mean "Integrate integrates the polynomials symbolically and evaluates them at the endpoints of their subintervals; ", it follows the 4th Order RungeKutta Method and the subintervals is also 1/100?Sorry if I seems to behave not professional with all these questions.
Posted 9 years ago
 No problem.Here are the steps I have in mind: NDSolve produces y -> InterpolatingFunction[..]. The InterpolatingFunction will be order 3. Order 3 means the interpolation consists of piecewise degree-3 polynomials that interpolate between the steps of the solution computed by NDSolve. If you integrate the solution with intsol = Integrate[y[x] /. First[sol], x], where sol = NDSolve[..] is the solution, then intsol, the value of the result of Integrate, will be of the form InterpolatingFunction[..][x], where the interpolating function is an order-4 interpolation, which consists of piecewise degree-4 polynomials that are the integrals of the degree-3 polynomials in the solution. There is no second application of Integrate that I have in mind. If you want to use Integrate twice, then the order increases by one at each step.By "the appropriate initial conditions", I mean on each subinterval ${(x_{j-1}, x_j)}$, Integrate performs the integral $$I_{j-1} + \int_{x_{j-i}}^x p_j(t) \; dt$$where the initial value $I_{j-1}$ is the accumulation the integrals over the preceding intervals..
Posted 9 years ago
 Thank you Michael Rogers, this have given me an idea of how the integration works.It's just that, for integrations without using Mathematica, we would use Simpson's Rules or Trapeziodal rule for integration for numerical integration, to obtain the value for the initial value before it. But in Mathematica without numerical integration, the InterpolatingFunction only show a graph or a plot (without any polynomials shown). Well I did obtain an accurate value for the integration of the InterpolatingFunction.There's the set of rules in Mathematica for integration. So, now I need to know which is the correct integration rule that is default for Mathematica.tutorial/NIntegrateIntegrationRulesI believe Mathematica automatic chooses the rule for the Integration, so what command do I need to type to find out which method it used?
Posted 9 years ago
 If I understand what you did, Integrate, the symbolic integrator, was applied to the InterpolatingFunction. The interpolating function is basically a piecewise polynomial function (defined by data computed by NDSolve). Integrate effectively integrates each polynomial using the power rule and the rules of definite integrals, returning a function f such that f[x] equals the integral of the solution from the beginning of the domain up to x. It does not use numerical techniques.
Posted 9 years ago
 Sorry for the confusion, here's what I did. I NDSolve the equation with 4th Order RungeKutta Method  In:= z = 1 ClassicalRungeKuttaCoefficients[4, prec_] := With[{amat = {{1/2}, {0, 1/2}, {0, 0, 1}}, bvec = {1/6, 1/3, 1/3, 1/6}, cvec = {1/2, 1/2, 1}}, N[{amat, bvec, cvec}, prec]] NDSolve[{Derivative[y][x] == Piecewise[{{(y[x] + x^2 + z), 0 <= x <= 1}, {(y[x] + x^2 + 2 z), 1 <= x <= 2}, {(y[x] + x^2 + 3 z), 2 <= x <= 3}}] , y == 0.0}, y, {x, 0., 3}, Method -> {"ExplicitRungeKutta", "DifferenceOrder" -> 4, "Coefficients" -> ClassicalRungeKuttaCoefficients}, "StartingStepSize" -> 1/100] Out= 1 Out= {{y -> InterpolatingFunction[{{0., 3.}}, <>]}} Then I chose the option "Get Solution" In:= %39[[1, 1, 2]] Out= InterpolatingFunction[{{0., 3.}}, <>] After that, there's another option, "Integrate", that's where the new integration result show up. The thing is, the code in the notebook and posted here is different. I would like to know does this new integration chose the previous integration method done, the 4th Order RungeKutta Method? or Mathematica chose another method? In:= \!$$\*SuperscriptBox[\(%40$$, TagBox[ RowBox[{"(", RowBox[{"-", "1"}], ")"}], Derivative], MultilineFunction->None]\) Out= InterpolatingFunction[{{0., 3.}}, <>][#1] & Posted 9 years ago
 I'm not sure I understand your code or what (1) and (2) above means. So, what is the automatic default rule for this integration? From the manual, there's "Trapezoidal Rule", "Multipanel Rule" and so on. How do I know which rule that Mathematica chose? Sometimes there's a way to tell which numerical method Mathematica used by using a trace of some kind. Usually there isn't. The method chosen might be a mixture of multiple methods or could even be a method not documented. It could be anything. If you don't specify a value for the "Method" option, the function is free to do whatever it wants to try and solve your problem. It doesn't try to communicate what it did to solve it - often what it did isn't straightforward enough anyway. If you want to try to examine the output of the function, you can sometimes determine what numerical method was used, although I don't recommend it. http://mathematica.stackexchange.com/questions/145/how-to-find-out-which-method-mathematica-selected
Posted 9 years ago
 Here's what I have done,1) I try used f = NDSolve specified using RungeKutta 4th Order Method. 2) There's an option that have option to integrate "f" for me and I just chose the option to integrate again. \!$$\*SuperscriptBox[\(f[\([$$$$1, 1, 2$$$$]$$]\), TagBox[ RowBox[{"(", RowBox[{"-", "1"}], ")"}], Derivative], MultilineFunction->None]\) Then I obtain the answer for "f" integrated another time.So, what is the automatic default rule for this integration? From the manual, there's "Trapezoidal Rule", "Multipanel Rule" and so on. How do I know which rule that Mathematica chose?
Posted 9 years ago
 The default is a complicated set of rules and heuristics that picks a numerical method. This is basically true for any function which has a "Method" option. NDSolve tries hard to pick the best numerical method for the problem you give it. It's always good to try running NDSolve with different numerical methods.