Numerical Integration Utility: Definite Integral of sin(x)

 

This page contains a routine that calculates the definite integral of sin(x) on an interval specified by the user.

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
∫ sin(x) dx will be computed.   b and c must be entered as radians, NOT degrees.

Note that over intervals for which the function is negative the integral is negative too. For example, the integral of this function from 0 to π is 2 while the integral of this function from π to 2 π is   -2. Consequently, integrating this function over one complete cycle--   from x = 0 to x = 2 π   --returns the result 2 + (-2) = 0.

IMPORTANT: Note the Error Code returned.

Enter the interval [b, c] over which   ∫ sin(x) dx is to be calculated. Then click the "Integrate" button.

(Remember,   b and c must be entered as radians, NOT degrees.)
b: c:

The value of the definite integral over the specified interval is:

I   =  

Number of Function Evaluations:

e-value, an estimate of abs(integral - I):

Error Code:

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

AKiTi.ca Home