0

So I'm working with functions with compact support, like:

k(r)=s-r, for 0<= r<= s, 0 elsewhere.

Note that $k$ has a point of non-differentiability.

I'm trying to make a function k_\epsilon that's as close to $k$ as possible, is smooth, has the same or just a tiny bit of more support (i.e. closure of the set where k_\epsilon doesn't vanish) so one can use convolution with a mollifier to smoothen it without changing it much; see e.g. Theorem 9 and 11 here.

enter image description here

enter image description here

But I was planning to code this and convolution may not be the best when it comes to coding, so I was looking for a shortcut to find another but similar such smooth function, let's call it k_\epsilon again, so that support(k_\epsilon)=support(k) + epsilon = [0, s+epsilon] and that |k_\epsilon-k|\to 0, \text{as} \epsilon\to 0. Is there an algorithm for the same? A code in either Python on R would be great too. Thank you!

  • 2
    Keep in mind that StackOverflow focuses on programming problems. Maybe your question is more on-topic on math.stackexchange.com? – Nico Haase Jul 05 '23 at 09:07
  • @NicoHaase I tried on cross validated, but they closed my question as it was coding oriented.. – Noprogexprnce mathmtcn Jul 05 '23 at 09:11
  • The convolution they suggest is just the mathy way of expressing what would be called a "gaussian blur" in the domain of image processing, or an "average" in layman's terms. Just replace f(x) with the average of f in the neighbourhood of x. – Stef Jul 05 '23 at 09:57
  • 1
    There is already one vote to close. I wish I could vote-to-not-close but sadly there is no such thing. I'll vote to reopen if it's closed for no good reason. – Stef Jul 05 '23 at 09:58
  • Note that how to compute this average of f in the neighbourhood of x depends on how your function f is defined, programmatically. Is it given as a big list of values, like an array for values of x and another array for corresponding values of f(x)? Or is the function given by a formula? – Stef Jul 05 '23 at 09:59
  • If it's an array of values, you could use scipy's convolve: https://docs.scipy.org/doc/scipy/reference/signal.html ; Also see this related question: https://stackoverflow.com/questions/20618804/how-to-smooth-a-curve-for-a-dataset – Stef Jul 05 '23 at 10:01
  • 1
    @Stef Thank you, let me check these links you provided! – Noprogexprnce mathmtcn Jul 05 '23 at 10:07

0 Answers0