jhplot
Class F1D

java.lang.Object
  extended by jhplot.DrawOptions
      extended by jhplot.F1D
All Implemented Interfaces:
Serializable

public class F1D
extends DrawOptions
implements Serializable

Create a function in 1D. The function name could have parameters named in unique way as P0, P1, P2 ... They have to be replaced with values using setPar() method for evaluation

See Also:
Serialized Form

Constructor Summary
F1D(hep.aida.IFunction iname)
          Create a F1D function from JAIDA IFunction.
F1D(hep.aida.IFunction iname, double min, double max)
          Create a F1D function from JAIDA IFunction.
F1D(graph.ParseFunction function, double min, double max)
          Build a function.
F1D(String name)
          Create a function in 1D for evaluation.
F1D(String name, boolean parse)
          Build a function
F1D(String title, double[] pars, double min, double max, boolean parse)
          Create a polynomial analytical function using a list of values.
F1D(String name, double min, double max)
          Create a function in 1D.
F1D(String name, double min, double max, boolean parsed)
          Same function, but one can specify is it parsed or not.
F1D(String title, hep.aida.IFunction iname, double min, double max)
          Create F1D function from JAIDA IFunction.
F1D(String title, graph.ParseFunction function, double min, double max)
          Create a function in 1D.
F1D(String title, String name)
          Create new function.
F1D(String title, String name, double min, double max)
          Create a function in 1D.
F1D(String title, String name, double min, double max, boolean parse)
          Create a new function.
 
Method Summary
 double[] differentiate(int N, double min, double max)
          Numerical differentiation.
 void doc()
          Show online documentation.
 void eval()
          Evaluate a function for graphic representation.
 double eval(double x)
          Evaluate a function at a specific point in x
 double[] eval(double[] x)
          Evaluate a function for an array of x-values
 void eval(double min, double max)
          Evaluate a function for graphic representation.
 void eval(double min, double max, int Npoints)
          Evaluate a function for graphic representation.
 hep.aida.IFunction getIFunction()
          Return AIDA function
 double getMax()
          Get the maximum value in X
 double getMin()
          Get the minimum value in X
 String getName()
          Get the name of the function used for evaluation
 graph.ParseFunction getParse()
          Return parsed function.
 int getPoints()
          Get the number of points
 String getTitle()
          Get a function title
 double getX(int i)
          Get value in X-axis
 double getY(int i)
          Get value in Y-axis
 double integral(int N, double min, double max)
          Numerical integration using trapezium rule.
 double integral(String type, int N, double min, double max)
          Numerical integration.
 boolean parse()
          Parse the function.
 void setMax(double max)
          Set the maximum value in X
 void setMin(double min)
          Set Min value in X
 void setName(String name)
          Sets a name of the function, i.e.
 void setPar(String parameter, double value)
          Replace abstract parameter with the value (double).
 void setPar(String parameter, int value)
          Replace abstract parameter with the value (integer).
 void setPoints(int bins)
          Sets the number points between Min and Max for evaluation
 void setTitle(String title)
          Sets a new title of a function
 void toTable()
          Print the F1D function to a Table in a separate Frame.
 void toTable(boolean format)
          Print the F1D function to a Table in a separate Frame.
 
Methods inherited from class jhplot.DrawOptions
copyLinePars, getBinWidth, getColor, getDrawOption, getDrawOptions, getLegend, getLineParm, getNameX, getNameY, getNameZ, getSymbol, getType, isBars, printDrawOptions, printDrawOptions, setBars, setBinWidth, setColor, setDrawLine, setDrawLineKey, setDrawOption, setDrawSymbol, setErr, setErrAll, setErrColor, setErrColor, setErrColorX, setErrColorY, setErrFill, setErrFillColor, setErrFillColor, setErrSys, setErrSysFill, setErrSysFillColor, setErrSysFillColor, setErrSysX, setErrSysY, setErrTicSize, setErrX, setErrY, setFill, setFillColor, setFillColorTransparency, setGraphStyle, setLegend, setNameX, setNameY, setNameZ, setPenDash, setPenDash, setPenWidth, setPenWidthErr, setPenWidthErrSys, setStyle, setSymbol, setSymbolSize, setType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

