Post Reply 
Second derivative with complex numbers
02-12-2021, 04:55 PM
Post: #9
RE: Second derivative with complex numbers
(02-11-2021 02:13 PM)Albert Chan Wrote:  XCas> f2(x,h) := re((f(x+h)-2*f(x)+f(x-h))/h^2)     // central difference 2nd derivative
...
If |h| is not too small, we avoided catastrophic cancellation, error = O(h^2)
We may take advantage of it, with h = ε*√i, which make h^2 purely imaginary.

With h^2 purely imaginary, we can optimized away evaluation of f(x)
For h = ε*√i, all formulas below should have error = O(ε^4)

f(x) ≈ re((f(x+h) + f(x-h))/2)
f'(x) ≈ re((f(x+h) - f(x-h))/(2h))
f''(x) ≈ re((f(x+h) + f(x-h))/h^2)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Second derivative with complex numbers - Albert Chan - 02-12-2021 04:55 PM



User(s) browsing this thread: 1 Guest(s)