com.hedgehog.math.polynomials
Class TwoVariablePolynomial

java.lang.Object
  extended by com.hedgehog.HObject
      extended by com.hedgehog.math.polynomials.NVariablePolynomial
          extended by com.hedgehog.math.polynomials.TwoVariablePolynomial
All Implemented Interfaces:
ModelObject, java.lang.Comparable, java.util.Comparator

public class TwoVariablePolynomial
extends NVariablePolynomial

Title: TwoVariablePolynomial - represents a 2-variable polynomial.

Description: A 2-variable polynomial class.

Polynomials of 2 variables are frequently used when modelling surfaces.

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

Company: Hedgehog Software

Since:
1.0
Version:
1.1

Field Summary
 
Fields inherited from class com.hedgehog.math.polynomials.NVariablePolynomial
CONSTANT, CUBIC, LINEAR, QUADRATIC, terms
 
Fields inherited from class com.hedgehog.HObject
mID, mName
 
Constructor Summary
TwoVariablePolynomial()
          Default constructor.
TwoVariablePolynomial(TwoVariablePolynomial object)
          Coy constructor.
TwoVariablePolynomial(java.util.Vector<NVariableTerm> terms)
          Constructor.
 
Method Summary
 double evaluate(double x0, double y0)
          Evaluates the polynomial for the specified variable values.
 HDouble evaluate(HDouble x0, HDouble y0)
          HDouble version of evaluate().
 TwoVariablePolynomial firstDerivativeWithRespectToX()
          Returns the first derivative of this polynomial wrt x.
 TwoVariablePolynomial firstDerivativeWithRespectToY()
          Returns the first derivative of this polynomial wrt y.
 NVariablePolynomial toNVariablePolynomial()
          Converts this 2-vatiable polynomial to a general n-variable polynomial obect.
 org.w3c.dom.Element toXMLNode(org.w3c.dom.Document document, org.w3c.dom.Element documentRootNode)
          Returns the xml node of this object.
 
Methods inherited from class com.hedgehog.math.polynomials.NVariablePolynomial
add, addTerm, addTo, childModelObjects, cube, databaseInsertStatement, databaseUpdateStatement, deleteTerm, evaluate, firstDerivative, fromDatabase, fromXMLNode, getTerm, getTerms, highestPower, highestPowerCoefficient, highestPowerTerm, integrate, lowestPower, lowestPowerTerm, lowesttPowerCoefficient, multiply, multiply, multiply, multiply, multiply, multiplyBy, multiplyBy, multiplyBy, nthDerivative, numberOfTerms, pow, secondDerivative, set, setTerms, square, subtract, subtract, termIDs, toString, toStringAllTerms, toX3DNode
 
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
 

Constructor Detail

TwoVariablePolynomial

public TwoVariablePolynomial()
Default constructor. Sets up a new but empty vector of terms.


TwoVariablePolynomial

public TwoVariablePolynomial(java.util.Vector<NVariableTerm> terms)
Constructor. Initialises the vector of terms to the specified vector. Note that a local copy of all terms is made so as to facilitate the reuse of terms without corrupting subsequent calculations.

Parameters:
terms - Vector of terms.

TwoVariablePolynomial

public TwoVariablePolynomial(TwoVariablePolynomial object)
Coy constructor.

Parameters:
object - Object to copy.
Method Detail

firstDerivativeWithRespectToX

public TwoVariablePolynomial firstDerivativeWithRespectToX()
Returns the first derivative of this polynomial wrt x.

Returns:
First derivative of this polynomial wrt x.

firstDerivativeWithRespectToY

public TwoVariablePolynomial firstDerivativeWithRespectToY()
Returns the first derivative of this polynomial wrt y.

Returns:
First derivative of this polynomial wrt y.

toNVariablePolynomial

public NVariablePolynomial toNVariablePolynomial()
Converts this 2-vatiable polynomial to a general n-variable polynomial obect.

Returns:
NVariablePolynomial equivalent object of this 2-variable object.

evaluate

public double evaluate(double x0,
                       double y0)
Evaluates the polynomial for the specified variable values.

Parameters:
x0 - x-variable value.
y0 - y-variable value.
Returns:
Evaluation of this polynomial.

evaluate

public HDouble evaluate(HDouble x0,
                        HDouble y0)
HDouble version of evaluate(). Useful for integrating into OneVariableFunction.

Parameters:
x0 - x-variable value.
y0 - y-variable value.
Returns:
Evaluation of this polynomial.

toXMLNode

public org.w3c.dom.Element toXMLNode(org.w3c.dom.Document document,
                                     org.w3c.dom.Element documentRootNode)
                              throws InvalidObjectException
Returns the xml node of this object.

Specified by:
toXMLNode in interface ModelObject
Overrides:
toXMLNode in class NVariablePolynomial
Parameters:
document - XML document.
documentRootNode - Douument root node.
Returns:
The xml node of this object.
Throws:
InvalidObjectException - Thrown if this object is invalid.