java.lang.Math.cosh()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中java.lang.Math.cosh()方法的一些代码示例,展示了Math.cosh()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Math.cosh()方法的具体详情如下:
包路径:java.lang.Math
类名称:Math
方法名:cosh

Math.cosh介绍

[英]Returns the closest double approximation of the hyperbolic cosine of the argument. The returned result is within 2.5 ulps (units in the last place) of the real result.

Special cases:

  • cosh(+infinity) = +infinity
  • cosh(-infinity) = +infinity
  • cosh(NaN) = NaN
    [中]返回参数的双曲余弦的最接近的双近似值。返回的结果与实际结果相差2.5 ulps(最后一位为单位)。
    特殊情况:
    *余弦(+无穷大)=+无穷大
    *余弦(-无穷大)=+无穷大
    *cosh(NaN)=NaN

代码示例

代码示例来源:origin: h2oai/h2o-2

class ASTCosh extends ASTUniPrefixOp { @Override String opStr(){ return "cosh";  } @Override ASTOp make() {return new ASTCosh ();} @Override double op(double d) { return Math.cosh(d);}}
class ASTSinh extends ASTUniPrefixOp { @Override String opStr(){ return "sinh";  } @Override ASTOp make() {return new ASTSinh ();} @Override double op(double d) { return Math.sinh(d);}}

代码示例来源:origin: apache/incubator-druid

@Override
 protected ExprEval eval(double param)
 {
  return ExprEval.of(Math.cosh(param));
 }
}

代码示例来源:origin: plantuml/plantuml

public BigDecimal eval(List<? extends Number> parameters) {
    assertNotNull(parameters.get(0));
    /** Formula: sech(x) = 1 / cosh(x) */
    double one = 1;
    double d = Math.cosh(parameters.get(0).doubleValue());
    return new BigDecimal((one / d), mc);
  }
});

代码示例来源:origin: plantuml/plantuml

public BigDecimal eval(List<? extends Number> parameters) {
    assertNotNull(parameters.get(0));
    double d = Math.cosh(parameters.get(0).doubleValue());
    return new BigDecimal(d, mc);
  }
});

代码示例来源:origin: querydsl/querydsl

public static double coth(double x) {
  return Math.cosh(x) / Math.sinh(x);
}

代码示例来源:origin: kevin-wayne/algs4

/**
 * Returns the complex cosine of this complex number.
 *
 * @return the complex cosine of this complex number
 */
public Complex cos() {
  return new Complex(Math.cos(re) * Math.cosh(im), -Math.sin(re) * Math.sinh(im));
}

代码示例来源:origin: kevin-wayne/algs4

/**
 * Returns the complex sine of this complex number.
 *
 * @return the complex sine of this complex number
 */
public Complex sin() {
  return new Complex(Math.sin(re) * Math.cosh(im), Math.cos(re) * Math.sinh(im));
}

代码示例来源:origin: EngineHub/WorldEdit

public static double cosh(RValue x) throws EvaluationException {
  return Math.cosh(x.getValue());
}

代码示例来源:origin: deeplearning4j/nd4j

/**
 * The hyperbolic tangent.
 *
 * @param x The argument.
 * @return The tanh(x) = sinh(x)/cosh(x).
 */
static public BigDecimal tanh(final BigDecimal x) {
  if (x.compareTo(BigDecimal.ZERO) < 0) {
    return tanh(x.negate()).negate();
  } else if (x.compareTo(BigDecimal.ZERO) == 0) {
    return BigDecimal.ZERO;
  } else {
    BigDecimal xhighpr = scalePrec(x, 2);
    /* tanh(x) = (1-e^(-2x))/(1+e^(-2x)) .
     */
    BigDecimal exp2x = exp(xhighpr.multiply(new BigDecimal(-2)));
    /* The error in tanh x is err(x)/cosh^2(x).
     */
    double eps = 0.5 * x.ulp().doubleValue() / Math.pow(Math.cosh(x.doubleValue()), 2.0);
    MathContext mc = new MathContext(err2prec(Math.tanh(x.doubleValue()), eps));
    return BigDecimal.ONE.subtract(exp2x).divide(BigDecimal.ONE.add(exp2x), mc);
  }
} /* BigDecimalMath.tanh */

代码示例来源:origin: spotbugs/spotbugs

a = Math.ceil(1.5);
a = Math.cos(0.0);
a = Math.cosh(0.0);
a = Math.exp(0.0);
a = Math.exp(1.0);

代码示例来源:origin: prestodb/presto

@Test
public void testCosh()
{
  for (double doubleValue : DOUBLE_VALUES) {
    assertFunction("cosh(" + doubleValue + ")", DOUBLE, Math.cosh(doubleValue));
    assertFunction("cosh(REAL '" + (float) doubleValue + "')", DOUBLE, Math.cosh((float) doubleValue));
  }
  assertFunction("cosh(NULL)", DOUBLE, null);
}

代码示例来源:origin: prestodb/presto

@Description("hyperbolic cosine")
@ScalarFunction
@SqlType(StandardTypes.DOUBLE)
public static double cosh(@SqlType(StandardTypes.DOUBLE) double num)
{
  return Math.cosh(num);
}

代码示例来源:origin: stanfordnlp/CoreNLP

d = 1.0 / sigmaSq;
} else {
 val = Math.log(Math.cosh(norm));
 d = (2 * (1 / (Math.exp(-2.0 * norm) + 1)) - 1.0) / sigmaSq;

代码示例来源:origin: ankidroid/Anki-Android

return Math.sinh(expression.getValue());
case COSH:
  return Math.cosh(expression.getValue());
case LOG:
  return Math.log10(expression.getValue());

代码示例来源:origin: Cleveroad/WaveInApp

public Complex sin() {
  return new Complex(Math.sin(re) * Math.cosh(im), Math.cos(re) * Math.sinh(im));
}

代码示例来源:origin: Cleveroad/WaveInApp

public Complex cos() {
  return new Complex(Math.cos(re) * Math.cosh(im), -Math.sin(re) * Math.sinh(im));
}

代码示例来源:origin: pentaho/mondrian

@FunctionName("Cosh")
@Description("Returns the hyperbolic cosine of a number.")
public static double cosh(double number) {
  return Math.cosh(number);
}

代码示例来源:origin: lealone/Lealone

break;
case COSH:
  result = ValueDouble.get(Math.cosh(v0.getDouble()));
  break;
case COT: {

代码示例来源:origin: com.h2database/h2

break;
case COSH:
  result = ValueDouble.get(Math.cosh(v0.getDouble()));
  break;
case COT: {

代码示例来源:origin: OpenGamma/Strata

public static ComplexNumber sin(ComplexNumber z) {
 ArgChecker.notNull(z, "z");
 double x = z.getReal();
 double y = z.getImaginary();
 return new ComplexNumber(Math.sin(x) * Math.cosh(y), Math.cos(x) * Math.sinh(y));
}

相关文章