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

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

本文整理了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

  1. class ASTCosh extends ASTUniPrefixOp { @Override String opStr(){ return "cosh"; } @Override ASTOp make() {return new ASTCosh ();} @Override double op(double d) { return Math.cosh(d);}}
  2. 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

  1. @Override
  2. protected ExprEval eval(double param)
  3. {
  4. return ExprEval.of(Math.cosh(param));
  5. }
  6. }

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

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

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

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

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

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

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

  1. /**
  2. * Returns the complex cosine of this complex number.
  3. *
  4. * @return the complex cosine of this complex number
  5. */
  6. public Complex cos() {
  7. return new Complex(Math.cos(re) * Math.cosh(im), -Math.sin(re) * Math.sinh(im));
  8. }

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

  1. /**
  2. * Returns the complex sine of this complex number.
  3. *
  4. * @return the complex sine of this complex number
  5. */
  6. public Complex sin() {
  7. return new Complex(Math.sin(re) * Math.cosh(im), Math.cos(re) * Math.sinh(im));
  8. }

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

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

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

  1. /**
  2. * The hyperbolic tangent.
  3. *
  4. * @param x The argument.
  5. * @return The tanh(x) = sinh(x)/cosh(x).
  6. */
  7. static public BigDecimal tanh(final BigDecimal x) {
  8. if (x.compareTo(BigDecimal.ZERO) < 0) {
  9. return tanh(x.negate()).negate();
  10. } else if (x.compareTo(BigDecimal.ZERO) == 0) {
  11. return BigDecimal.ZERO;
  12. } else {
  13. BigDecimal xhighpr = scalePrec(x, 2);
  14. /* tanh(x) = (1-e^(-2x))/(1+e^(-2x)) .
  15. */
  16. BigDecimal exp2x = exp(xhighpr.multiply(new BigDecimal(-2)));
  17. /* The error in tanh x is err(x)/cosh^2(x).
  18. */
  19. double eps = 0.5 * x.ulp().doubleValue() / Math.pow(Math.cosh(x.doubleValue()), 2.0);
  20. MathContext mc = new MathContext(err2prec(Math.tanh(x.doubleValue()), eps));
  21. return BigDecimal.ONE.subtract(exp2x).divide(BigDecimal.ONE.add(exp2x), mc);
  22. }
  23. } /* BigDecimalMath.tanh */

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

  1. a = Math.ceil(1.5);
  2. a = Math.cos(0.0);
  3. a = Math.cosh(0.0);
  4. a = Math.exp(0.0);
  5. a = Math.exp(1.0);

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

  1. @Test
  2. public void testCosh()
  3. {
  4. for (double doubleValue : DOUBLE_VALUES) {
  5. assertFunction("cosh(" + doubleValue + ")", DOUBLE, Math.cosh(doubleValue));
  6. assertFunction("cosh(REAL '" + (float) doubleValue + "')", DOUBLE, Math.cosh((float) doubleValue));
  7. }
  8. assertFunction("cosh(NULL)", DOUBLE, null);
  9. }

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

  1. @Description("hyperbolic cosine")
  2. @ScalarFunction
  3. @SqlType(StandardTypes.DOUBLE)
  4. public static double cosh(@SqlType(StandardTypes.DOUBLE) double num)
  5. {
  6. return Math.cosh(num);
  7. }

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

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

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

  1. return Math.sinh(expression.getValue());
  2. case COSH:
  3. return Math.cosh(expression.getValue());
  4. case LOG:
  5. return Math.log10(expression.getValue());

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

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

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

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

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

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

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

  1. break;
  2. case COSH:
  3. result = ValueDouble.get(Math.cosh(v0.getDouble()));
  4. break;
  5. case COT: {

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

  1. break;
  2. case COSH:
  3. result = ValueDouble.get(Math.cosh(v0.getDouble()));
  4. break;
  5. case COT: {

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

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

相关文章