## Numerical Integration Utility for f(M)   =   sin(M)

This page contains a routine that calculates the definite integral of the above function on the interval specified by the user. It 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 three values:
(i) b and c, which specify the range [b, c], over which the function will be integrated. b and c are time variables, from which M is calculated as M = ωt.
ω = 2π/T, where T is the period of the motion.
(ii) T, the period of the motion.
Make sure that b, c, and T are the same units. They could be seconds, hours, days, or years, so long as all three are the same.

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 T/2 is 2/ω while the integral of this function from T/2 to T is -2/ω. Consequently, integrating this function over one complete cycle--from t = 0 to t = T--returns the result 2/ω + (-2/ω) = 0.

IMPORTANT: Note the Error Code returned.

Enter the interval, [b, c], over which the definite integral for this function will be calculated. Also enter T, the period of the motion. Then click the "Integrate" button to calculate the definite integral of this function over the specified interval.

b: c: T:

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.