3
$\begingroup$

If I have a function

$f(t) = y$

where $t$ & $y$ are positive Integers

for $t = \{1,2,3,4,5,6,7,8\} \to y = \{1,1,1,2,1,2,3,1\}$

How can I create a function $g(y)$ such that it counts the number of times a value of $y$ occurs. For instance if we used the above data $g(y)$ would be the following:

$g(y) = \{5, 2, 1, 0\}$ for the $y$ values $\{1,2,3,4\}$

Once I have this I need to represent this as a function $k(t) = \max R$

$R = y * g(y) + y * g(y+1) + y * g(y+2)...+ y * g(y+n)$

for all values $g(y+n) > 0$.

Please can someone help me represent $k(t)$ more mathematically. Would something like the Discrete time Fourier Transform help with $f(t) \Longrightarrow g(y)$

Thanks a mill

  • 0
    Do you need that for a program? If it's just a mathematical definition you need for $g$, a definition in words is perfectly fine.2012-08-27

1 Answers 1

1

One way you could do this is with the Kronecker delta function, then you can define $g$ as follows

$g(y)=\sum_{k\in t} \delta_{y,f(k)}$

with $t=\{1,2,3,\ldots,8\}$ or whatever your domain for $f$ is.

Taking your example, suppose you want to compute $g(1)$, then you add up all the $\delta_{1,f(k)}$ for all $k \in t$. But since $f(k)=1$ only 5 times, the $\delta_{1,f(k)}$ will be equal to $1$ only 5 times and all other times it will be $0$. Therefore the sum is $5$, which is indeed what we want.

  • 0
    Thanks for this, I ended up creating my own version of this Kronecker delta function :) (((x-y)/(y-x))+1)/2 This gives me 1 when x=y and 0 for anything else2012-08-27