calc
Class Polynom

java.lang.Object
  |
  +--calc.Polynom

public class Polynom
extends java.lang.Object


Field Summary
protected  double[] coefficients
          An Array of the coefficients, in ascending power (i.e. beginning with the constant summand)
 
Constructor Summary
Polynom()
          the default constructor creates the nullpolynomial
Polynom(double[] coefficients)
          Nullpolynomials (i.e. coefficients.length == 0) are allowed, but not a nullpointer argument!
Polynom(Polynom p)
          Copy-Constructor
 
Method Summary
 void add(Polynom p)
          adds two polynomials
 int degree()
           
 Complex eval(Complex z)
          evaluates the polynomial for a certain complex number
 double getCoefficient(int i)
           
 double[] getCoefficients()
           
 BaseCalc getOperationTree()
          builds and returns the corresponding operational tree for further calculations
 void integrate(double constant)
          integrates the polynomial analytically, using the argument as integration constant
static void main(java.lang.String[] args)
          for testing purposes
 void multiply(double d)
          multiplication with a number
 void multiply(Polynom p)
          multiplication with another polynomial
 void setCoefficient(int i, double value)
           
 java.lang.String toString()
          for pretty printing: output is of form: X^6 - 3.0X^5 + 2.5X^4 - 0.49999999999999956X^2 + 0.023809523809523885
 void translate(double k)
          performs the operation f(x) -> f(x+k)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

coefficients

protected double[] coefficients
An Array of the coefficients, in ascending power (i.e. beginning with the constant summand)
Constructor Detail

Polynom

public Polynom()
the default constructor creates the nullpolynomial

Polynom

public Polynom(double[] coefficients)
Nullpolynomials (i.e. coefficients.length == 0) are allowed, but not a nullpointer argument!

Polynom

public Polynom(Polynom p)
Copy-Constructor
Method Detail

degree

public int degree()

getCoefficient

public double getCoefficient(int i)

setCoefficient

public void setCoefficient(int i,
                           double value)

getCoefficients

public double[] getCoefficients()

add

public void add(Polynom p)
adds two polynomials

multiply

public void multiply(double d)
multiplication with a number

multiply

public void multiply(Polynom p)
multiplication with another polynomial

translate

public void translate(double k)
performs the operation f(x) -> f(x+k)

eval

public Complex eval(Complex z)
evaluates the polynomial for a certain complex number

integrate

public void integrate(double constant)
integrates the polynomial analytically, using the argument as integration constant

toString

public java.lang.String toString()
for pretty printing: output is of form:
X^6 - 3.0X^5 + 2.5X^4 - 0.49999999999999956X^2 + 0.023809523809523885
Overrides:
toString in class java.lang.Object

getOperationTree

public BaseCalc getOperationTree()
builds and returns the corresponding operational tree for further calculations

main

public static void main(java.lang.String[] args)
for testing purposes