help-octave
[Top][All Lists]

## Re: Besseli Function

 From: robert Macy Subject: Re: Besseli Function Date: Mon, 08 Sep 2003 07:57:38 -0700

```Make a table of values ahead of time, then simply do a
lookup.  Will run *very* fast.

- Robert -

On Mon, 8 Sep 2003 13:57:37 +0200
> I'm having problems with the Besseli Functions in Octave.
> While with
> Mathlab it is possible to solve the besseli functions
> with values up to
> 700, with Octave the function returns a valid answer just
> for input
> values below 81:
>
>
> OCTAVE:
>
> octave:1> besseli(0,1)
> ans = 1.2661
> octave:2> besseli(0,10)
> ans = 2815.7
> octave:3> besseli(0,81)
> ans =  6.6864e+33
> octave:4> besseli(0,82)
> ans = Inf + Infi
> octave:5> besseli(0,700)
> ans = Inf + Infi
>
>
> MATLAB:
>
> >>  besseli(0,1)
>
> ans =
>     1.2661
>
> >>  besseli(0,10)
>
> ans =
>     2.8157e+03
>
> >>  besseli(0,81)
>
> ans =
>     6.6864e+33
>
> >>  besseli(0,82)
>
> ans =
>     1.8064e+34
>
> >>  besseli(0,700)
>
> ans =
>     1.5296e+302
>
> >>
>
>
>
>
> I wrote a m-file to evaluate the function with precision
> for input
> parameters ultil 700, but it results too slow when I have
> to call the
> function several times.
>
>
>
-----------------------------------------------------------
> function I = besseli_oct(NU, Z),
>
> var = 1/factorial(NU);
> I   = var;
>
> for k=1:460
>     var = var.*(0.25 * Z.^2)./(k*(k+NU));
>     I   = I + var;
> end
>
> I = I.*( 0.5 * Z ).^NU;
>
-----------------------------------------------------------
>
> The Octave's version I'm using is the 2.1.46 with ATLAS
> optimized
> for P4 from Paul SÃ¶derlind's Software Page, and this
> version doesn't
> support dynamic linking ( octave_config_info("dld")=0 ).
> Have anybody any suggestion for this problem? A function
> written in
> C++ with the macro DEFUN_DLD_BUILTIN would work with the
> Octave's
> version I have?
>
> Thanks in advance for any help.
>
> Otavio
>
>
>
>
>
-------------------------------------------------------------
> 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
>
-------------------------------------------------------------
>

-------------------------------------------------------------
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
-------------------------------------------------------------

```