Computational Physics Laboratory PHZ4151C/PHZ5156C
  Spring 2009

  Class Meetings: HCB 0219, Tuesday and Thursday from 2:00 to 3:15 PM

  Office Hours: Wednesday 4:00 - 5:00 or upon appointment

  Course Text: David Yevick, A First Course in Computational Physics and Object-Oriented Programming with C++

Introduction to Numerical Integration: The IntegralCalculator


Use class IntegratorCalculator to integrate the function below and determine the solution to 6 decimal places. The class is to utilize the Composite 3-Point Simpson Method to perform the numerical integration, and repeats the process, doubling the number of intervals each time, until the desired precision is reached.




Example:
> ./IntegratorCalculator

Output:
Lower limit: 0
Upper limit: 5
Initial number of intervals: 1
Maximum permissible error: 0.0000001

Integral (2097152 intervals) = 2.605159

Source Code