edu.unm.cs.cs251.lab02
Interface IntegralCalculator


public interface IntegralCalculator

An interface defining a class that is capable of performing integral approximations. This interface specifies one method, approximateIntegral(double, double, double, double, double), which should be implemented according to the project specification. All implementing classes should be able to compute the approximate integral of the function f(x)=|r*sin(n*x)|.

Version:
200801300120
Author:
Daniel Cannon <dccannon@cs.unm.edu>

Method Summary
 double approximateIntegral(double r, double n, double startX, double endX, double precision)
          Computes the approximate integral of the function f(x)= |r * sin(n*x)| over interval [startX, endX] and with the precision (delta) provided.
 

Method Detail

approximateIntegral

double approximateIntegral(double r,
                           double n,
                           double startX,
                           double endX,
                           double precision)
Computes the approximate integral of the function f(x)= |r * sin(n*x)| over interval [startX, endX] and with the precision (delta) provided. This method will be called by CalculatorDialog once the user has provided the necessary input and clicked "Calculate".

Parameters:
r - The radius, or vertical-stretch of the sine wave. This is the variable "r" in the function being integrated.
n - The periodDoes the actual c-modifier of the sine wave; the variable "n" in the function being integrated.
startX - The start point of the integration interval.
endX - The endpoint of the integration interval.
precision - The delta, or the width of the rectangles being summed to produce the approximation. The smaller the precision (assuming it's greater than 0), the more accurate the approximation.
Returns:
A double representing the approximate value of the integral of |r * sin(n*x)| over the interval [startX, endX].