com.hedgehog.math.functions
Class LegendrePolynomialFunction

java.lang.Object
  extended by com.hedgehog.HObject
      extended by com.hedgehog.math.functions.Function
          extended by com.hedgehog.math.functions.LegendrePolynomialFunction
All Implemented Interfaces:
java.lang.Comparable, java.util.Comparator

public class LegendrePolynomialFunction
extends Function

Title: LegendrePolynomialFunction - represents the Legendre polynomial function.<

Description: Legendre polynomial function.

Copyright: Copyright (c) Hedgehog Software 2007-2009.

Company: Hedgehog Software

Since:
1.0
Version:
1.1

Field Summary
protected  int n_order
          Order of polynomial.
 
Fields inherited from class com.hedgehog.math.functions.Function
method
 
Fields inherited from class com.hedgehog.HObject
mID, mName
 
Constructor Summary
LegendrePolynomialFunction()
          Default constructor.
LegendrePolynomialFunction(int n)
          Constructor.
LegendrePolynomialFunction(LegendrePolynomialFunction object)
          Copy constructor.
 
Method Summary
 double derivative(int k, double x)
          Returns the kth derivative of Pn(x).
 double firstDerivative(double x)
          Returns the first derivative of Pn(x).
 boolean isValid()
          Returns logical-true if a valid object, else logical-false.
 OneVariablePolynomial legendrePolynomial()
          Returns the Legendre polynomials (default is linear).
 java.util.Vector<HDouble> rootsInIntervalAToB(double a, double b)
          Returns the roots of Pn(x)=0 in the interval [a:b] for n=2,4,6,8,10,12,14 and 16.
 java.util.Vector<HDouble> rootsInIntervalMinus1ToPlus1()
          Returns the Vector of roots of Pn(x)=0 in the interval [-1:+1] for n=1,...,10.
 java.lang.String toString()
          Returns a String representation of a LegendrePolynomialFunction object.
 double value(double x)
          Returns the value of a Legendre polynomial given x.
 
Methods inherited from class com.hedgehog.math.functions.Function
getMethod, setMethod
 
Methods inherited from class com.hedgehog.HObject
clone, compare, compareTo, copy, equals, getID, getName, hashCode, hasID, hasName, setID, setName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

n_order

protected int n_order
Order of polynomial.

Constructor Detail

LegendrePolynomialFunction

public LegendrePolynomialFunction()
Default constructor. Sets the order to 0.


LegendrePolynomialFunction

public LegendrePolynomialFunction(int n)
                           throws java.lang.IllegalArgumentException
Constructor. Sets the order to the specified value.

Parameters:
n - Order of polynomial.
Throws:
java.lang.IllegalArgumentException - Thrown if n<0.

LegendrePolynomialFunction

public LegendrePolynomialFunction(LegendrePolynomialFunction object)
Copy constructor.

Parameters:
object - Object to copy.
Method Detail

derivative

public double derivative(int k,
                         double x)
Returns the kth derivative of Pn(x).

Parameters:
k - Order of derivative.
x - Value to evaluate kth derivative.
Returns:
The derivative of Pn(x).

firstDerivative

public double firstDerivative(double x)
Returns the first derivative of Pn(x).

Parameters:
x - Value of x to evaluate first derivative
Returns:
The first derivative of Pn(x).

legendrePolynomial

public OneVariablePolynomial legendrePolynomial()
                                         throws java.lang.IllegalArgumentException
Returns the Legendre polynomials (default is linear).

Returns:
The Legendre polynomial.
Throws:
java.lang.IllegalArgumentException

rootsInIntervalMinus1ToPlus1

public java.util.Vector<HDouble> rootsInIntervalMinus1ToPlus1()
Returns the Vector of roots of Pn(x)=0 in the interval [-1:+1] for n=1,...,10.

Returns:
The Vector of roots of Pn(x)=0.

rootsInIntervalAToB

public java.util.Vector<HDouble> rootsInIntervalAToB(double a,
                                                     double b)
Returns the roots of Pn(x)=0 in the interval [a:b] for n=2,4,6,8,10,12,14 and 16.

Parameters:
a - Minimum interval value.
b - Maximum interval value.
Returns:
The Vector of roots.

value

public double value(double x)
             throws java.lang.IllegalArgumentException
Returns the value of a Legendre polynomial given x.

Parameters:
x - Value of x to evaluate polynomial.
Returns:
The evaluation of Pn(x).
Throws:
java.lang.IllegalArgumentException

isValid

public boolean isValid()
Returns logical-true if a valid object, else logical-false. Simply confirms that n_order > 0.

Specified by:
isValid in class Function
Returns:
Logical-true if a valid object, else logical-false.

toString

public java.lang.String toString()
Returns a String representation of a LegendrePolynomialFunction object.

Overrides:
toString in class Function
Returns:
A String representation of a LegendrePolynomialFunction object.