Earlier quoted context omitted.
Thanks for pointing to the right direction in case I want scratch that itch more. I am not surprised though that this has been done, expected the same. From a quick look, no one seems to suggest reflecting the original analytic function to get a periodic function, I guess some caveats lurk there. Does other integral transforms work better than Fourier ?
When you use this method you are implicitly making the function periodic. I can give you any function on some interval (sufficiently well behaved) and you can compute the Fourier series of it. Even though it's only defined on the interval, if you plotted the Fourier series you would still find it to be periodic. The same idea carries over to the spectral derivative. Even if the function isn't periodic, the method sti…
Hack the derivative
21–30 of 36 posts
Re: Hack the derivative
#22Earlier quoted context omitted.
No. Automatic differentiation is superior to the complex step method in every way. The only reason to use the complex step method is if you're using legacy languages where it's difficult to implement dual numbers but you have good support for complex numbers. I don't think anybody should be using the complex step method in new applications. Some reading ~ http://aero-comlab.stanford.edu/Papers/martins.aiaa.01-0921...…
wtf Automatic differentiation only works for the simplest functions for which you already know what the Taylor series looks like. For those cases, you might as well just hardcode derivative functions and the basic derivative rules (linearity and chain rule). It is not a general-purpose method. For functions that you can't even express by a simple formula, you still have to rely on finite differencing. Don't call "leg…
If so, I look forward to learning about it. If not, you were throwing stones in a glass house.
Re: Hack the derivative
#23Earlier quoted context omitted.
No. Automatic differentiation is superior to the complex step method in every way. The only reason to use the complex step method is if you're using legacy languages where it's difficult to implement dual numbers but you have good support for complex numbers. I don't think anybody should be using the complex step method in new applications. Some reading ~ http://aero-comlab.stanford.edu/Papers/martins.aiaa.01-0921...…
wtf Automatic differentiation only works for the simplest functions for which you already know what the Taylor series looks like. For those cases, you might as well just hardcode derivative functions and the basic derivative rules (linearity and chain rule). It is not a general-purpose method. For functions that you can't even express by a simple formula, you still have to rely on finite differencing. Don't call "leg…
Automatic differentiation works for any composition of those ‘simplest functions’ you mention, which is quite a lot of stuff, including whole programs.
Approximation methods have their place, sure. Sometimes they're good enough and sometimes it's all you can do. What does that have to do with anything?
Re: Hack the derivative
#24Earlier quoted context omitted.
wtf Automatic differentiation only works for the simplest functions for which you already know what the Taylor series looks like. For those cases, you might as well just hardcode derivative functions and the basic derivative rules (linearity and chain rule). It is not a general-purpose method. For functions that you can't even express by a simple formula, you still have to rely on finite differencing. Don't call "leg…
The question was about automatic differentiation vs the method in the article (the complex step method) which is essentially a defective variant of automatic differentiation with a spurious numerical parameter. Automatic differentiation works for any composition of those ‘simplest functions’ you mention, which is quite a lot of stuff, including whole programs. Approximation methods have their place, sure. Sometimes t…
Re: Hack the derivative
#25Earlier quoted context omitted.
I already know that a book on numerical analysis is likely to contain the answer I seek. The point of asking was to avoid a trip to the library since the working memory of someone who has been investigating differentiation techniques also likely contains the answer I seek.
I don’t quite understand what your question is, so I’m going to assume you were trying to ask, “When would you not want to use automatic differentiation?” I think the main time you can’t get much out of automatic differentiation is when your function is a black box or approximation, e.g. it comes from measuring physical data, or is the output of some kind of simulation, etc. I’m not an expert though. You can get a lo…
I appreciate that you were trying to be helpful, which is why I'm trying to be gentle (and explanatory) as I tell you that you weren't.
Re: Hack the derivative
#26Yay for functions which are analytic in some neighborhood. Here’s the original paper from the 60s about the idea in this post: http://www.math.fsu.edu/~okhanmoh/media/Lyness,%20Moler,%20S... The latest work on this general topic is http://arxiv.org/pdf/1404.2463.pdf which manages to compute extremely accurate high-order derivatives (“...even the 100th derivative of an analytic function can be computed with near machi…
The paper by Lyness and Moler is nice, but if it's really "about the idea in this post" then the fact is somewhat hidden. It's mostly about using the Cauchy integral formula to turn derivatives into integrals, using the Poisson summation formula to relate those to finite sums, and using the Moebius inversion formula to get those relations into a form from which you can extract the derivatives. Maybe taking a very sho…
Re: Hack the derivative
#27The article comments: "In a lot of respects, it’s quite amazing how accurate many calculations can be made with floating numbers, like orbital mechanics and heat equations" I'm not sure it is so surprising. In Nick Trefethen's Numerical Analysis entry in The Princeton Companion to Mathematics , he notes: "Thus, on a computer, the interval [1 , 2] , for example, is approximated by about 10^16 numbers. It is interestin…
Re: Hack the derivative
#28I DO think Python libraries can do this already.
Re: Hack the derivative
#29Lost me a bit at Im(f(x+ih))/h near the end (that's a fancy I that android FF won't paste). Can anyone explain where 'm' came from? Or is 'Im' just a fn returning the imaginary part of its argument? EDIT: reading the code following, it's clear that Im is just that.
I was also lost at that part, although for a different reason. The function f was assumed to be from R to R, so it does not make formal sense to plug in f(x+ih). I guess the author has the unstated assumption that f is the restriction to R of a function on C.
Re: Hack the derivative
#30Lost me a bit at Im(f(x+ih))/h near the end (that's a fancy I that android FF won't paste). Can anyone explain where 'm' came from? Or is 'Im' just a fn returning the imaginary part of its argument? EDIT: reading the code following, it's clear that Im is just that.