TITLE: Simple lowpass frequency response
QUESTION [5 upvotes]: Okay, so hopefully this isn't too hard or off-topic. Let's say I have a very simple lowpass filter (something that smooths out a signal), and the filter object has a position variable and a cutoff variable (between 0 and 1). In every step, a value is put into the following bit of pseudocode as "input": position = position*(1-c)+input*c, or more mathematically, f(n) = f(n-1)*(1-c)+x[n]*c. The output is the value of "position." Basically, it moves a percentage of the distance between the current position and then input value, stores this value internally, and returns it as output. It's intentionally simplistic, since the project I'm using this for is going to have way too many of these in sequence processing audio in real time. 
Given the filter design, how do I construct a function that takes input frequency (where 1 means a sine wave with a wavelength of 2 samples, and .5 means a sine wave with wavelength 4 samples, and 0 is a flat line), and cutoff value (between 1 and 0, as shown above) and outputs the amplitude of the resulting sine wave? Sine wave comes in, sine wave comes out, I just want to be able to figure out how much quieter it is at any input and cutoff frequency combination.

REPLY [3 votes]: I don't have enough mojo to comment on Greg's answer.

Greg made a silly calculational mistake: The transfer function $A(\omega)$ should be $c/(1-(1-c)e^{-i\omega})$.
What you want is the modulus of $A(\omega)$. Note that $\sin \omega n$ is precisely the imaginary part of $e^{i\omega n}$. Because the relation between input and output is linear, the response to $\sin\omega n$ will be the imaginary part of $A(\omega)e^{i\omega n}$. That's going to be a sinusoid with some shifting and the amplitude $|A(\omega)|$. Here is a plot for $c=1/2$.
To read more about this sort of things, google "IIR filter" or "infinite impulse response".