## Numerical Integration Utility for f(x) = √ x sin(x)

This page contains a routine that calculates the definite integral of the above function on the interval specified by the user. Presently, an exact solution for this integral does not exist. The routine included on this page is written in JavaScript, so make sure that JavaScript is enabled in your browser.

**References:**

Author: David K. Kahaner. Scientific Computing Division, NBS

From the book "Numerical Methods and Software" by

D. Kahaner, C. Moler, and S. Nash

Prentice Hall, 1988

The original sub-routines were written in FORTRAN and have been translated to Javascript here. Although all care has been taken to ensure that the sub-routines were translated accurately, some errors may have crept into the translation. These errors are mine; the original FORTRAN routines have been thoroughly tested and work properly. Please report any errors to the webmaster.

To use this utility, the user must enter two values:

**b** and **c**, which specify the range [b, c], over which the function will be integrated. **b** and **c** must be entered as *radians*, NOT degrees, and they must both be greater than or equal to zero. If a negative value is entered for either of them, an error message appears asking the user to try again.

Note that over intervals for which the function is negative the integral is negative too.

**IMPORTANT**: Note the Error Code returned.

Error Code = 0: Normal Completion. e < eps (= 1.0e-12) and e < eps*abs(I).

Error Code = 1: Normal Completion. e < eps but e > eps*abs(I).

Error Code = 2: Normal Completion. e < eps*abs(I) but e > eps.

Error Code = 3: Normal completion but eps was too small to satisfy absolute or relative error request.

Error Code = 4: Aborted calculation because of serious rounding error. Probably e and I are consistent.

Error Code = 5: Aborted calculation because of insufficient storage. I and e are consistent.

Error Code = 6: Aborted calculation because of serious difficulties meeting error request.

Error Code = 7: More than 2*NMAX (= 100) iterations of main loop. Subroutine aborted.

Return to Math Functions Page

Return to Thothworks Home Page