plf
Class Function_1D

java.lang.Object
  extended by plf.Function_1D

public class Function_1D
extends java.lang.Object

This class allows the user to define a piecewise linear function.


Constructor Summary
Function_1D(java.lang.String name, double min_x_value, double max_x_value, double[] y_values)
          The constructor stores the function value defintions.
Function_1D(java.lang.String name, double min_x_value, double max_x_value, int[] y_values)
          The constructor stores the function value defintions.
 
Method Summary
 Function_1D Differentiate(java.lang.String name)
          Get the differentiated curve values.
 double getValue(double x_value)
          Get the function value for a given input value.
 double[] getValues()
          Get the function y_values for all input values as an array.
 java.util.ArrayList<java.lang.Double> getZeros()
          Get the zero crossing x_values, if any.
 Function_1D Integrate(java.lang.String name)
          Get the integrated curve values.
 void Print()
          Formats the function definition into a string and prints it.
 java.lang.String toString()
          Formats the function definition into a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Function_1D

public Function_1D(java.lang.String name,
                   double min_x_value,
                   double max_x_value,
                   double[] y_values)
            throws java.lang.Exception
The constructor stores the function value defintions. The min_x-value and max_x_value represent the domain range for the function. The y_values must be the values for equally spaced x_values, including the bounds of the domain. This function assumes that the sequence of value pairs defines an adequate approximation of a continuous function over the interval of x_values.

Parameters:
name - The name of the function represented.
min_x_value - The minimum x_value.
max_x_value - The maximum x_value.
y_values - The array of y-axis values.
Throws:
java.lang.Exception - if discrepencies are identified.

Function_1D

public Function_1D(java.lang.String name,
                   double min_x_value,
                   double max_x_value,
                   int[] y_values)
            throws java.lang.Exception
The constructor stores the function value defintions. The min_x-value and max_x_value represent the domain range for the function. The y_values must be the values for equally spaced x_values, including the bounds of the domain. This function assumes that the sequence of value pairs defines an adequate approximation of a continuous function over the interval of x_values.

Parameters:
name - The name of the function represented.
min_x_value - The minimum x_value.
max_x_value - The maximum x_value.
y_values - The array of integer y-axis values.
Throws:
java.lang.Exception - if discrepencies are identified.
Method Detail

getValue

public double getValue(double x_value)
                throws java.lang.Exception
Get the function value for a given input value.

Parameters:
x_value - the argument to the function.
Returns:
the y_value approximation.
Throws:
java.lang.Exception

getValues

public double[] getValues()
Get the function y_values for all input values as an array.

Returns:
the y_values array.

Integrate

public Function_1D Integrate(java.lang.String name)
                      throws java.lang.Exception
Get the integrated curve values.

Parameters:
name - The name for the new function.
Returns:
the integrated function.
Throws:
java.lang.Exception

Differentiate

public Function_1D Differentiate(java.lang.String name)
                          throws java.lang.Exception
Get the differentiated curve values.

Parameters:
name - The name for the new function.
Returns:
the differentiated function.
Throws:
java.lang.Exception

getZeros

public java.util.ArrayList<java.lang.Double> getZeros()
Get the zero crossing x_values, if any. Remember that zero crossings can be lost by using too course a step in piecewise linear functions.

Returns:
the ArrayList of estimated zero crossing x-values.

toString

public java.lang.String toString()
Formats the function definition into a string.

Overrides:
toString in class java.lang.Object

Print

public void Print()
Formats the function definition into a string and prints it.