|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.SimpleDifferentiator
public class SimpleDifferentiator
The simpliest Differentiator possible. Take the last two y-values
and divide their difference by the stepsize.
| Nested Class Summary | |
|---|---|
static class |
SimpleDifferentiator.E
Tests the integrator. |
| Field Summary | |
|---|---|
private double |
xlast
The x-value at the last call to add. |
private double |
xprior
The x-value prior-to-last. |
private double |
ylast
The y-value at the last call to add. |
private double |
yprior
The y-value prior-to-last. |
| Constructor Summary | |
|---|---|
SimpleDifferentiator()
Defaults the xprior to zero and the xlast value to
one, mimicing a step-size of one. |
|
| Method Summary | |
|---|---|
void |
add(double y)
Adds a new y-data point. |
void |
add(double x,
double y)
Adds a new x/y data point. |
double |
getDerivative()
Calculates the difference at the last points added. |
double |
getDerivative(double x)
Cannot compute. |
void |
setData(double[] y)
Takes the last two y-values as the last and prior-to-last y value. |
void |
setData(double[] x,
double[] y)
Takes the last two values of x and stores them for the step size. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private double xlast
private double xprior
private double ylast
private double yprior
| Constructor Detail |
|---|
public SimpleDifferentiator()
xprior to zero and the xlast value to
one, mimicing a step-size of one. This step-size is used in
equally-spaced differentiator methods, where x is never set.
| Method Detail |
|---|
public void setData(double[] x,
double[] y)
setData in interface Differentiatorx - A double-array representing the x-axis values.y - A double-array representing the y-axis values.public void setData(double[] y)
setData in interface Differentiatory - A double-array representing the y-axis values.
public void add(double x,
double y)
xlast to xprior
and stors the x-value passed over in xlast. Then, call the
add-method with the y-value alone.
add in interface Differentiatorx - A newly added x-value.y - A newly added y-value.public void add(double y)
ylast to yprior
and stors the y-value passed over in ylast.
add in interface Differentiatory - A newly added y-value.public double getDerivative()
getDerivative in interface Differentiatorpublic double getDerivative(double x)
getDerivative in interface Differentiator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||