当前位置: 首页>>代码示例>>Java>>正文


Java FastMath.E属性代码示例

本文整理汇总了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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:34,代码来源:DividedDifferenceInterpolatorTest.java

示例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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:34,代码来源:NevilleInterpolatorTest.java

示例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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:35,代码来源:DividedDifferenceInterpolatorTest.java

示例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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:35,代码来源:NevilleInterpolatorTest.java


注:本文中的org.apache.commons.math.util.FastMath.E属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。