F1D

public F1D(String name,
           double min,
           double max)
Create a function in 1D. 500 points are used between Min and Max for evaluation. The title is set to the function's definition The function may have up to 3 independent variables in it (x,y,z).

Known Bugs This class is not fool proof. If the answer is wrong then use the parenthesis to force the order of evaluation. The most likely place this will be needed is in the use of the power command. The exponent is not evaluated correctly if it begins with a unary operator.

List of commands

Parameters:
name - String representing the function's definition
min - Min value
max - Max value

F1D

public F1D(String name,
           double min,
           double max,
           boolean parsed)
Same function, but one can specify is it parsed or not.

Parameters:
name - Name
min - Min value
max - Max value
parsed - parsed or not.

F1D

public F1D(String name)
Create a function in 1D for evaluation. The function may have one independent variable: x

If the answer is wrong then use the parenthesis to force the order of evaluation. The most likely place this will be needed is in the use of the power command. The exponent is not evaluated correctly if it begins with a unary operator.

List of commands

Parameters:
name - String representing the function

F1D

public F1D(String title,
           String name)
Create new function.

Parameters:
title - title
name - definition

F1D

public F1D(String title,
           String name,
           double min,
           double max,
           boolean parse)
Create a new function. The function may have up to 3 independent variables in it (x,y,z).

Known Bugs This class is not fool proof. If the answer is wrong then use the parenthesis to force the order of evaluation. The most likely place this will be needed is in the use of the power command. The exponent is not evaluated correctly if it begins with a unary operator.

List of commands

Parameters:
title - title
name - definition
min - min value
max - max value
parse - parset or not

F1D

public F1D(String title,
           double[] pars,
           double min,
           double max,
           boolean parse)
Create a polynomial analytical function using a list of values. Example: pars[0]+pars[1]*x+pars[2]*x*x +pars[3]*x*x*x

Parameters:
title - Title of this function
pars - array of coefficients for polynomial function
min - Min value for evaluation
max - Max value for evaluation
parse - set true if it should be parsed

F1D

public F1D(String name,
           boolean parse)
Build a function

Parameters:
name - name
parse - is parsed or not?

F1D

public F1D(String title,
           graph.ParseFunction function,
           double min,
           double max)
Create a function in 1D. 500 points are used between Min and Max for evaluation. The function may have up to 3 independent variables in it (x,y,z).

Known Bugs This class is not fool proof. If the answer is wrong then use the parenthesis to force the order of evaluation. The most likely place this will be needed is in the use of the power command. The exponent is not evaluated correctly if it begins with a unary operator.

List of commands

Parameters:
title - Title
function - ParseFunction representing the function
min - Min value
max - Max value

F1D

public F1D(graph.ParseFunction function,
           double min,
           double max)
Build a function.

Parameters:
function - input
min - Min value
max - Max value

F1D

public F1D(String title,
           String name,
           double min,
           double max)
Create a function in 1D. 500 points are used between Min and Max for evaluation. Function will be parsed.

Parameters:
title - String representing the title
name - String representing the function's definition
min - Min value
max - Max value

F1D

public F1D(hep.aida.IFunction iname,
           double min,
           double max)
Create a F1D function from JAIDA IFunction. By default, 500 points for evaluation are used

Parameters:
iname - input IFunction
min - Min value
max - Max value

F1D

public F1D(hep.aida.IFunction iname)
Create a F1D function from JAIDA IFunction. By default, 500 points for evaluation are used

Parameters:
iname - input IFunction

F1D

public F1D(String title,
           hep.aida.IFunction iname,
           double min,
           double max)
Create F1D function from JAIDA IFunction. By default 500 points are used

Parameters:
title - Title
iname - input IFunction
min - Min X values
max - Max X values
Method Detail

parse

public boolean parse()
Parse the function.

Parameters:
true - if parsed OK

eval

public double eval(double x)
Evaluate a function at a specific point in x

