octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #62321] Wrong result for Airy funtion


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #62321] Wrong result for Airy funtion
Date: Sat, 16 Apr 2022 09:29:24 -0400 (EDT)

Follow-up Comment #2, bug #62321 (project octave):

Modified test:


nu = [20 65 200];
w = 1 + [0 0.5] .* exp(i * 1e-3);
[NU, W] = meshgrid(nu, w);
Z = W .* NU ./ (NU - 1);
ZETA = -power(1.5 .* (sqrt(Z .^ 2 - 1) - asec(Z)), 2/3);;
V = power(NU - 1, 2/3) .* ZETA

P = airy (0, V);
Q = zeros(size(V));
for t = 1:numel(V)
  Q(t) = airy (0, V(t));
end

P
Q
P-Q

## Pass the scaling option
R = airy (0, V, true);
S = zeros(size(V));
for t = 1:numel(V)
  S(t) = airy (0, V(t), true);
end

R
S
R-S


As seen above in the code, passing it the scaling option makes both of them
agree, but in that process I uncovered another bug. The decision whether to
scale the output or not is done only based on whether there are three input
arguments, not based on the scaling option's value. Calling airy (0, V, false)
erroneously gives the same results as airy (0, V, true) which would be very
confusing to someone who thought they had disabled scaling. Further, calling
airy (V, ...) ought to be the same as calling airy (0, V, ...) but that breaks
if the scaling option is passed, and then airy (V, true) gives completely
different results from airy (0, V, true), not even the same size.

The main lifting is being done by one of several functions in
liboctave/numeric/lo-specfun.cc. That's the next place to look.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62321>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]