help-octave
[Top][All Lists]
Advanced

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

strange besselj behavior


From: Ahn Kyung
Subject: strange besselj behavior
Date: Sun, 06 Feb 2005 10:40:29 +0000

Folks,

Test this.

x=linspace(0,100,10000)';
plot(x, besselj(0,x));
plot(x, besselj(2,x));

When I tried this, besselj(0,x) did not have any problem, but plot(x,besselj(2,x)) spit out

octave:4> plot(x,besselj(2,x))

gnuplot> pl '/tmp/oct-PJiXlG' t "line 1"
           ^
        line 0: Bad data on line 5

So I checked what besselj(2,x) looked like. Here's the comparison with besselj(0,x):

octave:5> besselj(0,x)
ans =

   1.0000e+00
   9.9997e-01
   9.9990e-01
   9.9977e-01
   9.9960e-01
   9.9937e-01
   9.9910e-01
        ...

octave:6> besselj(2,x)
ans =

  0.00000 - 0.00000i
  0.00001 + 0.00000i
  0.00005 + 0.00000i
  0.00011 + 0.00000i
  0.00020 + 0.00000i
  0.00031 + 0.00000i
  0.00045 + 0.00000i

---------------

So, besselj in some cases(besselj(3,x)->bad; besselj(4,x)->OK, etc.) thinks that it can have imaginary values like Hankel functions?? The plot looked OK when I tried plot(x,real(besselj(2,x))), so at least I may trust the result with real(..).

I tried this just to see how well besselj would work. I'm using octave-2.1.50, installed via rpm on redhat core 2 platform. Well, I also have a Mandrake 10 box with octave installed with mandrake specific rpm and guess what. The same problem.

If any of you experience no such problems in other versions or other platforms, it may be just some bad compilation. Otherwise, I'd go ahead and report it as a bug.

So I'd appreciate if you could share your experience on this.




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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