You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue addresses the definition of the FData.integrate() method for both FDataGrid and FDataIrregular objects; in particular, how this integral should be defined for any discretized functional observation.
To simplify, I will speak about $[a, b] \to \mathbb{R}$ functional observations.
How to calculate $\int_{[a, t_0]} x(t)\ dt$ and $\int_{[t_{M-1}, b]} x(t)\ dt$?
There are formulas for numeric integration when the ends of the integral are open (i.e. when either $a \neq t_0$ or $t_{M-1} \neq b)$. However, we have only found them for equally spaced grids, which is not generally our case.
Some weeks ago, I talked briefly about how we should solve this with @vnmabus and Alberto Suarez. A strong conclusion was not reached, although Alberto argued that a very simple solution is as good as any, and we did not find anything wrong with that reasoning. In that spirit, I'll write down the two options that were proposed and open the discussion of which shall be chosen (among these or other possible solutions).
Option 2: redefine the ends of the domain and integrate over the "augmented grid"
Redefine the grid to points_augmented = { $a, t_0, \dots, t_{M-1}, b$ } and $x(a) := x(t_0)$, $x(b) := x(t_{M-1})$ and compute the integral of x over $[a, b]$ as
This issue addresses the definition of the
FData.integrate()
method for bothFDataGrid
andFDataIrregular
objects; in particular, how this integral should be defined for any discretized functional observation.To simplify, I will speak about$[a, b] \to \mathbb{R}$ functional observations.
(This issue is related to #609 )
Given a discretized functional observation
x
(an element of anFDataGrid
or anFDataIrregular
object):points
= {Currently, the integral of such an observation
x
is computed with the function scipy.integrate.simpson called like this:meaning that the integral is computed over the interval$[t_0, t_{M-1}]$ . That is, we are computing
when we should be computing
So, the problem arises:
How to calculate$\int_{[a, t_0]} x(t)\ dt$ and $\int_{[t_{M-1}, b]} x(t)\ dt$ ?
There are formulas for numeric integration when the ends of the integral are open (i.e. when either$a \neq t_0$ or $t_{M-1} \neq b)$ . However, we have only found them for equally spaced grids, which is not generally our case.
Some weeks ago, I talked briefly about how we should solve this with @vnmabus and Alberto Suarez. A strong conclusion was not reached, although Alberto argued that a very simple solution is as good as any, and we did not find anything wrong with that reasoning. In that spirit, I'll write down the two options that were proposed and open the discussion of which shall be chosen (among these or other possible solutions).
Option 1: fill the ends with a constant value
Approximate the integrals as follows:
Option 2: redefine the ends of the domain and integrate over the "augmented grid"
Redefine the grid to$a, t_0, \dots, t_{M-1}, b$ } and $x(a) := x(t_0)$ , $x(b) := x(t_{M-1})$ and compute the integral of $[a, b]$ as
points_augmented
= {x
overThe text was updated successfully, but these errors were encountered: