Bessel function of the second kind, of order 1.

@param x Value.
@return Y value.
355853
public static double Y(double x) {
        if (x < 8.0) {
            double y = x * x;
            double ans1 = x * (-0.4900604943e13 + y * (0.1275274390e13
                    + y * (-0.5153438139e11 + y * (0.7349264551e9
                    + y * (-0.4237922726e7 + y * 0.8511937935e4)))));
            double ans2 = 0.2499580570e14 + y * (0.4244419664e12
                    + y * (0.3733650367e10 + y * (0.2245904002e8
                    + y * (0.1020426050e6 + y * (0.3549632885e3 + y)))));
            return (ans1 / ans2) + 0.636619772 * (J(x) * Math.log(x) - 1.0 / x);
        } else {
            double z = 8.0 / x;
            double y = z * z;
            double xx = x - 2.356194491;
            double ans1 = 1.0 + y * (0.183105e-2 + y * (-0.3516396496e-4
                    + y * (0.2457520174e-5 + y * (-0.240337019e-6))));
            double ans2 = 0.04687499995 + y * (-0.2002690873e-3
                    + y * (0.8449199096e-5 + y * (-0.88228987e-6
                    + y * 0.105787412e-6)));
            return Math.sqrt(0.636619772 / x) *
                    (Math.sin(xx) * ans1 + z * Math.cos(xx) * ans2);
        }
    }
1366417
private double getExpectedProbability(double x)
    {
        double y = 1 / (standardDeviation * Math.sqrt(Math.PI * 2));
        double z = -(Math.pow(x - mean, 2) / (2 * Math.pow(standardDeviation, 2)));
        return y * Math.exp(z);
    }
795953
public static double cosh(double x) {
      if (x != x) {
          return x;
      }

      // cosh[z] = (exp(z) + exp(-z))/2

      // for numbers with magnitude 20 or so,
      // exp(-z) can be ignored in comparison with exp(z)

      if (x > 20) {
          if (x >= LOG_MAX_VALUE) {
              // Avoid overflow (MATH-905).
              final double t = exp(0.5 * x);
              return (0.5 * t) * t;
          } else {
              return 0.5 * exp(x);
          }
      } else if (x < -20) {
          if (x <= -LOG_MAX_VALUE) {
              // Avoid overflow (MATH-905).
              final double t = exp(-0.5 * x);
              return (0.5 * t) * t;
          } else {
              return 0.5 * exp(-x);
          }
      }

      final double hiPrec[] = new double[2];
      if (x < 0.0) {
          x = -x;
      }
      exp(x, 0.0, hiPrec);

      double ya = hiPrec[0] + hiPrec[1];
      double yb = -(ya - hiPrec[0] - hiPrec[1]);

      double temp = ya * HEX_40000000;
      double yaa = ya + temp - temp;
      double yab = ya - yaa;

      // recip = 1/y
      double recip = 1.0/ya;
      temp = recip * HEX_40000000;
      double recipa = recip + temp - temp;
      double recipb = recip - recipa;

      // Correct for rounding in division
      recipb += (1.0 - yaa*recipa - yaa*recipb - yab*recipa - yab*recipb) * recip;
      // Account for yb
      recipb += -yb * recip * recip;

      // y = y + 1/y
      temp = ya + recipa;
      yb += -(temp - ya - recipa);
      ya = temp;
      temp = ya + recipb;
      yb += -(temp - ya - recipb);
      ya = temp;

      double result = ya + yb;
      result *= 0.5;
      return result;
    }
835062
public String get(int x, int y)
    {
        if (x < 0) return HEAD + x;
        if (x >= v.length) return HEAD + "+" + (x - v.length + 1);

        return v[x][y];
    }
963857
public function getValue( $x )
	{
		$y = 0;
		for( $i = $this->getRank() - 1; $i >= 0; $i-- )
			$y	= $this->coefficients[$i] + $y * $x;
		return $y;
	}
223390
static public double myXRound(double x, double o) {
    return ((Math.abs(x - o) < 0.5) ? x : (myRound(2.0 * x) / 2.0));
  }
