/** {@inheritDoc} */ public double value(double x, double[] parameters) { final double a = parameters[0]; final double omega = parameters[1]; final double phi = parameters[2]; return a * FastMath.cos(omega * x + phi); }
/** {@inheritDoc} */ @Override public RealVector mapCosToSelf() { for (int i = 0; i < data.length; i++) { data[i] = FastMath.cos(data[i]); } return this; }
/** {@inheritDoc} */ @Override public double value(double d) { return FastMath.cos(d); } };
/** {@inheritDoc} */ public double value(double x) { return a * FastMath.cos(omega * x + phi); }
/** {@inheritDoc} */ public double[] gradient(double x, double[] parameters) { final double a = parameters[0]; final double omega = parameters[1]; final double phi = parameters[2]; final double alpha = omega * x + phi; final double cosAlpha = FastMath.cos(alpha); final double sinAlpha = FastMath.sin(alpha); return new double[] { cosAlpha, -a * x * sinAlpha, -a * sinAlpha }; }
/** Simple constructor. * Build a vector from its azimuthal coordinates * @param alpha azimuth (α) around Z * (0 is +X, π/2 is +Y, π is -X and 3π/2 is -Y) * @param delta elevation (δ) above (XY) plane, from -π/2 to +π/2 * @see #getAlpha() * @see #getDelta() */ public Vector3D(double alpha, double delta) { double cosDelta = FastMath.cos(delta); this.x = FastMath.cos(alpha) * cosDelta; this.y = FastMath.sin(alpha) * cosDelta; this.z = FastMath.sin(delta); }
/** {@inheritDoc} */ public double nextGaussian() { final double random; if (Double.isNaN(nextGaussian)) { // generate a new pair of gaussian numbers final double x = nextDouble(); final double y = nextDouble(); final double alpha = 2 * FastMath.PI * x; final double r = FastMath.sqrt(-2 * FastMath.log(y)); random = r * FastMath.cos(alpha); nextGaussian = r * FastMath.sin(alpha); } else { // use the second element of the pair already generated random = nextGaussian; nextGaussian = Double.NaN; } return random; }
LocalizedFormats.NEGATIVE_COMPLEX_MODULE, r); return new Complex(r * FastMath.cos(theta), r * FastMath.sin(theta));
final double cosT = FastMath.cos(t); final double sinT = FastMath.sin(t); omegaReal = new double[absN];
for (int k = 0; k < n ; k++) { final double realPart = nthRootOfAbs * FastMath.cos(innerPart); final double imaginaryPart = nthRootOfAbs * FastMath.sin(innerPart); result.add(createComplex(realPart, imaginaryPart));
return createComplex(expReal * FastMath.cos(imaginary), expReal * FastMath.sin(imaginary));
return createComplex(FastMath.cos(real) * MathUtils.cosh(imaginary), -FastMath.sin(real) * MathUtils.sinh(imaginary));
return createComplex(MathUtils.sinh(real) * FastMath.cos(imaginary), MathUtils.cosh(real) * FastMath.sin(imaginary));
return createComplex(MathUtils.cosh(real) * FastMath.cos(imaginary), MathUtils.sinh(real) * FastMath.sin(imaginary));
double d = FastMath.cos(real2) + MathUtils.cosh(imaginary2);
/** Estimate a first guess of the φ coefficient. */ private void guessPhi() { // initialize the means double fcMean = 0.0; double fsMean = 0.0; double currentX = observations[0].getX(); double currentY = observations[0].getY(); for (int i = 1; i < observations.length; ++i) { // one step forward final double previousX = currentX; final double previousY = currentY; currentX = observations[i].getX(); currentY = observations[i].getY(); final double currentYPrime = (currentY - previousY) / (currentX - previousX); double omegaX = omega * currentX; double cosine = FastMath.cos(omegaX); double sine = FastMath.sin(omegaX); fcMean += omega * currentY * cosine - currentYPrime * sine; fsMean += omega * currentY * sine + currentYPrime * cosine; } phi = FastMath.atan2(-fsMean, fcMean); }
double d = MathUtils.cosh(real2) + FastMath.cos(imaginary2);
FastMath.cos(real) * MathUtils.sinh(imaginary));
double coeff = FastMath.sin(halfAngle) / norm; q0 = FastMath.cos (halfAngle); q1 = coeff * axis.getX(); q2 = coeff * axis.getY();
final double a = 0.5 * (f[i] + f[n-i]); final double b = FastMath.sin(i * FastMath.PI / n) * (f[i] - f[n-i]); final double c = FastMath.cos(i * FastMath.PI / n) * (f[i] - f[n-i]); x[i] = a - b; x[n-i] = a + b;