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

Variable Index

 o COMPOSEDWITH
Static constant corresponding to the composition combine mode.
 o CONSTANT
Static constant corresponding to a constant function when used for the combineMode
 o DIVIDEDBY
Static constant corresponding to the division combine mode.
 o IDENTITY
Static constant corresponding to the indentity function
 o MINUS
Static constant corresponding to the subtraction combine mode.
 o NORMAL
Static constant corresponding to the default combine mode.
 o PLUS
Static constant corresponding to the additive combine mode.
 o TIMES
Static constant corresponding to the multiplicative combine mode.
 o combineMode
Parameter used to keep track of the method of combining functions
 o constantValue
The value used for the constant when in CONSTANT combineMode.
 o title
The title used to describe the function

Constructor Index

 o EDU.emporia.mathtools.MathFunction()
no-argument constructor.
 o 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
 o EDU.emporia.mathtools.MathFunction(double)
A version of the constructor that will create a constant function based on the specified constant.

Method Index

 o composedWith(MathFunction)
Creates a new MathFunction object that correponds to the composition of this one with the specified MathFunction
 o dividedBy(MathFunction)
Creates a new MathFunction object that is the quotient of this one with the one specified
 o functionValue(double)
Gets the value of the function at the specified x-value
 o getPoint(double)
Gets the point on the graph of the function at the specified x-coordinate
 o getPoints(double, double, int)
Gets an array of points between the two indicated x-values
 o 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
 o getTitle()
Gets the title to be displayed to describe the function.
 o minus(MathFunction)
Creates a new MathFunction object that is the difference of this one with the one specified
 o minus(double)
Creates a new MathFunction object that is the difference of this one with the constant specified
 o pickRandom(double, double)
Picks a random number between the specifiend numbers
 o plus(MathFunction)
Creates a new MathFunction object that is the sum of this one with the one specified
 o plus(double)
Creates a new MathFunction object that is the sum of this one with the constant specified
 o 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
 o probablyEquals(MathFunction, double, double)
Version of the probablyEquals method that allows the sampling interval to be specified
 o setTitle(String)
Sets the title to be displayed to describe the function.
 o times(MathFunction)
Creates a new MathFunction object that is the product of this one with the one specified
 o times(double)
Creates a new MathFunction object that is the product of this one with the constant specified

Variables

 o COMPOSEDWITH
public static final int COMPOSEDWITH
Static constant corresponding to the composition combine mode.

 o CONSTANT
public static final int CONSTANT
Static constant corresponding to a constant function when used for the combineMode

 o DIVIDEDBY
public static final int DIVIDEDBY
Static constant corresponding to the division combine mode.

 o IDENTITY
public static final EDU.emporia.mathtools.MathFunction IDENTITY
Static constant corresponding to the indentity function

 o MINUS
public static final int MINUS
Static constant corresponding to the subtraction combine mode.

 o NORMAL
public static final int NORMAL
Static constant corresponding to the default combine mode. Results in the identity function

 o PLUS
public static final int PLUS
Static constant corresponding to the additive combine mode.

 o TIMES
public static final int TIMES
Static constant corresponding to the multiplicative combine mode.

 o combineMode
protected int combineMode
Parameter used to keep track of the method of combining functions

 o constantValue
protected double constantValue
The value used for the constant when in CONSTANT combineMode.

 o title
protected java.lang.String title
The title used to describe the function

Constructors

 o MathFunction
public MathFunction()
no-argument constructor. Correponds to the identity function

 o 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
 o 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

Methods

 o 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
 o 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
 o 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
 o 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
 o 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
 o 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.
 o 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.
 o 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.
 o 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
 o 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
 o 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.
 o 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
 o 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
 o 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
 o 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.
 o 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
 o 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