List of usage examples for java.lang Math cosh
public static double cosh(double x)
From source file:com.nextbreakpoint.nextfractal.mandelbrot.core.Expression.java
public static Number funcTan(MutableNumber out, Number x) { double d = Math.pow(Math.cos(x.r()), 2) + Math.pow(Math.sinh(x.i()), 2); return out.set((Math.sin(x.r()) * Math.cos(x.r())) / d, (Math.sinh(x.i()) * Math.cosh(x.i())) / d); }
From source file:com.facebook.presto.operator.scalar.MathFunctions.java
@Description("hyperbolic cosine") @ScalarFunction// w w w .java2s . c om @SqlType(StandardTypes.DOUBLE) public static double cosh(@SqlType(StandardTypes.DOUBLE) double num) { return Math.cosh(num); }
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.util.tree.NumberArithmetic.java
/** * Returns the hyperbolic cosine of the number. * /*from w ww . j a va2 s.c o m*/ * @param a the number * @return the hyperbolic cosine of the number * @see Math#cosh(double) */ public static Number cosh(Number a) { return Math.cosh(a.doubleValue()); }
From source file:blusunrize.immersiveengineering.api.ApiUtils.java
public static Vec3d[] getConnectionCatenary(Vec3d start, Vec3d end, double slack, @Nullable Connection c) { double dx = (end.x) - (start.x); double dy = (end.y) - (start.y); double dz = (end.z) - (start.z); double dw = Math.sqrt(dx * dx + dz * dz); double k = Math.sqrt(dx * dx + dy * dy + dz * dz) * slack; double l = 0; int limiter = 0; while (limiter < 300) { limiter++;//w w w . j a va2 s. com l += 0.01; if (Math.sinh(l) / l >= Math.sqrt(k * k - dy * dy) / dw) break; } double a = dw / 2 / l; double offsetX = (0 + dw - a * Math.log((k + dy) / (k - dy))) * 0.5; double offsetY = (dy + 0 - k * Math.cosh(l) / Math.sinh(l)) * 0.5; if (c != null) { c.catOffsetX = offsetX; c.catOffsetY = offsetY; c.catA = a; c.horizontalLength = dw; } Vec3d[] vex = new Vec3d[vertices + 1]; vex[0] = new Vec3d(start.x, start.y, start.z); for (int i = 1; i < vertices; i++) { float posRelative = i / (float) vertices; double x = 0 + dx * posRelative; double z = 0 + dz * posRelative; double y = a * Math.cosh((dw * posRelative - offsetX) / a) + offsetY; vex[i] = new Vec3d(start.x + x, start.y + y, start.z + z); } vex[vertices] = new Vec3d(end.x, end.y, end.z); return vex; }
From source file:edu.cmu.tetrad.test.TestStatUtils.java
public void testLogCoshExp() { double sum = 0.0; int numSamples = 10000000; for (int i = 0; i < numSamples; i++) { double randNorm = RandomUtil.getInstance().nextNormal(0, 1); double a = Math.log(Math.cosh(randNorm)); sum += a;/*from w w w . j av a2s . co m*/ } double b = sum / numSamples; System.out.println(b); }
From source file:com.rapidminer.tools.expression.internal.function.AntlrParserTrigonometricTest.java
@Test public void coshInt() { try {/*from ww w. j a va 2 s . c om*/ Expression expression = getExpressionWithFunctionContext("cosh(16)"); assertEquals(ExpressionType.DOUBLE, expression.getExpressionType()); assertEquals(Math.cosh(16), expression.evaluateNumerical(), 1e-15); } catch (ExpressionException e) { assertNotNull(e.getMessage()); } }
From source file:com.rapidminer.tools.expression.internal.function.AntlrParserTrigonometricTest.java
@Test public void coshDouble() { try {//from www . j av a2 s . com Expression expression = getExpressionWithFunctionContext("cosh(33.3)"); assertEquals(ExpressionType.DOUBLE, expression.getExpressionType()); assertEquals(Math.cosh(33.3), expression.evaluateNumerical(), 1e-15); } catch (ExpressionException e) { assertNotNull(e.getMessage()); } }
From source file:com.rapidminer.tools.expression.internal.function.AntlrParserTrigonometricTest.java
@Test public void coshNegative() { try {//from ww w. j av a 2s. c o m Expression expression = getExpressionWithFunctionContext("cosh(-10)"); assertEquals(ExpressionType.DOUBLE, expression.getExpressionType()); assertEquals(Math.cosh(-10), expression.evaluateNumerical(), 1e-15); } catch (ExpressionException e) { assertNotNull(e.getMessage()); } }
From source file:com.rapidminer.tools.expression.internal.function.AntlrParserTrigonometricTest.java
@Test public void coshNull() { try {/* w w w. ja v a 2 s .c om*/ Expression expression = getExpressionWithFunctionContext("cosh(0)"); assertEquals(ExpressionType.DOUBLE, expression.getExpressionType()); assertEquals(Math.cosh(0), expression.evaluateNumerical(), 1e-15); } catch (ExpressionException e) { assertNotNull(e.getMessage()); } }
From source file:com.rapidminer.tools.expression.internal.function.AntlrParserTrigonometricTest.java
@Test public void coshNinety() { try {/* w w w . j a va 2s.com*/ Expression expression = getExpressionWithFunctionContext("cosh(90)"); assertEquals(ExpressionType.DOUBLE, expression.getExpressionType()); assertEquals(Math.cosh(90), expression.evaluateNumerical(), 1e-15); } catch (ExpressionException e) { assertNotNull(e.getMessage()); } }