0

I would like to calculate an integral, which is determined by two functions: I(T) = ∫0T i( f(t), g(t)) dt where f and g solves ordinary differential equations and i is known.

The obvious approach would be to derive a differential equation for I and the solve it alongside f and g (which can be done, but is numerically expensive in my case). In my case, however, f solves an equation with an initial condition f(0) and g and equation with a final condition g(T).

My best guess at the moment would be to solve f and g on a grid using a standard ODE solver and then use a standard method for numerical integration with equally spaced t-coordinates or some kind of quadrature rule (basically anything described by Numerical Recipes).

Does anyone have a better solution? That is, a method that takes the specific type of ode solver and its accuracy into account.

1 Answers1

0

Many advanced ODE solvers come with a feature called "dense output". The ODE solver gives you not only the values of f and g on a grid (as specified beforehand), but allows you to use its result to find the values at any time. Combining this with an adaptive quadrature rule should give you an answer to whatever precision you need.

Jitse Niesen
  • 4,492
  • 26
  • 23
  • Yes, I guess that is a good idea. One could probably even use a quadrature rule adapted to the function used in the stepper. It will never be more accurate than the solution of the ODEs, so the order of the quadrature and the accuracy of the ODE solver needs to be aligned I guess. – S. Gammelmark May 03 '13 at 10:37