Class AbstractRiemann

    • Field Summary

      Fields 
      Modifier and Type Field Description
      org.opensourcephysics.frames.PlotFrame plotFrame
      The plot frame to hold the graphs
      org.dalton.polyfun.Polynomial poly
      The poly to get the area under
      int subintervals
      Number of slices, or subintervals, in the interval
      double xLower
      The x-coordinate of the left side, or lower limit, of the interval
      double xUpper
      The x-coordinate of the right side, or upper limit, of the interval
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractRiemann​(org.dalton.polyfun.Polynomial polynomial, double xLower, double xUpper, int subintervals)
      Constructor
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      double calculateDeltaX()
      Calculate the width of a single slice.
      void configPlotFrame()
      Set the properties of the plot frame such as size, visibility, default close operation, and the preferred min and max of the x axis and the y axis.
      void drawRiemannSlices()
      Draw all the slices for this poly that are in the interval.
      abstract void drawSlice​(double leftBorder, double rightBorder)
      Draw a single slice, or subinterval, under the poly.
      double getIntervalArea()
      Estimate the area under the poly using Riemann sums.
      abstract double getSubintervalArea​(double leftBorder, double rightBorder)
      Estimate the area under the poly for the given slice, or subinterval.
      void plotAccFnc()
      Draw the accumulation function.
      void plotPolynomial()
      Draw the the poly on the plot frame.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • poly

        public org.dalton.polyfun.Polynomial poly
        The poly to get the area under
      • plotFrame

        public org.opensourcephysics.frames.PlotFrame plotFrame
        The plot frame to hold the graphs
      • xLower

        public double xLower
        The x-coordinate of the left side, or lower limit, of the interval
      • xUpper

        public double xUpper
        The x-coordinate of the right side, or upper limit, of the interval
      • subintervals

        public int subintervals
        Number of slices, or subintervals, in the interval
    • Constructor Detail

      • AbstractRiemann

        public AbstractRiemann​(org.dalton.polyfun.Polynomial polynomial,
                               double xLower,
                               double xUpper,
                               int subintervals)
        Constructor
        Parameters:
        polynomial - The poly to get the area under
        xLower - The x-coordinate of the left side, or lower limit, of the interval
        xUpper - The x-coordinate of the right side, or upper limit, of the interval
        subintervals - The number of slices, or subintervals, in the interval
    • Method Detail

      • getIntervalArea

        public double getIntervalArea()
        Estimate the area under the poly using Riemann sums.
        Returns:
        The estimated area under the curve
      • drawRiemannSlices

        public void drawRiemannSlices()
        Draw all the slices for this poly that are in the interval.
      • plotAccFnc

        public void plotAccFnc()
        Draw the accumulation function.
      • plotPolynomial

        public void plotPolynomial()
        Draw the the poly on the plot frame.
      • getSubintervalArea

        public abstract double getSubintervalArea​(double leftBorder,
                                                  double rightBorder)
        Estimate the area under the poly for the given slice, or subinterval. This is abstract because the implementation depends on which Riemann Rule you use.
        Parameters:
        leftBorder - The left x-coordinate of the slice
        rightBorder - The right x-coordinate of the slice
        Returns:
        The area of this slice.
      • drawSlice

        public abstract void drawSlice​(double leftBorder,
                                       double rightBorder)
        Draw a single slice, or subinterval, under the poly. This is abstract because the implementation depends on which Riemann Rule you use.
        Parameters:
        leftBorder - The left x-coordinate of the slice
        rightBorder - The right x-coordinate of the slice
      • configPlotFrame

        public void configPlotFrame()
        Set the properties of the plot frame such as size, visibility, default close operation, and the preferred min and max of the x axis and the y axis.
      • calculateDeltaX

        public double calculateDeltaX()
        Calculate the width of a single slice.
        Returns:
        a double of the delta