scipy icon indicating copy to clipboard operation
scipy copied to clipboard

BUG: special.struve: do not return NaN for values close to zeros

Open GreenMemory16 opened this issue 2 years ago • 7 comments

Closes #19580, closes #5979

When calculating the struve function using the power series (https://dlmf.nist.gov/11.2.1), if the z is close to giving result that is a zero of the function, the error boundaries don't evaluate the result accordingly, so the value calculated, even tough it is correct, doesn't pass the conditions and returns NaN. With Asymptotic expansions we can catch some of those situations (https://dlmf.nist.gov/11.6.5) and we can also check the error margin to let the values be returned.

GreenMemory16 avatar Apr 03 '24 10:04 GreenMemory16

Hi @person142 @steppi , sorry to bother, but when you have the chance, can you take a look at my pull request? Thank you.

GreenMemory16 avatar Apr 15 '24 13:04 GreenMemory16

Hello @steppi, is there a chance you can take a look at my pr?

GreenMemory16 avatar May 02 '24 13:05 GreenMemory16

In the mean time @GreenMemory16 could you resolve the merge conflicts

j-bowhay avatar May 02 '24 13:05 j-bowhay

Hi @GreenMemory16, thanks for submitting this fix. The merge conflict is because we've recently translated all of cephes into C++ which can also run on CUDA as part of the project described here. You can find the the relevant function here now: https://github.com/scipy/scipy/blob/c0fa9e36168c24ce6772e054653c82c73e083d56/scipy/special/special/cephes/struve.h#L293.

steppi avatar May 02 '24 15:05 steppi

Thanks, I'll fix it as soon as possible

GreenMemory16 avatar May 02 '24 15:05 GreenMemory16

Hi @GreenMemory16, did you mean to close this?

lucascolley avatar May 02 '24 18:05 lucascolley

Hi @GreenMemory16, did you mean to close this?

No, I'm sorry. But it is reopened now

GreenMemory16 avatar May 02 '24 19:05 GreenMemory16

When you have a chance, can you take a look at this pr @steppi?

GreenMemory16 avatar Jun 14 '24 12:06 GreenMemory16

@GreenMemory16 Thanks for submitting this. Did you see that you have a review waiting, and were you still interested in finishing?

mdhaber avatar Sep 26 '24 19:09 mdhaber

Hello, sorry for the time it took for me to reply. I don't currently have the time, nor the level of confidence to tackle this issue. I think i''l let someone else grab this

Sorry again for the time it took for me to reply.

GreenMemory16 avatar Sep 27 '24 12:09 GreenMemory16

Thanks for replying @GreenMemory16! Can you just reply to the questions @steppi wrote above so we can determine whether we should continue with the approach? Specifically, was there a theoretical backing for this, and how was 1e-22 chosen?

mdhaber avatar Sep 27 '24 14:09 mdhaber

Ok, that's @GreenMemory16! In that case, I'll go ahead and close this so others can give it a shot.

mdhaber avatar Sep 30 '24 22:09 mdhaber