Hello everyone,

I have presented below some simplified java/pseudo code that I would like to turn into an equation. I will also provide a description of what the code does for clarity.

The code calculates the response probability (response) of a receiver to an encountered signal sender (s.signal). Previously encountered signals and their perceived quality are stored in memory, a list, (memory.get(i).signal), and influence the probability of responding to a new signal (s.signal). The extent to which they influence the decision to respond to a new signal is given by the difference in their signals (s.signal - memory.get(i).signal), a gaussian weighting function, and a function of the difference between the perceived quality and the current quality (perceived - response).

So, the problem is that I have a variable 'response' that changes in a loop (the length of which is i to n, the size of the memory). I have next to no formal math education, so any help would be much appreciated.


double response = 1;

for(int i = 0; i < memory.size(); i++){
double weighting = Math.exp(- (Math.pow(s.signal - memory.get(i).signal, 2) / (2 * generalisation^2)));
response = response + (weighting * (perceived - response));