Documentation API of the 'jhplot.F2D' Java class
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)
    • log10: logarithmus (base 10)
    • 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 is not in range. 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: logarithm natural (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. This is a ranged function. 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: logarithm natural (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. This is ranged function.
        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. Ranged function.
        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(String title,           Expression calc,           double Xmin,           double Xmax,           double Ymin,           double Ymax)
        Create a function in 2D. 500 points are used between Min and Max for evaluation. The function may have x as independent variable. Make sure that expression has 2 variables, x and y.
        Parameters:
        title - Title
        function - Expression after parsing and building
        Xmin - Min X value
        Xmax - Max X value
        Ymin - Min Y value
        Ymax - Max Y value
      • F2D

        public F2D(Expression calc,           double Xmin,           double Xmax,           double Ymin,           double Ymax)
        Create a function in 2D. 500 points are used between Min and Max for evaluation. The function may have x as independent variable. Make sure that expression has 2 variables, x and y.
        Parameters:
        title - Title
        function - Expression after parsing and building
        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. Unranged function.
        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
      • parse

        public boolean parse()
        Parse the function.
        Returns:
        true if parsed without problems.
      • 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
      • integral

        public double integral(double minX,                       double maxX,                       double minY,                       double maxY)
        Integral using fastest trapezium rule method. It uses the default number of points (500).
        Parameters:
        minX - the first ordinate in X.
        maxX - the last ordinate in X.
        minY - the first ordinate in X.
        maxY - the last ordinate in Y.
      • simplify

        public boolean simplify()
        Try to simplify this function. It is often useful to rewrite an expression in term of elementary functions (log, exp, frac, sqrt, implicit roots), using the "elementary()" before simplifying it. Retrieve the simplified name as a string using getName() method.
        Returns:
        false if error occurs. Retrieve this error as a string using getException().
      • getException

        public String getException()
        If error occurs at some step, this is the way to retrieve it.
        Returns:
        last exception happened in any method of this class.
      • elementary

        public boolean elementary()
        Convert this function rewrite in term of elementary functions (log, exp, frac, sqrt, implicit roots) This is useful before simplifying function. Retrieve the simplified name as a string using getName() method.
        Returns:
        false if error occurs. Retrieve this error as a string using getException().
      • expand

        public boolean expand()
        Convert this function rewrite in expanded form. Retrieve the expanded name as a string using getName() method.
        Returns:
        false if error occurs. Retrieve this error as a string using getException().
      • factorize

        public boolean factorize()
        Convert this function rewrite in factorized form (if can). Retrieve the expanded name as a string using getName() method.
        Returns:
        false if error occurs. Retrieve this error as a string using getException().
      • getParse

        public Expression 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.
      • toString

        public String toString()
        Get this function as a string.
        Overrides:
        toString in class Object
        Returns:
        Convert to string.

DMelt 1.2 © DataMelt by jWork.ORG

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)
    • log10: logarithmus (base 10)
    • 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

Warning: You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.