List of usage examples for java.lang Math sinh
public static double sinh(double x)
From source file:Main.java
public static void main(String[] args) { double x = 45; double y = -180; // convert them to radians x = Math.toRadians(x);/*from w ww. j av a 2s.c om*/ y = Math.toRadians(y); // print the hyperbolic sine for these doubles System.out.println("sinh(" + x + ")=" + Math.sinh(x)); System.out.println("sinh(" + y + ")=" + Math.sinh(y)); }
From source file:Main.java
public static double tile2lat(int y, int z) { double n = Math.PI - (2.0 * Math.PI * y) / Math.pow(2.0, z); return Math.toDegrees(Math.atan(Math.sinh(n))); }
From source file:com.cloudmade.api.Utils.java
/** * Convert tile coordinates pair to latitude, longitude * //from w ww . ja va2s .co m * @param xtile * @param ytile * @param zoom * @return Latitude, longitude pair */ public static final double[] tilenums2latlon(int xtile, int ytile, int zoom) { double factor = 1 << zoom; double latitude = Math.atan(Math.sinh(Math.PI * (1 - 2 * ytile / factor))); double longitude = (xtile * 360.0 / factor) - 180.0; return new double[] { Math.toDegrees(latitude), longitude }; }
From source file:net.sf.dsp4j.octave.packages.signal_1_2_0.NCauer.java
public NCauer(double Rp, double Rs, int n) { // Cutoff frequency = 1: double wp = 1; // Stop band edge ws: double ws = __ellip_ws(n, Rp, Rs); double k = wp / ws; double k1 = Math.sqrt(1.0 - Math.pow(k, 2)); double q0 = (1.0 / 2.0) * ((1.0 - Math.sqrt(k1)) / (1 + Math.sqrt(k1))); double q = q0 + 2.0 * Math.pow(q0, 5) + 15.0 * Math.pow(q0, 9) + 150.0 * Math.pow(q0, 13); //%(....) double D = (Math.pow(10, 0.1 * Rs) - 1.0) / (Math.pow(10, (0.1 * Rp)) - 1.0); //Filter order maybe this, but not used now: //n=ceil(log10(16*D)/log10(1/q)) double l = (1.0 / (2.0 * n)) * Math.log((Math.pow(10, 0.05 * Rp) + 1.0) / (Math.pow(10, 0.05 * Rp) - 1.0)); double sig01 = 0; double sig02 = 0; for (int m = 0; m <= 30; m++) { sig01 = sig01 + Math.pow((-1), m) * Math.pow(q, (m * (m + 1))) * Math.sinh((2 * m + 1) * l); }//from w w w . j a v a2 s . com for (int m = 1; m <= 30; m++) { sig02 = sig02 + Math.pow(-1.0, m) * Math.pow(q, (Math.pow(m, 2))) * Math.cosh(2 * m * l); } double sig0 = Math.abs((2.0 * Math.pow(q, (1.0 / 4.0)) * sig01) / (1.0 + 2.0 * sig02)); double w = Math.sqrt((1.0 + k * Math.pow(sig0, 2)) * (1.0 + Math.pow(sig0, 2) / k)); int r; if (n % 2 != 0) { r = (n - 1) / 2; } else { r = n / 2; } double[] wi = new double[r]; for (int ii = 1; ii <= r; ii++) { double mu; if (n % 2 != 0) { mu = ii; } else { mu = (double) ii - 0.5; } double soma1 = 0; for (int m = 0; m <= 30; m++) { soma1 = soma1 + 2.0 * Math.pow(q, (1.0 / 4.0)) * (Math.pow(-1.0, m) * Math.pow(q, (m * (m + 1))) * Math.sin(((2.0 * m + 1.0) * Math.PI * mu) / n)); } double soma2 = 0; for (int m = 1; m <= 30; m++) { soma2 = soma2 + 2.0 * (Math.pow(-1.0, m) * Math.pow(q, (Math.pow(m, 2))) * Math.cos((2.0 * m * Math.PI * mu) / n)); } wi[ii - 1] = (soma1 / (1.0 + soma2)); } double[] Vi = new double[wi.length]; for (int i = 0; i < wi.length; i++) { Vi[i] = Math.sqrt((1.0 - (k * (Math.pow(wi[i], 2)))) * (1.0 - (Math.pow(wi[i], 2)) / k)); } double[] A0i = new double[wi.length]; for (int i = 0; i < wi.length; i++) { A0i[i] = 1.0 / (Math.pow(wi[i], 2)); } double[] sqrA0i = new double[wi.length]; for (int i = 0; i < wi.length; i++) { sqrA0i[i] = 1.0 / wi[i]; } double[] B0i = new double[wi.length]; for (int i = 0; i < wi.length; i++) { B0i[i] = (Math.pow((sig0 * Vi[i]), 2) + Math.pow((w * wi[i]), 2)) / Math.pow((1.0 + Math.pow(sig0, 2) * Math.pow(wi[i], 2)), 2); } double C01; if (wi.length == 0) { C01 = 1.0; } else { C01 = B0i[0] / A0i[0]; for (int i = 1; i < wi.length; i++) { C01 *= B0i[i] / A0i[i]; } } //Gain T0: if (n % 2 != 0) { T0 = sig0 * C01 * Math.sqrt(ws); } else { T0 = Math.pow(10, (-0.05 * Rp)) * C01; } //zeros: zer = new Complex[sqrA0i.length * 2]; for (int i = 0; i < sqrA0i.length; i++) { zer[i] = Complex.valueOf(0.0, sqrA0i[i]); zer[i + sqrA0i.length] = Complex.valueOf(0.0, -sqrA0i[i]); } //poles: pol = new Complex[Vi.length * 2]; for (int i = 0; i < Vi.length; i++) { pol[i] = new Complex(-2.0 * sig0 * Vi[i], 2.0 * wi[i] * w) .divide(2.0 * (1 + Math.pow(sig0, 2) * Math.pow(wi[i], 2))); pol[i + Vi.length] = new Complex(-2.0 * sig0 * Vi[i], -2.0 * wi[i] * w) .divide(2.0 * (1 + Math.pow(sig0, 2) * Math.pow(wi[i], 2))); } //If n odd, there is a real pole -sig0: if (n % 2 != 0) { pol = Arrays.copyOf(pol, pol.length + 1); pol[pol.length - 1] = new Complex(-sig0); } for (int i = 0; i < pol.length; i++) { pol[i] = pol[i].multiply(Math.sqrt(ws)); } for (int i = 0; i < zer.length; i++) { zer[i] = zer[i].multiply(Math.sqrt(ws)); } }
From source file:com.opengamma.analytics.math.TrigonometricFunctionUtils.java
public static ComplexNumber cos(final ComplexNumber z) { Validate.notNull(z, "z"); final double x = z.getReal(); final double y = z.getImaginary(); return new ComplexNumber(Math.cos(x) * Math.cosh(y), -Math.sin(x) * Math.sinh(y)); }
From source file:com.opengamma.analytics.math.TrigonometricFunctionUtils.java
public static ComplexNumber cosh(final ComplexNumber z) { Validate.notNull(z, "z"); return new ComplexNumber(Math.cosh(z.getReal()) * Math.cos(z.getImaginary()), Math.sinh(z.getReal()) * Math.sin(z.getImaginary())); }
From source file:com.opengamma.analytics.math.TrigonometricFunctionUtils.java
public static ComplexNumber sin(final ComplexNumber z) { Validate.notNull(z, "z"); final double x = z.getReal(); final double y = z.getImaginary(); return new ComplexNumber(Math.sin(x) * Math.cosh(y), Math.cos(x) * Math.sinh(y)); }
From source file:com.opengamma.analytics.math.TrigonometricFunctionUtils.java
public static double sinh(final double x) { return Math.sinh(x); }
From source file:org.renjin.primitives.MathGroup.java
@Deferrable @Builtin/*from w ww. j ava2s .c o m*/ @DataParallel(value = PreserveAttributeStyle.ALL, passNA = true) public static double sinh(double x) { return Math.sinh(x); }
From source file:com.opengamma.analytics.math.TrigonometricFunctionUtils.java
public static ComplexNumber sinh(final ComplexNumber z) { Validate.notNull(z, "z"); return new ComplexNumber(Math.sinh(z.getReal()) * Math.cos(z.getImaginary()), Math.cosh(z.getReal()) * Math.sin(z.getImaginary())); }