calc
Class ComplexPowerSum

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

public class ComplexPowerSum
extends java.lang.Object


Field Summary
protected  Complex[] coefficients
          An Array of the coefficients
protected  Complex logCoeff
          contains the coefficient for a constructed logarithm (which may happen, when integrating z^-1)
protected  Complex[] powers
          the corresponding powers
protected  boolean valid
          a flag indicating, that an integration of z^-1 has happened, this flag must be checked, to test if further operations (other than eval()) are allowed.
 
Constructor Summary
ComplexPowerSum()
           
ComplexPowerSum(Complex[] coefficients, Complex[] powers)
          Nullpowersums (i.e. coefficients.length == 0) are allowed, but not a nullpointer argument!
ComplexPowerSum(Polynom p)
          convert a polynomial to a ComplexPowerSum
 
Method Summary
 Complex eval(Complex z)
          evaluates the powersum for a certain Complex number
 Complex getCoefficient(int i)
          return a coefficient of a single indexed monom
 Complex[] getCoefficients()
          returns all coefficients
 BaseCalc getOperationTree()
          builds and returns the corresponding operational tree for further calculations
 Complex getPower(int i)
          returns the power of a single indexed monom
 Complex[] getPowers()
          returns all powers
 void integrate(Complex constant)
          integrates the powersum numerically, using the arguments as range
static void main(java.lang.String[] args)
          for testing purposes
 void multiply(Complex d)
          multiplication with a number
 void multiply(ComplexPowerSum p)
          multiplication with another powersum
 void setCoefficient(int i, Complex value)
          sets a single specified coefficient
 void setCoefficient(int i, Complex value, Complex power)
          sets a single specified coefficient with the according power
 void sort()
          sorts the arrays in ascending order of powers
 java.lang.String toString()
          for pretty printing: output is of form: X^6 - 3.0X^5 + 2.5X^4 - 0.49999999999999956X^2 + 0.023809523809523885
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logCoeff

protected Complex logCoeff
contains the coefficient for a constructed logarithm (which may happen, when integrating z^-1)

valid

protected boolean valid
a flag indicating, that an integration of z^-1 has happened, this flag must be checked, to test if further operations (other than eval()) are allowed. It is set to false, if

coefficients

protected Complex[] coefficients
An Array of the coefficients

powers

protected Complex[] powers
the corresponding powers
Constructor Detail

ComplexPowerSum

public ComplexPowerSum(Complex[] coefficients,
                       Complex[] powers)
Nullpowersums (i.e. coefficients.length == 0) are allowed, but not a nullpointer argument!

ComplexPowerSum

public ComplexPowerSum(Polynom p)
convert a polynomial to a ComplexPowerSum

ComplexPowerSum

public ComplexPowerSum()
Method Detail

getCoefficient

public Complex getCoefficient(int i)
                       throws calc.InvalidException
return a coefficient of a single indexed monom

getPower

public Complex getPower(int i)
                 throws calc.InvalidException
returns the power of a single indexed monom

setCoefficient

public void setCoefficient(int i,
                           Complex value)
                    throws calc.InvalidException
sets a single specified coefficient

setCoefficient

public void setCoefficient(int i,
                           Complex value,
                           Complex power)
                    throws calc.InvalidException
sets a single specified coefficient with the according power

getCoefficients

public Complex[] getCoefficients()
                          throws calc.InvalidException
returns all coefficients

getPowers

public Complex[] getPowers()
                    throws calc.InvalidException
returns all powers

multiply

public void multiply(Complex d)
              throws calc.InvalidException
multiplication with a number

multiply

public void multiply(ComplexPowerSum p)
              throws calc.InvalidException
multiplication with another powersum

eval

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

sort

public void sort()
sorts the arrays in ascending order of powers

integrate

public void integrate(Complex constant)
               throws calc.InvalidException
integrates the powersum numerically, using the arguments as range

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