664730
public static double Function(double x) {
        double[] P =
                {
                        1.60119522476751861407E-4,
                        1.19135147006586384913E-3,
                        1.04213797561761569935E-2,
                        4.76367800457137231464E-2,
                        2.07448227648435975150E-1,
                        4.94214826801497100753E-1,
                        9.99999999999999996796E-1
                };
        double[] Q =
                {
                        -2.31581873324120129819E-5,
                        5.39605580493303397842E-4,
                        -4.45641913851797240494E-3,
                        1.18139785222060435552E-2,
                        3.58236398605498653373E-2,
                        -2.34591795718243348568E-1,
                        7.14304917030273074085E-2,
                        1.00000000000000000320E0
                };

        double p, z;

        double q = Math.abs(x);

        if (q > 33.0) {
            if (x < 0.0) {
                p = Math.floor(q);

                if (p == q) {
                    try {
                        throw new ArithmeticException("Overflow");
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

                z = q - p;
                if (z > 0.5) {
                    p += 1.0;
                    z = q - p;
                }
                z = q * Math.sin(Math.PI * z);

                if (z == 0.0) {
                    try {
                        throw new ArithmeticException("Overflow");
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

                z = Math.abs(z);
                z = Math.PI / (z * Stirling(q));

                return -z;
            } else {
                return Stirling(x);
            }
        }

        z = 1.0;
        while (x >= 3.0) {
            x -= 1.0;
            z *= x;
        }

        while (x < 0.0) {
            if (x == 0.0) {
                throw new ArithmeticException();
            } else if (x > -1.0E-9) {
                return (z / ((1.0 + 0.5772156649015329 * x) * x));
            }
            z /= x;
            x += 1.0;
        }

        while (x < 2.0) {
            if (x == 0.0) {
                throw new ArithmeticException();
            } else if (x < 1.0E-9) {
                return (z / ((1.0 + 0.5772156649015329 * x) * x));
            }

            z /= x;
            x += 1.0;
        }

        if ((x == 2.0) || (x == 3.0)) return z;

        x -= 2.0;
        p = Special.Polevl(x, P, 6);
        q = Special.Polevl(x, Q, 7);
        return z * p / q;

    }
13174
public double get(int x, int y) {
    return (x == y) ? 0 : (x < y) //
        ? matrix[MatrixParadigm.triangleSize(y) + x] //
        : matrix[MatrixParadigm.triangleSize(x) + y];
  }
1010103
public static double factorial(int x) {
    double result = 1.0;
    for (int i=x; i>1; i--) {
      result *= i;
    }
    return result;
  }
633958
public static double gamma(double x) {
        double xcopy = x;
        double first = x + LANCZOS_SMALL_GAMMA + 0.5;
        double second = LANCZOS_COEFF[0];
        double fg = 0.0;

        if (x >= 0.0) {
            if (x >= 1.0 && x - (int) x == 0.0) {
                fg = Math.factorial((int) x - 1);
            } else {
                first = Math.pow(first, x + 0.5) * Math.exp(-first);
                for (int i = 1; i <= LANCZOS_N; i++) {
                    second += LANCZOS_COEFF[i] / ++xcopy;
                }
                fg = first * Math.sqrt(2.0 * Math.PI) * second / x;
            }
        } else {
            fg = -Math.PI / (x * gamma(-x) * Math.sin(Math.PI * x));
        }
        return fg;
    }
1025981
@Pure
	public int getColumnFor(double x) {
		final double xx = x - this.bounds.getMinX();
		if (xx >= 0.)  {
			final int idx = (int) (xx / getCellWidth());
			assert idx >= 0;
			if (idx < getColumnCount()) {
				return idx;
			}
			return getColumnCount() - 1;
		}
		return 0;
	}
744023
public int selectPoint( double x, double y ) {
        double mind = Double.POSITIVE_INFINITY;
        selection = -1;
        for( int i = 0; i < pts.size(); i++ ) {
            Coordinate coordinate = pts.get(i);

            double d = sqr(coordinate.x - x) + sqr(coordinate.y - y);
            if (d < mind && d < EPSILON) {
                mind = d;
                selection = i;
            }
        }
        return selection;
    }
774304
protected DoubleMatrix1D getFi(DoubleMatrix1D X){
		final ConvexMultivariateRealFunction[] fis = request.getFi();
		if(fis==null){
			return null;
		}
		final double[] ret = new double[fis.length];
		final double[] x = X.toArray();
		for(int i=0; i<fis.length; i++){
			final ConvexMultivariateRealFunction fi = fis[i];
			final double fix = fi.value(x);
			ret[i] = fix;
		}
		return F1.make(ret);
	}
936090
@Pure
	public static Point2d L1_EL2(double x, double y) {
		final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
				LAMBERT_1_N,
				LAMBERT_1_C,
				LAMBERT_1_XS,
				LAMBERT_1_YS);
		return NTFLambdaPhi_NTFLambert(
				ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
				LAMBERT_2E_N,
				LAMBERT_2E_C,
				LAMBERT_2E_XS,
				LAMBERT_2E_YS);
	}
411345
private int locate(double x) {
        int ju, jm, jl;

        boolean ascnd = (xx[n - 1] >= xx[0]);

        jl = 0;
        ju = n - 1;
        while (ju - jl > 1) {
            jm = (ju + jl) >> 1;
            if (x >= xx[jm] == ascnd) {
                jl = jm;
            } else {
                ju = jm;
            }
        }

        cor = Math.abs(jl - jsav) <= dj;
        jsav = jl;

        return Math.max(0, Math.min(n - 2, jl));
    }
82014
private static double log1pe(double x) {
        double y = 0.0;
        if (x > 15) {
            y = x;
        } else {
            y += Math.log1p(Math.exp(x));
        }

        return y;
    }
850236
static public double rosenbrock(double[] x) {

    double sum = 0.0;

    for (int i = 0; i < (x.length - 1); i++) {
      double temp1 = (x[i] * x[i]) - x[i + 1];
      double temp2 = x[i] - 1.0;
      sum += (100.0 * temp1 * temp1) + (temp2 * temp2);
    }

    return (sum);
  }