Class EDU.emporia.mathtools.MathFunction
All Packages Class Hierarchy This Package Previous Next Index
Class EDU.emporia.mathtools.MathFunction
Object
|
+----EDU.emporia.mathtools.MathFunction
- public class MathFunction
- extends Object
- implements Graphable
A base class for all mathematical functions. It includes the capablility
of combining MathFunction objects to create new ones using composition,
addition, and multiplication
- Version:
- 1.0
- Author:
- Joe Yanik
- Since:
- 7/7/00
-
COMPOSEDWITH
- Static constant corresponding to the composition combine mode.
-
CONSTANT
- Static constant corresponding to a constant function when used
for the combineMode
-
DIVIDEDBY
- Static constant corresponding to the division combine mode.
-
IDENTITY
- Static constant corresponding to the indentity function
-
MINUS
- Static constant corresponding to the subtraction combine mode.
-
NORMAL
- Static constant corresponding to the default combine mode.
-
PLUS
- Static constant corresponding to the additive combine mode.
-
TIMES
- Static constant corresponding to the multiplicative combine mode.
-
combineMode
- Parameter used to keep track of the method of combining functions
-
constantValue
- The value used for the constant when in CONSTANT combineMode.
-
title
- The title used to describe the function
-
EDU.emporia.mathtools.MathFunction()
- no-argument constructor.
-
EDU.emporia.mathtools.MathFunction(MathFunction, int, MathFunction)
- A version of the constructor that will create a new MathFunction object from
two specified MathFunction objects according to the specified combineMode
-
EDU.emporia.mathtools.MathFunction(double)
- A version of the constructor that will create a constant function based on the
specified constant.
-
composedWith(MathFunction)
- Creates a new MathFunction object that correponds to the composition
of this one with the specified MathFunction
-
dividedBy(MathFunction)
- Creates a new MathFunction object that is the quotient of this one with
the one specified
-
functionValue(double)
- Gets the value of the function at the specified x-value
-
getPoint(double)
- Gets the point on the graph of the function at the specified x-coordinate
-
getPoints(double, double, int)
- Gets an array of points between the two indicated x-values
-
getPoints(double, double, double)
- Gets an array of points on the graph of the function between two specified
x-values with a distance of delta between subsequent x-values
-
getTitle()
- Gets the title to be displayed to describe the function.
-
minus(MathFunction)
- Creates a new MathFunction object that is the difference of this
one with the one specified
-
minus(double)
- Creates a new MathFunction object that is the difference of this
one with the constant specified
-
pickRandom(double, double)
- Picks a random number between the specifiend numbers
-
plus(MathFunction)
- Creates a new MathFunction object that is the sum of this one with
the one specified
-
plus(double)
- Creates a new MathFunction object that is the sum of this one with
the constant specified
-
probablyEquals(MathFunction)
- By sampling over the interval from -10 to 10 this method determines
whether or not the MathFunction appears to be equal to the
specified MathFunction object
-
probablyEquals(MathFunction, double, double)
- Version of the probablyEquals method that allows the sampling
interval to be specified
-
setTitle(String)
- Sets the title to be displayed to describe the function.
-
times(MathFunction)
- Creates a new MathFunction object that is the product of this one with
the one specified
-
times(double)
- Creates a new MathFunction object that is the product of this one with
the constant specified
COMPOSEDWITH
public static final int COMPOSEDWITH
- Static constant corresponding to the composition combine mode.
CONSTANT
public static final int CONSTANT
- Static constant corresponding to a constant function when used
for the combineMode
DIVIDEDBY
public static final int DIVIDEDBY
- Static constant corresponding to the division combine mode.
IDENTITY
public static final EDU.emporia.mathtools.MathFunction IDENTITY
- Static constant corresponding to the indentity function
MINUS
public static final int MINUS
- Static constant corresponding to the subtraction combine mode.
NORMAL
public static final int NORMAL
- Static constant corresponding to the default combine mode. Results
in the identity function
PLUS
public static final int PLUS
- Static constant corresponding to the additive combine mode.
TIMES
public static final int TIMES
- Static constant corresponding to the multiplicative combine mode.
combineMode
protected int combineMode
- Parameter used to keep track of the method of combining functions
constantValue
protected double constantValue
- The value used for the constant when in CONSTANT combineMode.
title
protected java.lang.String title
- The title used to describe the function
MathFunction
public MathFunction()
- no-argument constructor. Correponds to the identity function
MathFunction
public MathFunction(MathFunction f,
int combineMode,
MathFunction g)
- A version of the constructor that will create a new MathFunction object from
two specified MathFunction objects according to the specified combineMode
- Parameters:
- f - The first MathFunction object
- combineMode - A parameter that will determine the way in which they are combined
- g - The second MathFunction object
MathFunction
public MathFunction(double u)
- A version of the constructor that will create a constant function based on the
specified constant.
- Parameters:
- u - The constant to be used to define the constant function
composedWith
public EDU.emporia.mathtools.MathFunction composedWith(MathFunction f)
- Creates a new MathFunction object that correponds to the composition
of this one with the specified MathFunction
- Parameters:
- f - The MathFunction object to be composed with.
- Returns:
- The composition of the two
dividedBy
public EDU.emporia.mathtools.MathFunction dividedBy(MathFunction f)
- Creates a new MathFunction object that is the quotient of this one with
the one specified
- Parameters:
- f - The function to appear in the denominator of the quotient
- Returns:
- The quotient of the functions
functionValue
public double functionValue(double u)
- Gets the value of the function at the specified x-value
- Parameters:
- u - The x-value
- Returns:
- The function value at the given x-val;ue
getPoint
public EDU.emporia.mathtools.Point2D getPoint(double u)
- Gets the point on the graph of the function at the specified x-coordinate
- Parameters:
- u - The x-coordinate
- Returns:
- The point on the graph
getPoints
public EDU.emporia.mathtools.Point2D[] getPoints(double uMin,
double uMax,
int numberOfPoints)
- Gets an array of points between the two indicated x-values
- Parameters:
- uMin - The smallest x-value
- uMax - The largest x-value
- numberOfPoints - The number of points in the array
- Returns:
- An array of points between the two specified x-values
getPoints
public EDU.emporia.mathtools.Point2D[] getPoints(double uMin,
double uMax,
double delta)
- Gets an array of points on the graph of the function between two specified
x-values with a distance of delta between subsequent x-values
- Parameters:
- uMin - The smallest x-value
- uMax - The largest x-value
- delta - The distance between subsequent x-values
- Returns:
- An array of points on the graph of the function.
getTitle
public java.lang.String getTitle()
- Gets the title to be displayed to describe the function.
- Returns:
- The title to be displayed to describe the function.
minus
public EDU.emporia.mathtools.MathFunction minus(MathFunction f)
- Creates a new MathFunction object that is the difference of this
one with the one specified
- Parameters:
- f - The function to be subtracted
- Returns:
- The difference of the two functions.
minus
public EDU.emporia.mathtools.MathFunction minus(double c)
- Creates a new MathFunction object that is the difference of this
one with the constant specified
- Parameters:
- c - The constant to be subtracted
- Returns:
- The function minus the specified constant
pickRandom
public double pickRandom(double a,
double b)
- Picks a random number between the specifiend numbers
- Parameters:
- a - The lower bound of the interval
- b - The upper bound of the interval
- Returns:
- A random number in the specified interval
plus
public EDU.emporia.mathtools.MathFunction plus(MathFunction f)
- Creates a new MathFunction object that is the sum of this one with
the one specified
- Parameters:
- f - The function to be added
- Returns:
- The sum of the two functions.
plus
public EDU.emporia.mathtools.MathFunction plus(double c)
- Creates a new MathFunction object that is the sum of this one with
the constant specified
- Parameters:
- c - The constant to be added
- Returns:
- The function plus the specified constant
probablyEquals
public boolean probablyEquals(MathFunction f)
- By sampling over the interval from -10 to 10 this method determines
whether or not the MathFunction appears to be equal to the
specified MathFunction object
- Parameters:
- f - The function to compare to.
- Returns:
- True if they are probably equal. False otherwise
probablyEquals
public boolean probablyEquals(MathFunction f,
double xMin,
double xMax)
- Version of the probablyEquals method that allows the sampling
interval to be specified
- Parameters:
- f - The function to compare to
- xMin - The lower bound of the sampling interval
- xMax - The upper bound of the sampling interval
- Returns:
- True if the function appear to be equal. False otherwise
setTitle
public void setTitle(String title)
- Sets the title to be displayed to describe the function.
- Parameters:
- title - The title to be displayed to describe the function.
times
public EDU.emporia.mathtools.MathFunction times(MathFunction f)
- Creates a new MathFunction object that is the product of this one with
the one specified
- Parameters:
- f - The function to be multiplied
- Returns:
- The product of the function
times
public EDU.emporia.mathtools.MathFunction times(double c)
- Creates a new MathFunction object that is the product of this one with
the constant specified
- Parameters:
- c - The constant to be multiplied
- Returns:
- The product of the function and the specified constant
All Packages Class Hierarchy This Package Previous Next Index