Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return sequence of bessel functions #10395

Closed
baptiste opened this issue Mar 3, 2015 · 3 comments
Closed

return sequence of bessel functions #10395

baptiste opened this issue Mar 3, 2015 · 3 comments
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request maths Mathematical functions

Comments

@baptiste
Copy link

baptiste commented Mar 3, 2015

I'm very new to julia, so not sure I managed to find the actual source code being used for those bessel(jhy) functions. There's a related thread suggesting that the chosen algorithm for integer arguments is different.

Nonetheless, for the general case, the Amos implementation returns a sequence of bessel functions, nu+I-1, I=1,...,N, and it would be very nice if the julia wrapper could return the whole sequence. Currently, I believe julia implements vectorisation over nu as a for loop and just takes the one value from the Amos sequence (or openlibm's).
Since it is not uncommon to need a sequence of values (Bessel functions tend to be used in recurrence relations), it is a bit wasteful to iterate over nu when it was already done at the Fortran level.

Related question on StackOverflow

@tkelman
Copy link
Contributor

tkelman commented Mar 3, 2015

It looks like we only ever call zbesj with N=1, see

function _besselj(nu::Float64, z::Complex128, kode::Int32)
ccall((:zbesj_,openspecfun), Void,
(Ptr{Float64}, Ptr{Float64}, Ptr{Float64}, Ptr{Int32}, Ptr{Int32},
Ptr{Float64}, Ptr{Float64}, Ptr{Int32}, Ptr{Int32}),
&real(z), &imag(z), &nu, &kode, &1,
pointer(cy,1), pointer(cy,2),
pointer(ae,1), pointer(ae,2))
- you should however be able to do a slightly different ccall yourself if you would like a larger N.

You may also find it neat/useful that Amos was translated to Julia here: https://github.com/nolta/SpecialFunctions.jl
We should probably replace the Fortran part of openspecfun with that at some point (#8536), just haven't yet done the work of turning that into a full-fledged tested and registered Julia package.

@IainNZ
Copy link
Member

IainNZ commented Mar 4, 2015

(thanks for filing this @baptiste!)

@ihnorton ihnorton added maths Mathematical functions help wanted Indicates that a maintainer wants help on an issue or pull request labels Mar 11, 2015
@KristofferC
Copy link
Member

Moved to JuliaMath/SpecialFunctions.jl#26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request maths Mathematical functions
Projects
None yet
Development

No branches or pull requests

5 participants