Skip to content

Conversation

@jieli-matrix
Copy link

@jieli-matrix jieli-matrix commented Sep 15, 2023

In precision tests, we typically require strict benchmark data for comparison. For instance, in scientific computation, we often consider the calculation results from commercial software as the gold standard, like Matlab or Mathematica. In this commit, we utilized Octave, an open source software, to generate the Bessel function data points.

  1. sphbesj passed the precision tests where the threshold is set to 1e-12.
  2. Spherical_Bessel failed to pass the tests (especially when l = 4 the error rises to 1e-6 ) thus TEST_F(Sphbes, SeriesAndRecurrence) is removed.

Copy link

@jinzx10 jinzx10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the current test grid is uniform. Is it possible to add some extra-fine sample points near 0, like 0.01, 0.001, 0.0001, 0.00001...? (no necessarily a log grid with base 10)

@jieli-matrix
Copy link
Author

I have added data points around 0 with a data range that spans from 1e-7 to 1e-2 in a log grid with base 2, and all tests have passed. cc: @jinzx10

@jinzx10
Copy link

jinzx10 commented Sep 19, 2023

It seems sphbes.m still has some problems:

  1. xm on line 9 is undefined;
  2. sphbes(0, 0) is not computed correctly;
  3. even if nu and x have the same shape, if x contains some 0, arguments passed to besselj would have different sizes, thereby causing an error;
  4. js is not preallocated; "js(~x) = 0" would produce an array of size 0.
  5. if I remember correctly, nzind = find(x) would produce a column vector. If nu & x are matrices, the arguments passed to besselj would have mismatched sizes since x(nzind) would be a column vector.

PS: if you feel writing a robust sphbes function is tedious and unnecessary, maybe removing those matlab/octave scripts is just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add accuracy tests for mathematical functions in two-center integral

3 participants