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

math: add tests for corner cases of Yn Bessel function #19130

Closed
griesemer opened this issue Feb 16, 2017 · 5 comments
Closed

math: add tests for corner cases of Yn Bessel function #19130

griesemer opened this issue Feb 16, 2017 · 5 comments

Comments

@griesemer
Copy link
Contributor

Follow-up on #18823 and corresponding change https://go-review.googlesource.com/#/c/35970/ (see Rob's comment in that change).

@griesemer griesemer added this to the Go1.9Maybe milestone Feb 16, 2017
@alexd765
Copy link
Contributor

I think we are already testing almost all the edge cases here.

We are testing Yn(n,a) for combinations of n=2,-3 and a= positive finite number, 0, -Inf, +Inf, NaN.
So it might be enough to add a = negative finite number and as a single special case Yn(0,0).

@gopherbot
Copy link

CL https://golang.org/cl/37310 mentions this issue.

@nerdatmath
Copy link
Contributor

The special cases listed for Yn are:

Yn(n, +Inf) = 0
Yn(n ≥ 0, 0) = -Inf
Yn(n < 0, 0) = +Inf if n is odd, -Inf if n is even
Yn(n, x < 0) = NaN
Yn(n, NaN) = NaN

also

Y0(+Inf) = 0
Y0(0) = -Inf
Y0(x < 0) = NaN
Y0(NaN) = NaN

and

Y1(+Inf) = 0
Y1(0) = -Inf
Y1(x < 0) = NaN
Y1(NaN) = NaN

[Note that Y0(x) = Yn(0, x) and Y1(x) = Yn(1, x)]

Yn(n, x) is already tested for n ∈ {0, 1, 2, -3} and x ∈ {+∞, -∞, 0, NaN}, covering each of the above cases at least once. There are also several test cases over the same values of n with finite x>0. Note that the tests for n=0 and n=1 actually test Y0 and Y1 but that's equivalent. The only test that might be seen as missing is finite x<0 but I don't think it's needed.

@alexd765
Copy link
Contributor

I think we are in agreement about which which cases are already tested.

The only case not tested at all is negative finite number for which I added a test with -1. This a usefull addition imo.

Y0(0) is already tested, like you said. So with the extra test Yn(0,0) we are only testing that Yn is calling Y0 in that case. I could see that this is something we might not need.

@nerdatmath
Copy link
Contributor

Oh, sorry, I missed that you had already sent a CL. I don't think that Yn(0, x) is needed unless we also need Yn(1, x) (and Jn(0, x) and Jn(1, x)). In my opinion the case Yn(n, x<0) is already covered by Yn(n, -Inf), so I don't think we actually need any change at all here. Nevertheless, extra tests aren't going to hurt.

Since a CL is already provided, should the HelpWanted label be removed from this issue?

@golang golang locked and limited conversation to collaborators Feb 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants