Skip to content

Return sequences of Bessel functions for many orders #52

@heltonmc

Description

@heltonmc

See similar issue at JuliaMath/SpecialFunctions.jl#26.

This is a feature request from discourse. Essentially it would be nice to take arguments like besselj(nu:Vector, x::T) that returns a sequence of Bessel functions with step size equal to 1. Essentially a fast way to generate besselj(n, x) for n = 0, 1, 2, 3, ....

I'd probably pose we have two options a non allocating version where the user can preallocate the memory like besselj!(out, nu, x) and then one that allocates for besselj(nu, x) if nu is some AbstractVector.

Of course these are all filled by recurrence relations. Downward recurrence for besselj and besseli and upward recurrence using bessely and besselk.

There's a couple things to make sure we get right...

  • Downward recurrence could have start values (nu[end]) be zero if nu >> x. Not sure we want to just compute until there is a finite value as we move down the vector as that is inefficient...
  • Upward recurrence could return infinity which then could return NaN as we get a subtraction of infinities in the recurrence
  • We also need to be careful about start and end nu values on either side of zero. Something like nu=-10:10 shouldn't be allowed as it will not be numerically stable crossing zero.
  • There is also the other concern of during some routines we are already generating values from recurrence so we already have two starting values but not always. It would be faster to modify the whole routine but I'm not for sure that is worth it because as length(nu) >> 1 the computation time of a two bessel calls will be a fraction of total runtime....

Just some quick thoughts on things to be careful about. The code is already here though just need to figure out finer details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions