[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #56665] Incorrect results with ppval and inter
From: |
Chad Oldfield |
Subject: |
[Octave-bug-tracker] [bug #56665] Incorrect results with ppval and interp1 when using complex query points |
Date: |
Thu, 25 Jul 2019 12:58:03 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 |
Follow-up Comment #3, bug #56665 (project octave):
Agreed that it is debatable whether this is an "incorrect result" or a
desired/undesired extension.
If this were to be done, the key to enabling the complex step method to work
is that the program should follow the same path (i.e. through if statements,
selection of indices, etc.) with the complex value x + 1i * step as it would
with just x. The concept scales from small problems like interpolation to
large problems like computational fluid dynamics. For the interpolation and
piecewise polynomial evaluation, it means choosing the interval based on the
real part of xbar. It's possible this may impact the lookup function.
Would this be mathematically unsound for other uses?
My humble opinion in favour of adding this extension is that, as an
environment primarily for numerical analysis, it is helpful to support
accurate numerical methods. The complex step method is great for numerical
accuracy (as compared to finite differences), because it eliminations the
cancellation error, so very small steps can be used to limit truncation
errors. As an example (not involving interpolation), the subtractive
cancellation errors cause an inaccurate finite difference in the following
derivative estimate with too small a step size, but the analytic version and
complex step agree:
>> step = 1e-14;
>> (sin(pi/6 + step) - sin(pi/6 - step)) / (2 * step)
ans = 0.86320
>> cos(pi/6)
ans = 0.86603
>> imag(sin(pi/6 + 1i * step)) / step
ans = 0.86603
So this would allow better numerical accuracy in applications that include
interpolation or piecewise polynomials as a part of a larger function that is
to be differentiated numerically.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?56665>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/