papaya
Class Polynomial

java.lang.Object
  extended by papaya.Polynomial

public final class Polynomial
extends Object

Static Class for casting one variable type to another.

Author:
Nur Adila Faruk Senan

Method Summary
static double[] polyval(double[] x, double[] coeff)
          y = polyval(x,coeff) returns the array values of a polynomial of degree n evaluated at each element of x.
static double polyval(double x, double[] coeff)
          y = polyval(x,coeff) returns the value of a polynomial of degree n evaluated at x.
static float[] polyval(float[] x, float[] coeff)
          y = polyval(x,coeff) returns the value of a polynomial of degree n evaluated at x.
static float polyval(float x, float[] coeff)
          y = polyval(x,coeff) returns the value of a polynomial of degree n evaluated at x.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

polyval

public static double polyval(double x,
                             double[] coeff)
                      throws ArithmeticException
y = polyval(x,coeff) returns the value of a polynomial of degree n evaluated at x. The input argument coeff is an array of length n+1 whose elements are the coefficients in descending powers of the polynomial to be evaluated.

y = coeff[0]*x^n + coeff[1]*x^(n-1) + .... + coeff[n-1]*x + coeff[n].

E.g. for a quadratic function, y = coeff[0]*x^2 + coeff[1]*x + coeff[2].

Parameters:
x - argument to the polynomial.
coeff - the coefficients of the polynomial.
Throws:
ArithmeticException

polyval

public static double[] polyval(double[] x,
                               double[] coeff)
                        throws ArithmeticException
y = polyval(x,coeff) returns the array values of a polynomial of degree n evaluated at each element of x. The input argument coeff is an array of length n+1 whose elements are the coefficients in descending powers of the polynomial to be evaluated.

y = coeff[0]*x^n + coeff[1]*x^(n-1) + .... + coeff[n-1]*x + coeff[n].

E.g. for a quadratic function, y = coeff[0]*x^2 + coeff[1]*x + coeff[2].

Parameters:
x - array argument to the polynomial.
coeff - the coefficients of the polynomial.
Throws:
ArithmeticException

polyval

public static float polyval(float x,
                            float[] coeff)
                     throws ArithmeticException
y = polyval(x,coeff) returns the value of a polynomial of degree n evaluated at x. The input argument coeff is an array of length n+1 whose elements are the coefficients in descending powers of the polynomial to be evaluated.

y = coeff[0]*x^n + coeff[1]*x^(n-1) + .... + coeff[n-1]*x + coeff[n].

E.g. for a quadratic function, y = coeff[0]*x^2 + coeff[1]*x + coeff[2].

Parameters:
x - argument to the polynomial.
coeff - the coefficients of the polynomial.
Throws:
ArithmeticException

polyval

public static float[] polyval(float[] x,
                              float[] coeff)
                       throws ArithmeticException
y = polyval(x,coeff) returns the value of a polynomial of degree n evaluated at x. The input argument coeff is an array of length n+1 whose elements are the coefficients in descending powers of the polynomial to be evaluated.

y = coeff[0]*x^n + coeff[1]*x^(n-1) + .... + coeff[n-1]*x + coeff[n].

E.g. for a quadratic function, y = coeff[0]*x^2 + coeff[1]*x + coeff[2].

Parameters:
x - array argument to the polynomial.
coeff - the coefficients of the polynomial.
Throws:
ArithmeticException


Processing library papaya by Adila Faruk. (C) 2014