Is there a differentiable function y which can approximate the following scenario:
If x in {1, 2, 3, 4, 5}, then y = x; else y = some very big negative number, eg -9e^20.
Essentially, there are five impulse responses at x=1, x=2, x=3, x=4, and x=5 that are scaled by x. (The scaling part is not that important, I don't think.)
Background info that I do NOT think is relevant: I'm trying to solve a (non-linear least-squares) optimization problem for a function f in which function f has, as one component, equation y which requires the variable x to be either 1, 2, 3, 4, or 5 (ie whole numbers in the set 1 to 5 inclusive)
Also, if it makes it easier, we do NOT need to handle the situation x < 1 or x > 5 (that is, y can be any value in those regions), since I can arbitrarily "trap" for that scenario in my optimization routine gradient calculations to set the y value to a very large negative number (eg -9e20), if it see an x value below say 0.9 or above say 5.1
Also, if it makes it easier, the "very big negative number" need not be constant...it just need to "very very negative" whenever x is NOT in {1,2,3,4,5}
The last paragraph implies that it can't be done. If $f$ is differentiable (hence continuous) and $f(1)=1$, then there is an $\epsilon>0$ such that $f(x)\ge1/2$ for all $x\in(1-\epsilon,1+\epsilon)$.
However, given any small $\epsilon>0$, there are $C^\infty$ functions $f$ with $f(x)=x$ for $x=1,2,3,4,5$ and $F(x)$ a very big negative number on open intervals $(x+\epsilon,x+1-\epsilon)$ for $x=1,2,3,4$.