Comments (3)
It seems the limit 1e14
is imposed because the function uses a naive formula to do range reduction: x = x - 45 * floor(x / 45.0)
. This is inaccurate for large x
. By using a more sophisticated fmod
, the limit 1e14
should be unnecessary.
from scipy.
However, when I use Jupyter Notebook I didn’t get an error or warning message and the function “silently” returned zero.
I believe this error is only shown if you enable the error:
scipy.special.seterr(no_result='raise')
Results in:
>>> scipy.special.sindg(1e14 + 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
scipy.special._sf_error.SpecialFunctionError: scipy.special/sindg: no result obtained
Though the large argument is probably not so commonly used in practice, it may still be desirable to support it if possible.
I'm not sure there's an accurate way to do this for large x. If x is large, then x is not very precise in an absolute sense. If x is about 1e14, then x % 360 can be accurate, at most, to 5 decimal digits of precision.
I agree that the current state of things is not great, though. At minimum, this ought to be documented.
from scipy.
Thanks for the comments @nickodell. The seterr
call works!
With some googling, I find this StackOverflow thread that elaborates the issues with large argument, and this pdf that explains range reduction when the argument is in radian.
My take away is that when the argument is very large, the result is almost certainly useless for the practical problem because a tiny relative error in the argument can lead to completely different result. So the best practice is never to work with huge angles. On the other hand, if the huge angle is against all odds exact, then it would be ideal to return a correct result for sindg
. This is actually easy when the argument is in degrees, since 360
is exact while pi
is approximate.
from scipy.
Related Issues (20)
- BUG: stats.noncentral_t: incorrect pdf values HOT 6
- BUG: special: algorithmic Error in `ratevl` in `cephes/polevl.h` HOT 13
- Array API failures with Metal Performance Shaders/torch HOT 2
- BUG: Unable to build SciPy locally due to mysterious conflation between scipy.signal and stdlib signal module HOT 4
- ENH: `special.rel_entr`: avoid premature overflow HOT 4
- CI: scipy installation failing in umfpack tests HOT 2
- BLD: build times in Windows CI entries are variable and take longer than they should HOT 15
- BUG: ZeroDivision Error in peak_finding_utils.pyx
- BUG: minimize - COBYQA is very inefficient w.r.t time. HOT 10
- BUG: `scipy.stats.ttest_1samp` raises an error when using `keepdims=True` HOT 5
- BUG: Segfault in scipy/sparse/linalg/_eigen/arpack HOT 3
- ENH: Allow linear_sum_assignment to accept a ufunc for very large graphs HOT 3
- MAINT:RFC:Adopt IEEE semantics for scipy.special.sindg, cosdg, tandg and cotdg
- DOC: stats.mannwhitneyu: reversed options for `alternative` param HOT 11
- 1.12.0 [BUG]: pytest fails in all units using `scipy.special._ufuncs` DSO module with `undefined symb ol: npy_cexp` HOT 6
- DOC/DEV: update commit message guidance HOT 4
- BLD/DEV: special: build warnings HOT 8
- DOC: Scipy Documentation Pages Completely Down HOT 3
- ENH: interpolate.make_lsq_spline: add boundary conditions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scipy.