Sunday Function

If you're a regular reader of this site, you might remember a post about this fascinating specimen from the collection of unusual functions. I'm only showing it on the interval [-1,1] for reasons that will become apparent, but outside that region the growth tapers off rapidly and the function approaches 1 for large negative and large positive x.

i-d4bb9fe09d6b78eb832985821d8a307f-1.png

i-88516ca505d84f969b7ab15a965c3fb3-2.png

It's continuous once you define the point at the origin, and it has continuous derivatives of all orders. Nevertheless, if you try to find the power series about the origin, you see that every term in the series is 0. You can try offsetting the point you're expanding about, but then the series will only converge to the distance of the origin. We talked about the why of this in the post linked above.

But for whatever reason we would really like a series approximation to this function. There's any number of physics reasons why power series are a very useful thing to have available, and it looks in some sense like the function ought to be representable by a power series. The function on this interval does have a shape which sort of vaguely resembles a parabola, so surely there's some second-order polynomial which is less bad than the others at approximating this function.

There is, if we're willing to accept a few sacrifices. This particular trick only works over a finite interval, because fundamentally it approximates a function over an interval - not about a point. This means it's not a Taylor series and so it won't give us the luxury of having a single point of expansion with such pretty bounds on the error of the approximation in its neighborhood. But if that's not too bad, sign on the dotted line and hire the services of the Legendre polynomials.

The Legendre polynomials are just standard, ordinary polynomials which happen to satisfy the Legendre differential equation. The Legendre polynomial of order 0 is 1, the one of order 1 is x, the one for order 2 is (3/2)x^2 + 1, and so on. There's a list at the link. To cut down on notation they're usually just called by the label Pn, where n is the order of the polynomial.

But (and this is a long and complicated story), it turns out that the solutions to these sorts of differential equations have a very interesting property. They are complete sets of orthogonal functions, which means that you can expand just about any function you want in terms of those polynomials over some interval. So for any particular f(x) including ours,

i-d18063683dcc0d42b9be45451a84d1e3-3.png

All you have to do is find the cn coefficients. Without going into detail, here's how:

i-8d7070ce28f0af28047c7a5fb8246d53-4.png

That coefficient in front of the integral is a historical idiosyncrasy. Had the Legendre polynomials first been developed using modern ideas of Hilbert spaces, they would have been rescaled to make that coefficient a 1.

Notice that this procedure only works on functions on the interval [-1,1]. But this is really no limitation: if you want to expand over a different interval, just offset and rescale your original f(x), find the polynomial approximation, and then do the reverse transformation on your polynomial approximation.

All that out of the way, here's what I get for the first three non-zero cn. It will turn out that for all odd n, cn is zero due to parity.

c0 = 0.1781477
c2 = 0.1006579
c4 = 0.0149114

Here's the approximation for just the first two of the above:

i-bb5c2c6b0452df43a61e3974bd9b473f-5.png

And here for all three:

i-80f9713f6d11461837a9f9b540684e36-6.png

Further terms would improve the approximation. Not bad, huh?

More like this

Sorry for the two-day delay. The personal business to which I alluded kept me out until yesterday morning, delaying this post until today. I hope it's decent for all that! This week, the same function as last week. There's nothing so special about the function itself, but it does serve as a nice…
It is time to continue our quest to prove that the sum of the reciprocals of the primes diverges. We have one more ingredient to put into place. I am referring to the notion of a Taylor series. The idea is this: Some functions, like those from trigonometry, are difficult to evaluate precisely.…
Last week we did the sinc function. Let's do it again! The function, to refresh our collective memory, is this: Now I was thinking about jumping right into some contour integration, but on actually doing it again I see that it's a little hardcore for one post so eventually when we do it we'll…
And now, two quick notes before we get to business: 1. God help me, but I've joined the Twitter bandwagon. Here I am, @BuiltOnFacts. Though it goes under this blog's name, it is more of a "personal" account. So you'll be reading some incomprehensible personal minutiae, random observations, wild…

i think the link is wrong, it goes to sin(x^{-1}) which doesn't make sense.

Here is a picture over the complex plane to get a sense of the pathology.

I think you taught a lot of people something useful today, including me.

By Carl Brannen (not verified) on 24 Aug 2008 #permalink