Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question
    
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. –  Raskolnikov Aug 27 '12 at 8:28

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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 else –  Manatok Aug 27 '12 at 9:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.