F2D
jhplot

Class F2D

  • All Implemented Interfaces:
    Serializable


    public class F2Dextends DrawOptionsimplements Serializable
    Create 2D function. The function may have up to 2 independent variables: x,y.

    Operators and functions

    the following operators are supported:

    • Addition: '2 + 2'
    • Subtraction: '2 - 2'
    • Multiplication: '2 * 2'
    • Division: '2 / 2'
    • Exponential: '2 ^ 2' or ** (raise to a power)
    • Unary Minus,Plus (Sign Operators): '+2 - (-2)'
    • Modulo: '2 % 2'
    the following functions are supported:
    • abs: absolute value
    • acos: arc cosine
    • asin: arc sine
    • atan: arc tangent
    • cbrt: cubic root
    • ceil: nearest upper integer
    • cos: cosine
    • cosh: hyperbolic cosine
    • exp: euler's number raised to the power (e^x)
    • floor: nearest lower integer
    • log: logarithmus naturalis (base e)
    • sin: sine
    • sinh: hyperbolic sine
    • sqrt: square root
    • tan: tangent
    • tanh: hyperbolic tangent

    It also recognizes the pi (or Pi) values;
    See Also:
    Serialized Form
    • Constructor Detail

      • F2D

        public F2D(String name)
        Create a function in 2D for evaluation. The function may have up to 2 independent variables: x,y.

        Operators and functions

        the following operators are supported:

        • Addition: '2 + 2'
        • Subtraction: '2 - 2'
        • Multiplication: '2 * 2'
        • Division: '2 / 2'
        • Exponential: '2 ^ 2' or ** (raise to a power)
        • Unary Minus,Plus (Sign Operators): '+2 - (-2)'
        • Modulo: '2 % 2'
        the following functions are supported:
        • abs: absolute value
        • acos: arc cosine
        • asin: arc sine
        • atan: arc tangent
        • cbrt: cubic root
        • ceil: nearest upper integer
        • cos: cosine
        • cosh: hyperbolic cosine
        • exp: euler's number raised to the power (e^x)
        • floor: nearest lower integer
        • log: logarithmus naturalis (base e)
        • sin: sine
        • sinh: hyperbolic sine
        • sqrt: square root
        • tan: tangent
        • tanh: hyperbolic tangent

        It also recognizes the pi (or Pi) values;
        Parameters:
        name - String representing the function
      • F2D

        public F2D(String title,   String name)
        Create new function.
        Parameters:
        title - title
        name - definition
      • F2D

        public F2D(String title,   String name,   double Xmin,   double Xmax,   double Ymin,   double Ymax)
        Create a function in 2D. Uses 500 points between min and max value for evaluation. The function may have up to 2 independent variables in it (x,y). Operators and functions

        the following operators are supported:
        • Addition: '2 + 2'
        • Subtraction: '2 - 2'
        • Multiplication: '2 * 2'
        • Division: '2 / 2'
        • Exponential: '2 ^ 2' or ** (raise to a power)
        • Unary Minus,Plus (Sign Operators): '+2 - (-2)'
        • Modulo: '2 % 2'
        the following functions are supported:
        • abs: absolute value
        • acos: arc cosine
        • asin: arc sine
        • atan: arc tangent
        • cbrt: cubic root
        • ceil: nearest upper integer
        • cos: cosine
        • cosh: hyperbolic cosine
        • exp: euler's number raised to the power (e^x)
        • floor: nearest lower integer
        • log: logarithmus naturalis (base e)
        • sin: sine
        • sinh: hyperbolic sine
        • sqrt: square root
        • tan: tangent
        • tanh: hyperbolic tangent


        Parameters:
        name - String representing the function.
        Xmin - Min value in X
        Xmax - Max value in X
        Ymin - Min value in Y
        Ymax - Max value in Y
      • F2D

        public F2D(String name,   double Xmin,   double Xmax,   double Ymin,   double Ymax)
        Build a 2D function. Title is set to the name.
        Parameters:
        name - Name
        Xmin - X-min
        Xmax - X-max
        Ymin - Y-min
        Ymax - Y-max
      • F2D

        public F2D(String title,   IFunction iname,   double Xmin,   double Xmax,   double Ymin,   double Ymax)
        Create a F2D function from JAIDA IFunction. By default, 500 points for evaluation are used
        Parameters:
        title - Title
        name - new function name
        iname - input IFunction
        Xmin - Min X value
        Xmax - Max X value
        Ymin - Min Y value
        Ymax - Max Y value
      • F2D

        public F2D(IFunction iname)
        Create a F2D function from JAIDA IFunction. By default, 500 points for evaluation are used.
        Parameters:
        iname -
      • F2D

        public F2D(IFunction iname,   double Xmin,   double Xmax,   double Ymin,   double Ymax)
        Create a F2D function from JAIDA IFunction.
        Parameters:
        iname - input IFunction
        Xmin - Min X value
        Xmax - Max X value
        Ymin - Min Y value
        Ymax - Max Y value
    • Method Detail

      • eval

        public double eval(double x,          double y)
        Evaluate a function at a specific point in (x,y)
        Parameters:
        x - value in x for evaluation
        y - value in y for evaluation
        Returns:
        function value at (x,y)
      • eval

        public double[][] eval(double[] x,              double[] y)
        Evaluate a function for an array of x-values
        Parameters:
        x - array of values in x for evaluation
        y - array of values in y for evaluation
        Returns:
        array of function values
      • setMinX

        public void setMinX(double min)
        Set Min in X
        Parameters:
        min - Min value
      • getMinX

        public double getMinX()
        Get Min value in X
        Returns:
        Min value in X
      • setMinY

        public void setMinY(double min)
        Set Min value in Y
        Parameters:
        min - Min value in Y
      • doc

        public void doc()
        Show online documentation.
      • getMinY

        public double getMinY()
        Get Min value in Y
        Returns:
        Min value in Y
      • setMaxX

        public void setMaxX(double max)
        Set Max value in X
        Parameters:
        max - Max value in X
      • 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
      • getMaxX

        public double getMaxX()
        Get Max value in X
        Returns:
        Max value in X
      • setMaxY

        public void setMaxY(double max)
        Set Max value in Y
        Parameters:
        max - Max value in Y
      • getMaxY

        public double getMaxY()
        Get Max value in Y
        Returns:
        Max value in Y
      • setPoints

        public void setPoints(int bins)
        Get the number of points
        Parameters:
        bins - Number of points
      • 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
      • getPoints

        public int getPoints()
        Get the number of points for evaluation of a function
        Returns:
        Number of points
      • integral

        public double integral(int N,              double minX,              double maxX,              double minY,              double maxY)
        Numerical integration using trapezium rule.
        Parameters:
        N - the number of strips to use for integration (in X and Y the same)
        minX - the first ordinate in X.
        maxX - the last ordinate in X.
        minY - the first ordinate in X.
        maxY - the last ordinate in Y.
        Returns:
        integral
      • getParse

        public Calculable getParse()
        Return parsed function. One can evaluate it as "calculate()".
        Returns:
        function
      • getH2D

        public H2D getH2D(String hname,         int hbinX,         double hminX,         double hmaxX,         int hbinY,         double hminY,         double hmaxY)
        Generate a 2D histogram from the F2D function using a custom number of bins and given min and max values.
        Parameters:
        hname - histogram name
        hbinX - number of X bins
        hminX - min value in X
        hmaxX - max value in X
        hbinY - number of bins in Y
        hminY - min value in Y
        hmaxY - max value in Y
        Returns:
        2D histogram from the function
      • isParsed

        public boolean isParsed()
        If the function is parsed correctly, return true. Use this check before drawing it.
        Returns:
        true if parsed.

SCaVis 1.7 © jWork.org