All Packages Class Hierarchy This Package Previous Next Index
Class term.Funktion
java.lang.Object
|
+----term.TermBaum
|
+----term.Funktion
- public abstract class Funktion
- extends TermBaum
TermBaum of a Funktion.
This is the superclass of the implementations of various functions.
New functions can be added by adding new sub classes to this package.
New function classes are instantiated dynamically by name if they
occur in the parsed function.
Implemented functions | description |
ABS(p1) |
calculates the absolute value (?)
ABS(p1) = { (p1) if p1>=0, (-p1) if p1<0 }
|
SGN(p1) |
sign finction
SGN( p1 ) = { (-1) if p1<0, (0) if p1=0, (1) if p1>0 }
|
CEIL(p1), FLOOR(p1) |
round up/down
CEIL ( 0.1 ) = 1, FLOOR( 0.9 ) = 0
|
COS(p1), SIN(p1) |
cosine, sine
Warning: the calculation of these functions is very inaccurate
due to a neccessary conversion into "double" precision.
|
DIFF(v,p1) |
generates the symbolic derivation of the term p1 with respect to the variable v
|
DIV(p1,p2), MOD(p1,p2) |
integer division and modulo (?)
DIV( a*b+c, b ) = a
MOD( a*b+c, b ) = c
Note: p1 and p2 have to be integers to apply this function !
|
EXP(p1), LN(p1) |
natural power function and logarithm
|
FAK(p1) |
factorial FAK( p1 ) = p1*(p1-1)*(p1-2)* ... * 1
|
-
Funktion()
- protected Constructor for subclasses
-
Funktion(TermBaum)
- Special Constructor for subclasses with one operand.
-
ableitung(String)
- Abstract method that generates the derivation of a specific
function.
Non differentiable functions are encouraged to throw a
TermFaultException at this point.
-
AnzOperanden()
- The number of the parameters this function expects.
-
berechne(VariableTable, int)
- Calculate the function value for the given value of the
variables.
-
cloneTerm()
- copies a complete TermBaum
-
errorNoDerivation()
- Throws an exception to report a non differentiable function.
-
parse2Liste(String, int)
- Parses the single parameters of a function into a list.
-
parseFunktion(String, int)
- Parse a Term like 'F(p1,p2,...)',
returning an object representing the function that was
recognized.
New functions can be added by writing sub classes of this one
that will be instantiated by name if they occur in the parsed
function.
-
toString()
- Returns a String representatin of the function and its parameters.
-
vereinfache()
- Sub classes should return a new TermBaum
that is simplified as much as possible.
Funktion
protected Funktion(TermBaum operand)
- Special Constructor for subclasses with one operand.
Funktion
protected Funktion()
- protected Constructor for subclasses
ableitung
public abstract TermBaum ableitung(String variable)
- Abstract method that generates the derivation of a specific
function.
Non differentiable functions are encouraged to throw a
TermFaultException at this point.
- Overrides:
- ableitung in class TermBaum
AnzOperanden
protected abstract int AnzOperanden()
- The number of the parameters this function expects.
If the number in the parsed term differes from the
return value here, an Exception will be generated.
berechne
public abstract BigDecimal berechne(VariableTable variables,
int Genauigkeit)
- Calculate the function value for the given value of the
variables. The second parameter gives the number of decimals.
- Overrides:
- berechne in class TermBaum
cloneTerm
public TermBaum cloneTerm()
- copies a complete TermBaum
- Overrides:
- cloneTerm in class TermBaum
errorNoDerivation
protected final TermBaum errorNoDerivation()
- Throws an exception to report a non differentiable function.
parse2Liste
protected void parse2Liste(String Term,
int Offset) throws TermFaultException
- Parses the single parameters of a function into a list.
parseFunktion
public static Funktion parseFunktion(String Term,
int Offset) throws TermFaultException
- Parse a Term like 'F(p1,p2,...)',
returning an object representing the function that was
recognized.
New functions can be added by writing sub classes of this one
that will be instantiated by name if they occur in the parsed
function.
toString
public String toString()
- Returns a String representatin of the function and its parameters.
- Overrides:
- toString in class TermBaum
vereinfache
public abstract TermBaum vereinfache()
- Sub classes should return a new TermBaum
that is simplified as much as possible.
- Overrides:
- vereinfache in class TermBaum
All Packages Class Hierarchy This Package Previous Next Index