本文整理汇总了Java中org.apache.commons.math.util.FastMath.E属性的典型用法代码示例。如果您正苦于以下问题:Java FastMath.E属性的具体用法?Java FastMath.E怎么用?Java FastMath.E使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math.util.FastMath
的用法示例。
在下文中一共展示了FastMath.E属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testExpm1Function
/**
* Test of interpolator for the exponential function.
* <p>
* |expm1^(n)(zeta)| <= e, zeta in [-1, 1]
*/
public void testExpm1Function() {
UnivariateRealFunction f = new Expm1Function();
UnivariateRealInterpolator interpolator = new DividedDifferenceInterpolator();
double x[], y[], z, expected, result, tolerance;
// 5 interpolating points on interval [-1, 1]
int n = 5;
double min = -1.0, max = 1.0;
x = new double[n];
y = new double[n];
for (int i = 0; i < n; i++) {
x[i] = min + i * (max - min) / n;
y[i] = f.value(x[i]);
}
double derivativebound = FastMath.E;
UnivariateRealFunction p = interpolator.interpolate(x, y);
z = 0.0; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
assertEquals(expected, result, tolerance);
z = 0.5; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
assertEquals(expected, result, tolerance);
z = -0.5; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
assertEquals(expected, result, tolerance);
}
示例2: testExpm1Function
/**
* Test of interpolator for the exponential function.
* <p>
* |expm1^(n)(zeta)| <= e, zeta in [-1, 1]
*/
public void testExpm1Function() {
UnivariateRealFunction f = new Expm1Function();
UnivariateRealInterpolator interpolator = new NevilleInterpolator();
double x[], y[], z, expected, result, tolerance;
// 5 interpolating points on interval [-1, 1]
int n = 5;
double min = -1.0, max = 1.0;
x = new double[n];
y = new double[n];
for (int i = 0; i < n; i++) {
x[i] = min + i * (max - min) / n;
y[i] = f.value(x[i]);
}
double derivativebound = FastMath.E;
UnivariateRealFunction p = interpolator.interpolate(x, y);
z = 0.0; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
assertEquals(expected, result, tolerance);
z = 0.5; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
assertEquals(expected, result, tolerance);
z = -0.5; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
assertEquals(expected, result, tolerance);
}
示例3: testExpm1Function
/**
* Test of interpolator for the exponential function.
* <p>
* |expm1^(n)(zeta)| <= e, zeta in [-1, 1]
*/
@Test
public void testExpm1Function() {
UnivariateRealFunction f = new Expm1Function();
UnivariateRealInterpolator interpolator = new DividedDifferenceInterpolator();
double x[], y[], z, expected, result, tolerance;
// 5 interpolating points on interval [-1, 1]
int n = 5;
double min = -1.0, max = 1.0;
x = new double[n];
y = new double[n];
for (int i = 0; i < n; i++) {
x[i] = min + i * (max - min) / n;
y[i] = f.value(x[i]);
}
double derivativebound = FastMath.E;
UnivariateRealFunction p = interpolator.interpolate(x, y);
z = 0.0; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
Assert.assertEquals(expected, result, tolerance);
z = 0.5; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
Assert.assertEquals(expected, result, tolerance);
z = -0.5; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
Assert.assertEquals(expected, result, tolerance);
}
示例4: testExpm1Function
/**
* Test of interpolator for the exponential function.
* <p>
* |expm1^(n)(zeta)| <= e, zeta in [-1, 1]
*/
@Test
public void testExpm1Function() {
UnivariateRealFunction f = new Expm1Function();
UnivariateRealInterpolator interpolator = new NevilleInterpolator();
double x[], y[], z, expected, result, tolerance;
// 5 interpolating points on interval [-1, 1]
int n = 5;
double min = -1.0, max = 1.0;
x = new double[n];
y = new double[n];
for (int i = 0; i < n; i++) {
x[i] = min + i * (max - min) / n;
y[i] = f.value(x[i]);
}
double derivativebound = FastMath.E;
UnivariateRealFunction p = interpolator.interpolate(x, y);
z = 0.0; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
Assert.assertEquals(expected, result, tolerance);
z = 0.5; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
Assert.assertEquals(expected, result, tolerance);
z = -0.5; expected = f.value(z); result = p.value(z);
tolerance = FastMath.abs(derivativebound * partialerror(x, z));
Assert.assertEquals(expected, result, tolerance);
}