bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl]Doc bug?


From: Terry Reedy
Subject: [Bug-gsl]Doc bug?
Date: Sat, 01 Mar 2003 16:51:07 -0500

Reference Manual
Edition 1.3, for GSL Version 1.3
11 December 2002

Chapter on Special Functions has text quoted below.

These three lines (repeated twice, once in each example) do not seem
to match:
*  double expected = -0.17759677131433830434739701;
* printf("exact   = %.18f\n", expected);
*  exact   = -0.177596771314338292
I expected  -0.177596771314338304 for last based on first and second.

Terry J. Reedy

"
The following example demonstrates the use of the error handling form
of the special functions, in this case to compute the Bessel function
J_0(5.0),

#include <stdio.h>
#include <gsl/gsl_sf_bessel.h>

int
main (void)
{
  double x = 5.0;
  gsl_sf_result result;

  double expected = -0.17759677131433830434739701;

  int status = gsl_sf_bessel_J0_e (x, &result);

  printf("status  = %s\n", gsl_strerror(status));
  printf("J0(5.0) = %.18f\n"
         "      +/- % .18f\n",
         result.val, result.err);
  printf("exact   = %.18f\n", expected);
  return status;
}

Here are the results of running the program,

$ ./a.out
status  = success
J0(5.0) = -0.177596771314338292
      +/-  0.000000000000000193
exact   = -0.177596771314338292

The next program computes the same quantity using the natural form of
the function. In this case the error term result.err and return status
are not accessible.

#include <stdio.h>
#include <gsl/gsl_sf_bessel.h>

int
main (void)
{
  double x = 5.0;
  double expected = -0.17759677131433830434739701;

  double y = gsl_sf_bessel_J0 (x);

  printf("J0(5.0) = %.18f\n", y);
  printf("exact   = %.18f\n", expected);
  return 0;
}

The results of the function are the same,

$ ./a.out
J0(5.0) = -0.177596771314338292
exact   = -0.177596771314338292






reply via email to

[Prev in Thread] Current Thread [Next in Thread]