List of usage examples for java.lang Math sinh
public static double sinh(double x)
From source file:org.apache.flink.table.runtime.functions.SqlFunctionUtils.java
public static double sinh(Decimal a) { return Math.sinh(a.doubleValue()); }
From source file:com.opengamma.analytics.financial.model.finitedifference.HyperbolicMeshing.java
@Override public Double evaluate(Integer i) { Validate.isTrue(i >= 0 && i < getNumberOfPoints(), "i out of range"); if (i == 0) { return _l; }//from www . j a v a2 s .c om if (i == getNumberOfPoints() - 1) { return _r; } //short cut if required point is one of the specified fixed points if (_fpValues != null) { int index = _um.getFixedPointIndex(i); if (index >= 0) { return _fpValues[index]; } } final double z = _um.evaluate(i); return _alpha + _beta * Math.sinh(_gamma * z + _delta); }
From source file:com.opengamma.analytics.financial.var.JohnsonSUDeltaGammaVaRCalculator.java
@SuppressWarnings("unchecked") @Override// w ww. jav a 2s .c om public VaRCalculationResult evaluate(final NormalVaRParameters parameters, final T... data) { ArgumentChecker.notNull(parameters, "parameters"); ArgumentChecker.notNull(data, "data"); // TODO if skewness is positive then need to fit to -x and take from upper tail of distribution final double k = _kurtosisCalculator.evaluate(data); if (k < 0) { throw new IllegalArgumentException( "Johnson SU distribution cannot be used for data with negative excess kurtosis"); } final double mult = parameters.getTimeScaling(); final double z = parameters.getZ(); final double t = _skewCalculator.evaluate(data); final double mu = _meanCalculator.evaluate(data) * mult * mult; final double sigma = _stdCalculator.evaluate(data) * mult; if (t == 0 && k == 0) { return new VaRCalculationResult(z * sigma - mu, null); } final double wUpper = Math.sqrt(Math.sqrt(2 * (k + 2)) - 1); final double wLower = Math.max(getW0(t), getW1(k + 3)); final double w = ROOT_FINDER.getRoot(getFunction(t, k), wLower, wUpper); final double w2 = w * w; final double l = 4 + 2 * (w2 - (k + 6) / (w2 + 2 * w + 3)); if (l < 0) { throw new IllegalArgumentException("Tried to find the square root of a negative number"); } final double m = -2 + Math.sqrt(l); if (m == 0 || (m < 0 && w > -1) || (m > 0 && w < -1) || (w - 1 - m) < 0) { throw new IllegalArgumentException("Invalid parameters"); } final double sign = Math.signum(t); final double u = Math.sqrt(Math.log(w)); final double v = Math.sqrt((w + 1) * (w - 1 - m) / (2 * w * m)); final double omega = -sign * TrigonometricFunctionUtils.asinh(v); final double delta = 1. / u; final double gamma = omega / u; final double lambda = sigma / (w - 1) * Math.sqrt(2 * m / (w + 1)); final double ksi = mu - sign * sigma * Math.sqrt(w - 1 - m) / (w - 1); return new VaRCalculationResult(-lambda * Math.sinh((-z - gamma) / delta) - ksi, null); }
From source file:org.apache.drill.exec.fn.impl.TestNewMathFunctions.java
@Test public void testTrigoMathFunc() throws Throwable { final Object[] expected = new Object[] { Math.sin(45), Math.cos(45), Math.tan(45), Math.asin(45), Math.acos(45), Math.atan(45), Math.sinh(45), Math.cosh(45), Math.tanh(45) }; runTest(expected, "functions/testTrigoMathFunctions.json"); }
From source file:com.nextbreakpoint.nextfractal.mandelbrot.core.Expression.java
public static Number funcSin(MutableNumber out, Number x) { return out.set(Math.sin(x.r()) * Math.cosh(x.i()), +Math.cos(x.r()) * Math.sinh(x.i())); }
From source file:com.nextbreakpoint.nextfractal.mandelbrot.core.Expression.java
public static Number funcCos(MutableNumber out, Number x) { return out.set(Math.cos(x.r()) * Math.cosh(x.i()), -Math.sin(x.r()) * Math.sinh(x.i())); }
From source file:org.cirdles.ambapo.UTMToLatLong.java
/** * //from www .j a v a 2 s . c o m * @param xiNorth * @param etaEast * @param betaSeries * @return eta prime */ private static BigDecimal calcEtaPrime(BigDecimal xiNorth, BigDecimal etaEast, double[] betaSeries) { double xiNorthDouble = xiNorth.doubleValue(); double etaEastDouble = etaEast.doubleValue(); BigDecimal cosOfXiNorth; BigDecimal sinhOfEtaEast; BigDecimal subtrahend = new BigDecimal(0.0); int multiplicand = 2; for (double beta : betaSeries) { cosOfXiNorth = new BigDecimal(Math.cos(multiplicand * xiNorthDouble)); sinhOfEtaEast = new BigDecimal(Math.sinh(multiplicand * etaEastDouble)); subtrahend.add(new BigDecimal(beta).multiply(cosOfXiNorth).multiply(sinhOfEtaEast)); multiplicand += 2; } BigDecimal etaPrime = etaEast.subtract(subtrahend); return etaPrime; }
From source file:org.cirdles.geoapp.LatLongToUTM.java
private static BigDecimal calcConformalLatitude(BigDecimal eccentricity, BigDecimal latitudeRadians) { BigDecimal conformalLatitude; double latRadDouble = latitudeRadians.doubleValue(); double eccDouble = eccentricity.doubleValue(); double confLatDouble; Atanh atanh = new Atanh(); Asinh asinh = new Asinh(); confLatDouble = Math.atan(Math.sinh( asinh.value(Math.tan(latRadDouble)) - eccDouble * atanh.value(eccDouble * Math.sin(latRadDouble)))); conformalLatitude = new BigDecimal(confLatDouble); return conformalLatitude; }
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:org.lightjason.agentspeak.action.builtin.TestCActionMath.java
/** * data provider generator for single-value tests * @return data//from w ww .j a v a2 s.c om */ @DataProvider public static Object[] singlevaluegenerate() { return Stream.concat( singlevaluetestcase( Stream.of(2.5, 9.1, 111.7, 889.9), Stream.of(CNextPrime.class), (i) -> (double) Primes.nextPrime(i.intValue())), singlevaluetestcase( Stream.of(-2, -6, 4, -1, -5, 3, 49, 30, 6, 5, 1.3, 2.8, 9.7, 1, 8, 180, Math.PI), Stream.of(CAbs.class, CACos.class, CASin.class, CATan.class, CCeil.class, CCos.class, CCosh.class, CDegrees.class, CExp.class, CIsPrime.class, CLog.class, CLog10.class, CFloor.class, CRadians.class, CRound.class, CSignum.class, CSin.class, CSinh.class, CSqrt.class, CTan.class, CTanh.class), (i) -> Math.abs(i.doubleValue()), (i) -> Math.acos(i.doubleValue()), (i) -> Math.asin(i.doubleValue()), (i) -> Math.atan(i.doubleValue()), (i) -> Math.ceil(i.doubleValue()), (i) -> Math.cos(i.doubleValue()), (i) -> Math.cosh(i.doubleValue()), (i) -> Math.toDegrees(i.doubleValue()), (i) -> Math.exp(i.doubleValue()), (i) -> Primes.isPrime(i.intValue()), (i) -> Math.log(i.doubleValue()), (i) -> Math.log10(i.doubleValue()), (i) -> Math.floor(i.doubleValue()), (i) -> Math.toRadians(i.doubleValue()), (i) -> Math.round(i.doubleValue()), (i) -> Math.signum(i.doubleValue()), (i) -> Math.sin(i.doubleValue()), (i) -> Math.sinh(i.doubleValue()), (i) -> Math.sqrt(i.doubleValue()), (i) -> Math.tan(i.doubleValue()), (i) -> Math.tanh(i.doubleValue())) ).toArray(); }