0% found this document useful (0 votes)
20 views

S17aec cl05

dsfgsdf

Uploaded by

Khhg Agdds
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

S17aec cl05

dsfgsdf

Uploaded by

Khhg Agdds
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

s – Approximations of Special Functions s17aec

nag bessel j0 (s17aec)

1. Purpose
nag bessel j0 (s17aec) returns the value of the Bessel function J0 (x).

2. Specification
#include <nag.h>
#include <nags.h>
double nag_bessel_j0(double x, NagError *fail)

3. Description
The function evaluates the Bessel function of the first kind, J0 (x).
The approximation is based on Chebyshev expansions.
For x near zero, J0 (x)  1. This approximation is used when x is sufficiently small for the result
to be correct to machine precision.
For very large x, it becomes impossible to provide results with any reasonable accuracy (see Section
6.1), hence the function fails. Such arguments contain
 insufficient information to determine the
phase of oscillation of J0 (x); only the amplitude, 2/π|x|, can be determined and this is returned.
The range for which this occurs is roughly related to the machine precision; the function will fail
if |x| ∼
> 1/machine precision.

4. Parameters
x
Input: the argument x of the function.
fail
The NAG error parameter, see the Essential Introduction to the NAG C Library.

5. Error Indications and Warnings


NE REAL ARG GT
On entry, x must not be greater than value: x = value. 
x is too large, the function returns the amplitude of the J0 oscillation, 2/π|x|.

6. Further Comments
6.1. Accuracy
Let δ be the relative error in the argument and E be the absolute error in the result. (Since J0 (x)
oscillates about zero, absolute error and not relative error is significant.)
If δ is somewhat larger than the machine precision (e.g. if δ is due to data errors etc.), then E
and δ are approximately related by E  |xJ1 (x)| δ (provided E is also within machine bounds).
However, if δ is of the same order as machine precision, then rounding errors could make E
slightly larger than the above relation predicts.

For very large x,the above relation ceases to apply. In this region, J0 (x)  2/π|x| cos(x − π/4).
The amplitude 2/π|x| can be calculated with reasonable accuracy for all x, but cos(x − π/4)
cannot. If x − π/4 is written as 2N π + θ where N is an integer and 0 ≤ θ < 2π, then cos(x − π/4)
is determined by θ only. If x ∼> δ −1 , θ cannot be determined with any accuracy at all. Thus if x is

greater than, or of the order of, the inverse of the machine precision, it is impossible to calculate
the phase of J0 (x) and the function must fail.

[NP3275/5/pdf] 3.s17aec.1
nag bessel j0 NAG C Library Manual

6.2. References
Abramowitz M and Stegun I A (1968) Handbook of Mathematical Functions Dover Publications,
New York ch 9 p 358.
Clenshaw C W (1962) Mathematical Tables, Chebyshev series for mathematical functions National
Physical Laboratory H.M.S.O. 5.

7. See Also
nag bessel j1 (s17afc)

8. Example
The following program reads values of the argument x from a file, evaluates the function at each
value of x and prints the results.
8.1. Program Text
/* nag_bessel_j0(s17aec) Example Program
*
* Copyright 1990 Numerical Algorithms Group.
*
* Mark 2 revised, 1992.
*/
#include <nag.h>
#include <stdio.h>
#include <nag_stdlib.h>
#include <nags.h>

main()
{
double x, y;
/* Skip heading in data file */
Vscanf("%*[^\n]");
Vprintf("s17aec Example Program Results\n");
Vprintf(" x y\n");
while (scanf("%lf", &x) != EOF)
{
y = s17aec(x, NAGERR_DEFAULT);
Vprintf("%12.3e%12.3e\n", x, y);
}
exit(EXIT_SUCCESS);
}
8.2. Program Data
s17aec Example Program Data
0.0
0.5
1.0
3.0
6.0
8.0
10.0
-1.0
1000.0

3.s17aec.2 [NP3275/5/pdf]
s – Approximations of Special Functions s17aec

8.3. Program Results


s17aec Example Program Results
x y
0.000e+00 1.000e+00
5.000e-01 9.385e-01
1.000e+00 7.652e-01
3.000e+00 -2.601e-01
6.000e+00 1.506e-01
8.000e+00 1.717e-01
1.000e+01 -2.459e-01
-1.000e+00 7.652e-01
1.000e+03 2.479e-02

[NP3275/5/pdf] 3.s17aec.3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy