From: rusin@vesuvius.math.niu.edu (Dave Rusin) Subject: Re: Smoothing function Date: 26 Jan 2000 21:33:34 GMT Newsgroups: sci.math.num-analysis Summary: [missing] Laurent Guerby writes: > I need to to find a function [0,1]->[0,1] that has the following > properties: > > * f(0)=0, f(1)=1 > * all derivatives (or at least up to some order n) are 0 in 0 and 1 > * as fast as possible to compute (64 bits IEEE FP) Art Werschulz writes: > The function f(x) = exp(-1/(x^2(1-x)^2)) does the trick. See Gelbaum > and Olmstead, "Counterexamples in Analysis", pg 40 (item 11). In article <86wvow3a32.fsf@ppp-223-101.villette.club-internet.fr>, Laurent Guerby wrote: > >Some people mailed me about solutions of this form (thanks Dave!), but >this does not solve my problem, since f(1) must be 1, and it looks >like it's where the difficulty is. > >The mathematical solution is just to integrate and rescale the f you >described, but unfortunately raw numerical integration will lead to >poor performance and/or poor higher order derivative behaviour. Well, I suppose you'll still get poor numerical performance, but you can get functions of the sort you want, all in terms of exp . The reason that things like exp(-1/x) work near zero is that exp(1/x) blows up so rapidly at x=0. Your problem is that it doesn't approach 1 fast enough as x-> 1. Well, keep the exp() but replace the 1/x by something which goes to oo as x -> 0 and yet decreases very rapidly to 0 as x->1, say (1/x)* exp(-1/(1-x)) . So a suggestion is f(x) = exp( - exp(-1/(1-x))/x ) But I guess I prefer something more symmetrical, say g(x) = arctan(x*exp(1/(1-x^2))) suitably normalized. The ability to construct C^\infty functions with compact support is of crucial importance in the development of differential geometry, where examples like these, and their variants, are used freely -- with the usual complete disregard of issues of efficiency or numerical stability. dave ============================================================================== From: hrubin@odds.stat.purdue.edu (Herman Rubin) Subject: Re: Smoothing function Date: 26 Jan 2000 21:30:50 -0500 Newsgroups: sci.math.num-analysis In article , Art Werschulz wrote: >Hi. >Laurent Guerby writes: >> I need to to find a function [0,1]->[0,1] that has the following >> properties: >> * f(0)=0, f(1)=1 >> * all derivatives (or at least up to some order n) are 0 in 0 and 1 >> * as fast as possible to compute (64 bits IEEE FP) >The function f(x) = exp(-1/(x^2(1-x)^2)) does the trick. See Gelbaum >and Olmstead, "Counterexamples in Analysis", pg 40 (item 11). This function is 0 at both 0 and 1. One which does what is asked for is g(x) = exp(-1/x^2)/[exp(-1/x^2) + exp(-1/(1-x)^2)] -- This address is for information only. I do not claim that these views are those of the Statistics Department or of Purdue University. Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399 hrubin@stat.purdue.edu Phone: (765)494-6054 FAX: (765)494-0558