Hi all, Suppose I am looking at a non-smooth function which is max(x - c, 0), is there a way to approximate it by polynomials of x or other functionals of x? Of course, Taylor expansion may have some trouble here... But are there ways out of this swamp from math and physics literature? Thanks!
best way to approximating a non-smooth function using polynomials...
Started by ●February 13, 2009
Reply by ●February 13, 20092009-02-13
On Feb 13, 12:46�pm, Luna Moon <lunamoonm...@gmail.com> wrote:> > Suppose I am looking at a non-smooth function which is > > f(x) = max(x - c, 0), > > is there a way to approximate it by polynomials of x or other > functions of x? > > Of course, Taylor expansion may have some trouble here... > > But are there ways out of this swamp from math and physics > literature?i presume that "c" is a specified (or otherwise known) constant. right? also, you want to approximate it within a specified domain: xmin <= x <= xmax , right? do you know the xmin and xmax? also, since you included the possibility of "other" functions of x (non-polynomials), and since your f(x) is a piecewise-linear function, there is a function that asymptotically approximates your piecewise linear function. f(x) = max(x-c, 0) we approximate it with g(x) = (1/alpha)*log(1 + exp(alpha*(x-c))) alpha > 0 and the larger alpha is, the tighter this smooth function approximates your originally specified one. a tighter corner when x is close to c. (BTW, all of this was motivated by the piecewise- linear "Bode plots" we used to do back in school. just in case someone wonders where it came from.) if, for computational reasons, you want g(x) to be a polynomial, then you have to fit it to f(x) (over the domain, xmin <= x <= xmax) and then you have to define how you measure the goodness of fit. if the goodness of fit is measured in terms of mean square error, then there is a straight-forward way to get the polynomial coefficients ("least square fit"). if the goodness of fit is measured in terms of the maximum error, then you have to use what is called the Remes Exchange Algorithm (with the basis functions defined to be powers of x). i have MATLAB/Octave code for that if you want. r b-j
Reply by ●February 13, 20092009-02-13
Luna Moon wrote:> Hi all, > > Suppose I am looking at a non-smooth function which is > > max(x - c, 0), > > is there a way to approximate it by polynomials of x > or other functionals of x? > > Of course, Taylor expansion may have some trouble here... > > But are there ways out of this swamp from math and > physics literature?I don't know if this will help, but since max{x,y} = (1/2)(x + y + |x-y|), your function is continuous and hence it can be uniformly approximated by polynomials on any compact set (such as a closed and bounded interval), and there are specific methods for obtaining such polynomials (e.g. by using Bernstein polynomials -- see the URL just below). http://en.wikipedia.org/wiki/Bernstein_polynomial Also, if x and y are non-negative, then max{x,y} is equal to the limit as n --> infinity of (x^n + y^n)^(1/n), but I don't know if this will be of use. Dave L. Renfro
Reply by ●February 13, 20092009-02-13
On Feb 13, 11:46�am, Luna Moon <lunamoonm...@gmail.com> wrote:> Hi all, > > Suppose I am looking at a non-smooth function which is > > max(x - c, 0), > > is there a way to approximate it by polynomials of x or other > functionals of x? > > Of course, Taylor expansion may have some trouble here... > > But are there ways out of this swamp from math and physics > literature?Questions: 1. Why do you want to do this? Is it an exercise, or do you have a use for it? 2. Is the approximation on a finite interval, a <= x <= b, where a < c < b? 3. What other functions are you willing to use? Dave
Reply by ●February 13, 20092009-02-13
Luna Moon wrote:> Hi all, > > Suppose I am looking at a non-smooth function which is > > max(x - c, 0), > > is there a way to approximate it by polynomials of x or other > functionals of x? > > Of course, Taylor expansion may have some trouble here... > > But are there ways out of this swamp from math and physics > literature?You can invent any sort of parametric limit approximation, kinda: (c - x) F(x) = ------------- + (x - c), where p -> infinity 1 + (x/c)^p BUT, what are you trying to do, really? Trying to estimate the nonlinear effects produced by a hard knee? Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by ●February 13, 20092009-02-13
"Luna Moon" <lunamoonmoon@gmail.com> wrote in message news:9c813742-e132-4ecc-9a9c-6a69c18558bb@d36g2000prf.googlegroups.com...> Hi all, > > Suppose I am looking at a non-smooth function which is > > max(x - c, 0),i.e., when x < c then then x - c < 0 and max(x - c, 0) = 0 when x > c then x - c > 0 and max(x - c, 0) = x - c hence we simply have a ramp at x = c f_c(x) = 0 if x < c x - c else = (x - c)*Heaviside(x - c)> is there a way to approximate it by polynomials of x or other > functionals of x? >functionals?> Of course, Taylor expansion may have some trouble here... > > But are there ways out of this swamp from math and physics > literature? >I'm not sure what your getting at. The ramp function given is a perfectly good function. If you want to approximate it with more complex things then that is your right.
Reply by ●February 13, 20092009-02-13
On Feb 13, 10:25�am, Dave <dave_and_da...@Juno.com> wrote:> On Feb 13, 11:46�am, Luna Moon <lunamoonm...@gmail.com> wrote: > > > Hi all, > > > Suppose I am looking at a non-smooth function which is > > > max(x - c, 0), > > > is there a way to approximate it by polynomials of x or other > > functionals of x? > > > Of course, Taylor expansion may have some trouble here... > > > But are there ways out of this swamp from math and physics > > literature? > > Questions: > > 1. Why do you want to do this? Is it an exercise, or do you have a use > for it? > 2. Is the approximation on a finite interval, a <= x <= b, where a < c > < b? > 3. What other functions are you willing to use? > > DaveYeah, I am trying to look at my computational problem from different perspectives... Expanding and approximating it will add more perspectives. Yes, it's in a finite interval, a<=x<=b, and a<c<b. I am willing to explore all possible functionals...
Reply by ●February 13, 20092009-02-13
On Feb 13, 10:09�am, robert bristow-johnson <r...@audioimagination.com> wrote:> On Feb 13, 12:46�pm, Luna Moon <lunamoonm...@gmail.com> wrote: > > > > > Suppose I am looking at a non-smooth function which is > > > f(x) = max(x - c, 0), > > > is there a way to approximate it by polynomials of x or other > > functions of x? > > > Of course, Taylor expansion may have some trouble here... > > > But are there ways out of this swamp from math and physics > > literature? > > i presume that "c" is a specified (or otherwise known) constant. > right? > > also, you want to approximate it within a specified domain: > > � � �xmin <= x <= xmax , > > right? �do you know the xmin and xmax? > > also, since you included the possibility of "other" functions of x > (non-polynomials), and since your f(x) is a piecewise-linear function, > there is a function that asymptotically approximates your piecewise > linear function. > > � � f(x) = max(x-c, 0) > > we approximate it with > > � � g(x) = (1/alpha)*log(1 + exp(alpha*(x-c))) > > alpha > 0 and the larger alpha is, the tighter this smooth function > approximates your originally specified one. �a tighter corner when x > is close to c. �(BTW, all of this was motivated by the piecewise- > linear "Bode plots" we used to do back in school. �just in case > someone wonders where it came from.) > > if, for computational reasons, you want g(x) to be a polynomial, then > you have to fit it to f(x) (over the domain, xmin <= x <= xmax) and > then you have to define how you measure the goodness of fit. �if the > goodness of fit is measured in terms of mean square error, then there > is a straight-forward way to get the polynomial coefficients ("least > square fit"). �if the goodness of fit is measured in terms of the > maximum error, then you have to use what is called the Remes Exchange > Algorithm (with the basis functions defined to be powers of x). �i > have MATLAB/Octave code for that if you want. > > r b-jYeah, x is in a finite interval, let's say (0, 1000). c is a constant in this interval also. So your method adds an additional parameter, alpha? Yes, that's one possible thought, any other such forms? I will still expand those approximation forms further out to get a series expansion...
Reply by ●February 13, 20092009-02-13
On Feb 13, 10:55�am, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote:> "Luna Moon" <lunamoonm...@gmail.com> wrote in message > > news:9c813742-e132-4ecc-9a9c-6a69c18558bb@d36g2000prf.googlegroups.com... > > > Hi all, > > > Suppose I am looking at a non-smooth function which is > > > max(x - c, 0), > > i.e., when x < c then then x - c < 0 and max(x - c, 0) = 0 > when x > c then x - c > 0 and max(x - c, 0) = x - c > > hence we simply have a ramp at x = c > > f_c(x) = 0 if x < c > � � � � �x - c else > � � � �= (x - c)*Heaviside(x - c) > > > is there a way to approximate it by polynomials of x or other > > functionals of x? > > functionals? > > > Of course, Taylor expansion may have some trouble here... > > > But are there ways out of this swamp from math and physics > > literature? > > I'm not sure what your getting at. The ramp function given is a perfectly > good function. �If you want to approximate it with more complex things then > that is your right.Yep, one possible direction of my question can be formulated as: Give an approximation of the ramp function, so that I could further expand it out into series form... My end goal is a series expansion... but it's probably hard to get a direct series expansion from the ramp function itself. Maybe the first step is find an approximation to the ramp function itself, then do a series expansion on top of that... This is one possible approach for attacking the overall problem. If we adopt this approach, then there are two approximation step here. What's the best way to choose the best overall approximation when the two approximation steps are combined?
Reply by ●February 13, 20092009-02-13
On Feb 13, 10:12�am, "Dave L. Renfro" <renfr...@cmich.edu> wrote:> Luna Moon wrote: > > Hi all, > > > Suppose I am looking at a non-smooth function which is > > > max(x - c, 0), > > > is there a way to approximate it by polynomials of x > > or other functionals of x? > > > Of course, Taylor expansion may have some trouble here... > > > But are there ways out of this swamp from math and > > physics literature? > > I don't know if this will help, but since > > max{x,y} = (1/2)(x + y + |x-y|), > > your function is continuous and hence it can be uniformly > approximated by polynomials on any compact set (such as > a closed and bounded interval), and there are specific > methods for obtaining such polynomials (e.g. by using > Bernstein polynomials -- see the URL just below). > > http://en.wikipedia.org/wiki/Bernstein_polynomial > > Also, if x and y are non-negative, then max{x,y} is > equal to the limit as n --> infinity of (x^n + y^n)^(1/n), > but I don't know if this will be of use. > > Dave L. Renfrohmm, I don't know how to convert my function into Bernstein polynomial. And how does it compare with a Taylor polynomial expansion?






