02-09-2021, 06:06 AM
Hello all,
I'm shure, in former threads has discussed that topic. After programming the first derivative with complex numbers in my DM42, I tried the same with the second derivative.
For rememberance, the taylor-series for the first derivative (truncating after the first derivative):
\[ f(x+i\cdot h) \approx f(x) + f'(\tau)|_{\tau = x}\cdot i h \quad \hbox{ take the imaginary part with}\quad \Im(f(x)) = 0 \quad \hbox{ because it is only real, one gets:} \quad
f'(x) \approx \frac{1}{h}\Im(f(x+ih)) \]
Now let us see the taylor series until the second derivative (and then truncating further terms):
\[ f(x+i\cdot h) \approx f(x) + f'(\tau)|_{\tau = x}\cdot i h + \frac{1}{2} f''(\tau)|_{\tau = x}\cdot (i h)^2 \quad \hbox{with} \quad i^2 = - 1 \Rightarrow f(x+i\cdot h) \approx f(x) + f'(\tau)|_{\tau = x}\cdot i h - \frac{1}{2} f''(\tau)|_{\tau = x}\cdot h^2 \]
now we take the real part:
\[ \Re(f(x+i\cdot h)) \approx f(x) - \frac{1}{2} f''(\tau)|_{\tau = x}\cdot h^2 \quad\hbox{the term:} \quad f'(\tau)|_{\tau = x}\cdot i h \quad \hbox{vanish because it is only imagenary and one gets:} \quad f''(x) \approx - \frac{2}{h^2} \cdot \left( \Re(f(x+i\cdot h)) - f(x) \right) \]
Maybe it is an advantage, because you only have to calculate one difference instead of three if you calculate the first order derivative without doing that in the complex plane. Please pay attention to, only the real part is taken from f(x+ih).
Sincerely peacecalc
I'm shure, in former threads has discussed that topic. After programming the first derivative with complex numbers in my DM42, I tried the same with the second derivative.
For rememberance, the taylor-series for the first derivative (truncating after the first derivative):
\[ f(x+i\cdot h) \approx f(x) + f'(\tau)|_{\tau = x}\cdot i h \quad \hbox{ take the imaginary part with}\quad \Im(f(x)) = 0 \quad \hbox{ because it is only real, one gets:} \quad
f'(x) \approx \frac{1}{h}\Im(f(x+ih)) \]
Now let us see the taylor series until the second derivative (and then truncating further terms):
\[ f(x+i\cdot h) \approx f(x) + f'(\tau)|_{\tau = x}\cdot i h + \frac{1}{2} f''(\tau)|_{\tau = x}\cdot (i h)^2 \quad \hbox{with} \quad i^2 = - 1 \Rightarrow f(x+i\cdot h) \approx f(x) + f'(\tau)|_{\tau = x}\cdot i h - \frac{1}{2} f''(\tau)|_{\tau = x}\cdot h^2 \]
now we take the real part:
\[ \Re(f(x+i\cdot h)) \approx f(x) - \frac{1}{2} f''(\tau)|_{\tau = x}\cdot h^2 \quad\hbox{the term:} \quad f'(\tau)|_{\tau = x}\cdot i h \quad \hbox{vanish because it is only imagenary and one gets:} \quad f''(x) \approx - \frac{2}{h^2} \cdot \left( \Re(f(x+i\cdot h)) - f(x) \right) \]
Maybe it is an advantage, because you only have to calculate one difference instead of three if you calculate the first order derivative without doing that in the complex plane. Please pay attention to, only the real part is taken from f(x+ih).
Sincerely peacecalc