At present I am writing a scientific paper and have problems bringing source code into mathematical form.
I have a time series that I present in Python as a list of tuples. For example:
timeseries = [(datetime_1, 1.0),(datetime_2, 2.0),...,(datetime_999, 999.0)]
For these I calculate, for example, the area between two points in time using the area content formula for trapezoids:
for i in range(0, len(timeseries)):
area.append(0.5 * (timeseries[i][1] + timeseries[i+1][1])
* (ticks(timeseries[i+1][0]) - ticks(timeseries[i][0])))
However, I would like to do my scientific work without source code in it. How can this best be formulated in a scientific thesis with mathematical tools?
My approach was to describe the list of tuples with two mathematical vectors:
$\pmb{x}_{dates} \in \mathbb{R}^n$ with $x_i$ which represents the miliseconds from 1970 and $\pmb{x}_{values} \in \mathbb{R}^n$ with $x_i$ which represent the corresponding values. Then we have a vector $\pmb{a}$ with: $$\Big\{\Big(\frac{1}{2} * (x_i^{values} + x_{i+1}^{values}) * (x_{i+1}^{dates} - x_{i}^{dates})\Big), ...,\Big(\frac{1}{2} * (x_{n-1}^{values} + x_{n}^{values}) * (x_{n}^{dates} - x_{n-1}^{dates})\Big)\Big\}$$
Is my approach okay? How would you do that?