Class RealSequence

java.lang.Object
RealSequence

public class RealSequence
extends java.lang.Object
This is a class of immutable zero-based immutible sequences taking on real values.
  • Constructor Summary

    Constructors
    Constructor Description
    RealSequence​(java.util.function.IntToDoubleFunction seq)
    This constructor accepts as parameter a lambda that maps nonnegaative integers to doubles.
  • Method Summary

    Modifier and Type Method Description
    RealSequence add​(RealSequence that)
    This computes the entrywise sum of two sequences
    double at​(int n)
    this returns the sequence's value at n
    RealSequence butter​(java.util.function.DoubleUnaryOperator f)
    This butters a real function of a real variable over a sequence
    RealSequence convolution​(RealSequence that)
    This computes the convolution of two sequences
    RealSequence divide​(RealSequence that)
    This computes the entrywise quotient of two sequences
    static void main​(java.lang.String[] args)
    This is your testing playground.
    RealSequence multiply​(RealSequence that)
    This computes the entrywise product of two sequences
    double product​(int finish)
    This multiples the sequence between 0 and finish.
    double product​(int start, int finish)
    This multiplies the sequence between indices start and finish.
    RealSequence subtract​(RealSequence that)
    This computes the entrywise difference of two sequences
    double sum​(int finish)
    This sums the sequence between 0 and finish.
    double sum​(int start, int finish)
    This sums the sequence between indices start and finish.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RealSequence

      public RealSequence​(java.util.function.IntToDoubleFunction seq)
      This constructor accepts as parameter a lambda that maps nonnegaative integers to doubles.
      Parameters:
      seq - a lambda mapping nonnegative integers to doubles
  • Method Details

    • at

      public double at​(int n)
      this returns the sequence's value at n
      Parameters:
      n - the index we are evaluating the sequence at
      Returns:
      an
      Throws:
      java.lang.IllegalArgumentException - if n < 0
    • sum

      public double sum​(int start, int finish)
      This sums the sequence between indices start and finish.
      Parameters:
      start - the index where we begin summing
      finish - the index we end summing at
      Returns:
      sum(an, start <= n < finish)
    • sum

      public double sum​(int finish)
      This sums the sequence between 0 and finish.
      Parameters:
      finish - the index we end summing at
      Returns:
      sum(an, 0 <= n < finish)
    • add

      public RealSequence add​(RealSequence that)
      This computes the entrywise sum of two sequences
      Parameters:
      that - the RealSequence we are adding to this RealSequence
      Returns:
      this + that
    • subtract

      public RealSequence subtract​(RealSequence that)
      This computes the entrywise difference of two sequences
      Parameters:
      that - the RealSequence we are subtracting from this RealSequence
      Returns:
      this - that
    • multiply

      public RealSequence multiply​(RealSequence that)
      This computes the entrywise product of two sequences
      Parameters:
      that - the RealSequence we are multiplying by this RealSequence
      Returns:
      this*that
    • divide

      public RealSequence divide​(RealSequence that)
      This computes the entrywise quotient of two sequences
      Parameters:
      that - the RealSequence we are dividing by this RealSequence
      Returns:
      this/that
    • convolution

      public RealSequence convolution​(RealSequence that)
      This computes the convolution of two sequences
      Parameters:
      that - the RealSequence we are convolving with this RealSequence
      Returns:
      a sequence based on the mapping n -> sum(at(k)*that.at(n-k))
    • product

      public double product​(int start, int finish)
      This multiplies the sequence between indices start and finish.
      Parameters:
      start - the index where we begin summing
      finish - the index we end summing at
      Returns:
      product(an, start <= n < finish)
    • product

      public double product​(int finish)
      This multiples the sequence between 0 and finish.
      Parameters:
      finish - the index we end summing at
      Returns:
      product(an, 0 <= n < finish)
    • butter

      public RealSequence butter​(java.util.function.DoubleUnaryOperator f)
      This butters a real function of a real variable over a sequence
      Parameters:
      f - a lambda that maps doubles to doubles.
      Returns:
      a new sequence with f applied to each entry.
    • main

      public static void main​(java.lang.String[] args)
      This is your testing playground.
      Parameters:
      args - command-line arguments