(08/12/2009, 02:15 AM)jaydfox Wrote: So I calculate sexp(m*2^p), for m an integer between -64 and 64, for example, and p equal to -108. Because I'm only using reals, convergence is assured. I'm using sexp(0)=0, because Andrew's slog is centered at 0, so I can have slog(sexp(0)) and expect an exact answer.
Anyway, I can then use those 129 points to calculate the various derivatives (actually, I use a matrix inversion that directly gives me the coefficients of the approximated Taylor series). Once I have a Taylor series, I can then move away from the real line.
See the following wikipedia article for the general idea of how the grid of points can be used to get derivatives:
http://en.wikipedia.orirg/wiki/Five-point_stencil
But thats what I asked you. You make an interpolating polynomial through the points sexp(m*2^p) and then you can get the derivatives as the derivatives of the polynomial.
Its described on that wiki page.
Quote:Instead of a 5-point stencil, I use a 129-point stencil. I don't yet have a formula for the coefficients for the stencil, so I have to use a matrix inversion to derive them "the hard way".
Well the interpolating polynomial can be computed as the Lagrange or the Newton Polynomial (with which I was incidentally concerned in the last time considering Ansus formulas)
Lets consider the equidistant Newton interpolation polynomial for \( N+1 \) points \( x_0,x_0+h,x_0+2h,\dots,x_0+Nh \):
\( N_N(x)=\sum_{n=0}^N \left(t\\n\right) \sum_{k=0}^n (-1)^{n-k} \left(n\\k\right) f(x_0+hk) \)
where \( t=(x-x_0)/h \).
To compute the coefficients we need to compute the coefficients of \( \left(t\\n\right) \) or more specifically the coefficients of \( t(t-1)\dots (t-n+1) \), but these are the well know Stirling numbers of the first kind:
\( t(t-1)\dots (t-n+1) = \sum_{j=0}^n s(n,j) x^j \)
Plug this into the Newton formula:
\( N_N(x)=\sum_{j=0}^N t^j \sum_{n=j}^N \frac{s(n,j)}{n!} \sum_{k=0}^n (-1)^{n-k} \left(n\\k\right) f(x_0+hk) \)
Then we want to have the coefficients at \( a:=x_0+hN/2 \), let \( d=hN/2 \)
\( t^j = \frac{(x-x_0)^j}{h^j} = h^{-j} (x-a+d)=h^{-j}\sum_{i=0}^j \left(j\\i\right) d^{j-i} (x-a)^i \)
Into the previous formula:
\( N_N(x)=\sum_{i=0}^N (x-a)^i \sum_{j=i}^N \left(j\\i\right) \frac{d^{j-i}}{h^j} \sum_{n=j}^N \frac{s(n,j)}{n!} \sum_{k=0}^n (-1)^{n-k} \left(n\\k\right) f(x_0+hk) \)
So these are coefficients of the stencil without matrix inversion. In your described case \( a=0 \), \( h=2^p \), \( x_0=-Mh \), \( d=Mh \), \( M=64 \).
Maybe there is a more symmetric formula but this should at least work.
And you still didnt tell me what FMA means!
