All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Super-smooth hump (Posted on 2006-10-24)

You want to modify the functions fn(x)=xn (n = 1, 2, 3, ...) in the following way: Outside the interval [-1,1] the functions should remain completely unchanged. At zero, the new functions should be 1 (instead of 0). And the most important requirement: The functions should remain continuously differentiable infinitely many times, everywhere.

You can achieve this by adding a "hump" function to fn. But not any function will do: For instance, you cannot add a Gaussian exp(-x2), because that would change fn outside the interval [-1,1]. You also cannot add a sine hump, (0.5 + 0.5*sin(π x)) for x in [-1,1] and 0 otherwise, because the second derivative would become discontinuous at -1 and 1. Find a hump function which will do the trick.

 No Solution Yet Submitted by vswitchs Rating: 4.3333 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 My Way | Comment 4 of 9 |
Step I: Make a bump with sharp corners.  Let f(x) be defined as x  for x>0 and as 0 for all other real x. Then f(x+1) is f shifted left by 1 and f(1-x) is f reversed and shifted right by 1.  Thus g(x) defined as f(x+1)f(1-x) is equal to 1-x² for |x|<1 and is zero for all other real x. g(x) is almost what we seek, but it has a pair of fatal flaws in that it has sharp corners when |x|=1 and therefore has no continuous derivatives there.

Step II: Fix the the flaws.  A way to do this is to apply a nice smooth function to the flawed g(x) .  The nice smooth function s is defined by setting s(x) equal to exp(-1/x) for x>0 and equal to  0 for all other real x. It isn't hard to see that the result of following g by s is nice and smooth -- the corners of g where |x|=1 have been smoothed out by applying s.  All that remains is to multiply by e to adjust the value at x=0 so it equals 1.  The final result for the hump funtion h in terms of x is

h(x)=exp(-x²/(1-x²)) for |x|<1 and 0 otherwise.

Edited on October 25, 2006, 7:54 pm
 Posted by Richard on 2006-10-25 19:29:38

 Search: Search body:
Forums (0)