|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.StepFunction
public class StepFunction
A function that is piecewise constant. It can be constructed either with a String that defines the intervall borders and the values there.
| Field Summary | |
|---|---|
private Polynom[] |
poly
The polynoms describing the function in the interval. |
private double[] |
x
The intervall boundaries. |
| Constructor Summary | |
|---|---|
StepFunction(String doubletokenize)
A step function can be constructed with a twice-tokenizable string like |
|
StepFunction(VectorG[] grid)
Constructs a step function with a grid of sampling. |
|
| Method Summary | |
|---|---|
double |
evaluate(double t)
We evaluate the step function. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private double[] x
private Polynom[] poly
| Constructor Detail |
|---|
public StepFunction(String doubletokenize)
1,2,0.4,.005;2,-3.-.4,0.01;3,1.,0.,0.
This string is converted into an array of VectorGs, the elements
of the vector separated by comas, the vectors by semicolon.
public StepFunction(VectorG[] grid)
vi-1(0)i(0),
dx=x-vi(0),
y=Σvi(j+1)*dx^j, j=0...v.dim-2
The function is in principle not defined outside the intervall
x<v0(0) and x>vn-1(0), but it is simply
extrapolated here.
The heaviside step function can be constructed with (0,0);(inf,1)
| Method Detail |
|---|
public double evaluate(double t)
dx = x-x[index];
y = polynom[index].evaluate(dx).
The polynomials act on the difference to keep the coefficients
handable.
Note that therefore dx is always negative, except beyond the last
interval border.
evaluate in interface Function
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||