Parameters:
x - value in x for evaluation
Returns:
function value at x

eval

public double[] eval(double[] x)
Evaluate a function for an array of x-values

Parameters:
x - array of values in x for evaluation
Returns:
array of function values

eval

public void eval(double min,
                 double max)
Evaluate a function for graphic representation. Number of points for evaluations is 500.

Parameters:
Min - value in x
Max - value in x

eval

public void eval(double min,
                 double max,
                 int Npoints)
Evaluate a function for graphic representation. Number of points for evaluations is 500.

Parameters:
Min - value in x
Max - value in x
Number - of evaluation points

eval

public void eval()
Evaluate a function for graphic representation. Min and Max should be given in constructor.


doc

public void doc()
Show online documentation.


toTable

public void toTable()
Print the F1D function to a Table in a separate Frame. The numbers are formatted to scientific format. One can sort and search the data in this table (data cannot be modified)


toTable

public void toTable(boolean format)
Print the F1D function to a Table in a separate Frame. The numbers are formatted to scientific format. One can sort and search the data in this table (but not modify)

Parameters:
format - if false, numbers will not be formatted to scientific format.

setPar

public void setPar(String parameter,
                   double value)
Replace abstract parameter with the value (double). Case sensitive!

Parameters:
parameter - parameter name
value - value to be inserted

setPar

public void setPar(String parameter,
                   int value)
Replace abstract parameter with the value (integer). Case sensitive.

Parameters:
parameter - parameter name
value - value to be inserted.

getX

public double getX(int i)
Get value in X-axis

Parameters:
i - index
Returns:
value in X

getY

public double getY(int i)
Get value in Y-axis

Parameters:
i - index
Returns:
value in Y

setTitle

public void setTitle(String title)
Sets a new title of a function

Overrides:
setTitle in class DrawOptions
Parameters:
title - Title of a function

getTitle

public String getTitle()
Get a function title

Overrides:
getTitle in class DrawOptions
Returns:
Title of a function

setName

public void setName(String name)
Sets a name of the function, i.e. what will be used for evaluation

Parameters:
name - Name

getName

public String getName()
Get the name of the function used for evaluation

Returns:
Name

getIFunction

public hep.aida.IFunction getIFunction()
Return AIDA function

Returns:
IFunction

getParse

public graph.ParseFunction getParse()
Return parsed function. One can evaluate Y as: y =function.getResult(x), where function is what returned by this method.

Returns:
function

setMin

public void setMin(double min)
Set Min value in X

Parameters:
min - Minimum value

getMin

public double getMin()
Get the minimum value in X

Returns:
min Minimum value

setMax

public void setMax(double max)
Set the maximum value in X

Parameters:
max - Maximal value

getMax

public double getMax()
Get the maximum value in X

Returns:
Maximal value

setPoints

public void setPoints(int bins)
Sets the number points between Min and Max for evaluation

Parameters:
bins - Number of points

integral

public double integral(String type,
                       int N,
                       double min,
                       double max)
Numerical integration. Define types as:
type="gauss4" - Gaussian integration formula (4 points)
type="gauss8" - Gaussian integration formula (8 points)
type="richardson" - Richardson extrapolation
type="simpson" - using Simpson's rule.
type="trapezium" - trapezium rule.

Parameters:
type - type of algorithm. Can be: "gauss4","gauss8","richardson","simpson","trapezium".
N - the number of strips to use for integration
min - the first ordinate.
max - the last ordinate.
Returns:
integral

integral

public double integral(int N,
                       double min,
                       double max)
Numerical integration using trapezium rule.

Parameters:
N - the number of strips to use for integration
min - the first ordinate.
max - the last ordinate.
Returns:
integral

differentiate

public double[] differentiate(int N,
                              double min,
                              double max)
Numerical differentiation.

Parameters:
N - the number of points to use.
min - the first ordinate.
max - the last ordinate.
Returns:
array with differentials

getPoints

public int getPoints()
Get the number of points

Returns:
Number of points


jHepWork 3.0 ©