Second derivative with complex numbers
|
02-09-2021, 03:45 PM
Post: #2
|
|||
|
|||
RE: Second derivative with complex numbers
Here is another way to obtain the derivative formulas
\(\displaystyle f'(x) ≈ {f(x+ih) - f(x) \over ih}\) \(\displaystyle f''(x) ≈ {f'(x) - f'(x-ih) \over ih} ≈ \frac{{{f(x+ih) - f(x) \over ih}} - {{f(x) - f(x-ih) \over ih}}}{ih} = {f(x+ih) - 2 f(x) + f(x-ih) \over -h^2} \) Weierstrass approximation theorem: we can assume f(x) is polynomial. Conjugate of polynomial is polynomial of conjugate: f(x-hi) = conj(f(x+hi)) If f(x) is smooth and real, so does its derivatives → RHS must be real. \(\displaystyle f'(x) ≈ {\Im(f(x+ih)) \over h} \) \(\displaystyle f''(x) ≈ {\Re(f(x+ih) - f(x)) \over -h^2/2} \) --- Using central difference derivative formula, we also get the same f'(x) formula. Note: below does not assume real f'(x), RHS imaginary parts really cancelled out. \(\displaystyle f'(x) ≈ {f(x+ih) - f(x-ih) \over 2ih} = {\Im(f(x+ih)) - \Im(f(x-ih)) \over 2h} = {\Im(f(x+ih)) \over h} \) → both derivative formulas should give accuracy similar to central difference formulas. XCas> f(x) := x*(x^3+5*x^2-21*x) // example from here XCas> f'(4) → 328 XCas> (f(x+h) - f(x-h)) / (2h) | x=4, h=1e-3 → 328.000021 XCas> im(f(x+h*i)) / h | x=4, h=1e-3 → 327.999979 XCas> f''(4) → 270 XCas> (f(x+h)-2*f(x)+f(x-h))/h^2 | x=4, h=1e-3 → 270.000002132 XCas> re(f(x+h*i)-f(x)) / (-h^2/2) | x=4, h=1e-3 → 269.999998125 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Second derivative with complex numbers - peacecalc - 02-09-2021, 06:06 AM
RE: Second derivative with complex numbers - Albert Chan - 02-09-2021 03:45 PM
RE: Second derivative with complex numbers - peacecalc - 02-11-2021, 09:49 AM
RE: Second derivative with complex numbers - Werner - 02-11-2021, 12:36 PM
RE: Second derivative with complex numbers - Albert Chan - 02-11-2021, 02:13 PM
RE: Second derivative with complex numbers - Albert Chan - 02-12-2021, 04:55 PM
RE: Second derivative with complex numbers - Werner - 02-11-2021, 05:49 PM
RE: Second derivative with complex numbers - Werner - 02-11-2021, 07:01 PM
RE: Second derivative with complex numbers - Werner - 02-11-2021, 08:53 PM
RE: Second derivative with complex numbers - peacecalc - 02-13-2021, 09:00 AM
RE: Second derivative with complex numbers - Werner - 02-13-2021, 02:50 PM
|
User(s) browsing this thread: 3 Guest(s)