- #1
coccoinomane
- 19
- 0
Hi everybody!
I kindly request your help. I have to compute functions like
[tex]\frac{ \sin (r x) - r x \cos (r x)}{r^3}[/tex]
(primitive function of x sin(rx) )
or
[tex]\frac{ -r x (120 - 20 r^2 x^2 + r^4 x^4) cos(r x) +
5 (24 - 12 r^2 x^2 + r^4 x^4) \sin(r x)}{r^7}[/tex]
(primitive function of x^5 sin(rx) )
when both r and x varies.
The problem with these functions is that the sin and cos factors are very similar to each other when x approaches zero. This is a big issue: double precision is not enough to compute the difference because of roundoff errors or simply because 14-15 digits are not enough to distinguish the two factors.
I kind of solved the problem for the first function. In fact, I could express it up to a factor as the first order spherical bessel function:
[tex]j1(x) = \frac{\sin(x)/x - \cos(x)}{x}[/tex],
which is well computed in the GNU Scientific Library.
I need to calculate those functions to solve the integral I discussed in https://www.physicsforums.com/showthread.php?p=2028408#post2028408 and that uart helped me to solve.
Thank you very much for any suggestion,
Guido
I kindly request your help. I have to compute functions like
[tex]\frac{ \sin (r x) - r x \cos (r x)}{r^3}[/tex]
(primitive function of x sin(rx) )
or
[tex]\frac{ -r x (120 - 20 r^2 x^2 + r^4 x^4) cos(r x) +
5 (24 - 12 r^2 x^2 + r^4 x^4) \sin(r x)}{r^7}[/tex]
(primitive function of x^5 sin(rx) )
when both r and x varies.
The problem with these functions is that the sin and cos factors are very similar to each other when x approaches zero. This is a big issue: double precision is not enough to compute the difference because of roundoff errors or simply because 14-15 digits are not enough to distinguish the two factors.
I kind of solved the problem for the first function. In fact, I could express it up to a factor as the first order spherical bessel function:
[tex]j1(x) = \frac{\sin(x)/x - \cos(x)}{x}[/tex],
which is well computed in the GNU Scientific Library.
I need to calculate those functions to solve the integral I discussed in https://www.physicsforums.com/showthread.php?p=2028408#post2028408 and that uart helped me to solve.
Thank you very much for any suggestion,
Guido
Last edited: